mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
tom_bombadil.txt + TriggerAbilityResolves
This commit is contained in:
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Forge: Play Magic: the Gathering.
|
||||||
|
* Copyright (C) 2011 Forge Team
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package forge.game.trigger;
|
||||||
|
|
||||||
|
import forge.game.ability.AbilityKey;
|
||||||
|
import forge.game.card.Card;
|
||||||
|
import forge.game.spellability.SpellAbility;
|
||||||
|
import forge.util.Localizer;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class TriggerAbilityResolves extends Trigger {
|
||||||
|
|
||||||
|
public TriggerAbilityResolves(final Map<String, String> params, final Card host, final boolean intrinsic) {
|
||||||
|
super(params, host, intrinsic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc}
|
||||||
|
* @param runParams*/
|
||||||
|
@Override
|
||||||
|
public final boolean performTest(final Map<AbilityKey, Object> runParams) {
|
||||||
|
final SpellAbility spellAbility = (SpellAbility) runParams.get(AbilityKey.SpellAbility);
|
||||||
|
if (spellAbility == null) {
|
||||||
|
System.out.println("TriggerAbilityResolves performTest encountered spellAbility == null. runParams2 = " + runParams);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final Card source = spellAbility.getHostCard();
|
||||||
|
|
||||||
|
if (!matchesValidParam("ValidSpellAbility", spellAbility)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!matchesValidParam("ValidSource", source)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
public final void setTriggeringObjects(final SpellAbility sa, Map<AbilityKey, Object> runParams) {
|
||||||
|
final SpellAbility triggeredSA = (SpellAbility) runParams.get(AbilityKey.SpellAbility);
|
||||||
|
sa.setTriggeringObject(AbilityKey.Source, triggeredSA.getHostCard());
|
||||||
|
sa.setTriggeringObjectsFrom(
|
||||||
|
runParams,
|
||||||
|
AbilityKey.SpellAbility,
|
||||||
|
AbilityKey.Cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getImportantStackObjects(SpellAbility sa) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(Localizer.getInstance().getMessage("lblSpellAbility")).append(": ").append(sa.getTriggeringObject(AbilityKey.SpellAbility));
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ import forge.game.card.Card;
|
|||||||
public enum TriggerType {
|
public enum TriggerType {
|
||||||
Abandoned(TriggerAbandoned.class),
|
Abandoned(TriggerAbandoned.class),
|
||||||
AbilityCast(TriggerSpellAbilityCastOrCopy.class),
|
AbilityCast(TriggerSpellAbilityCastOrCopy.class),
|
||||||
|
AbilityResolves(TriggerAbilityResolves.class),
|
||||||
AbilityTriggered(TriggerAbilityTriggered.class),
|
AbilityTriggered(TriggerAbilityTriggered.class),
|
||||||
Adapt(TriggerAdapt.class),
|
Adapt(TriggerAdapt.class),
|
||||||
Always(TriggerAlways.class),
|
Always(TriggerAlways.class),
|
||||||
|
|||||||
@@ -526,6 +526,9 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
|||||||
}
|
}
|
||||||
} else if (sa.getApi() != null) {
|
} else if (sa.getApi() != null) {
|
||||||
AbilityUtils.handleRemembering(sa);
|
AbilityUtils.handleRemembering(sa);
|
||||||
|
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(source);
|
||||||
|
runParams.put(AbilityKey.SpellAbility, sa);
|
||||||
|
game.getTriggerHandler().runTrigger(TriggerType.AbilityResolves, runParams, false);
|
||||||
AbilityUtils.resolve(sa);
|
AbilityUtils.resolve(sa);
|
||||||
} else {
|
} else {
|
||||||
sa.resolve();
|
sa.resolve();
|
||||||
|
|||||||
10
forge-gui/res/cardsfolder/upcoming/tom_bombadil.txt
Normal file
10
forge-gui/res/cardsfolder/upcoming/tom_bombadil.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
Name:Tom Bombadil
|
||||||
|
ManaCost:W U B R G
|
||||||
|
Types:Legendary Creature God Bard
|
||||||
|
PT:4/4
|
||||||
|
S:Mode$ Continuous | Affected$ Card.Self | AddKeyword$ Hexproof & Indestructible | CheckSVar$ X | SVarCompare$ GE4 | Description$ As long as there are four or more lore counters among Sagas you control, CARDNAME has hexproof and indestructible.
|
||||||
|
SVar:X:Count$Valid Saga.YouCtrl$CardCounters.LORE
|
||||||
|
T:Mode$ AbilityResolves | ValidSource$ Saga.YouCtrl | ValidSpellAbility$ Ability.LastChapter | TriggerZones$ Battlefield | ActivationLimit$ 1 | Execute$ TrigDigUntil | TriggerDescription$ Whenever the final chapter ability of a Saga you control resolves, reveal cards from the top of your library until you reveal a Saga card. Put that onto the battlefield and the rest on the bottom of your library in a random order. This ability triggers only once each turn.
|
||||||
|
SVar:TrigDigUntil:DB$ DigUntil | Valid$ Saga | FoundDestination$ Battlefield | RevealedDestination$ Library | RevealedLibraryPosition$ -1 | RevealRandomOrder$ True
|
||||||
|
DeckNeeds:Type$Saga
|
||||||
|
Oracle:As long as there are four or more lore counters among Sagas you control, Tom Bombadil has hexproof and indestructible.\nWhenever the final chapter ability of a Saga you control resolves, reveal cards from the top of your library until you reveal a Saga card. Put that onto the battlefield and the rest on the bottom of your library in a random order. This ability triggers only once each turn.
|
||||||
Reference in New Issue
Block a user