Use triggers to remove counters from suspended cards. No longer hardcoded in upkeep.upkeepsuspend().

This commit is contained in:
RedDeckWins
2013-05-23 03:27:18 +00:00
parent 2d9b4cc936
commit 880e8fa449
2 changed files with 32 additions and 13 deletions

View File

@@ -17,11 +17,7 @@
*/ */
package forge.card.cardfactory; package forge.card.cardfactory;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
@@ -2349,18 +2345,41 @@ public class CardFactoryUtil {
card.addSpellAbility(abilitySuspend(card, cost, timeCounters)); card.addSpellAbility(abilitySuspend(card, cost, timeCounters));
} }
StringBuilder trig = new StringBuilder(); //upkeep trigger
trig.append("Mode$ CounterRemoved | TriggerZones$ Exile | ValidCard$ Card.Self | NewCounterAmount$ 0 | Execute$ DBPlay | Secondary$ True | "); StringBuilder upkeepTrig = new StringBuilder();
trig.append("TriggerDescription$ When the last time counter is removed from this card, if it's exiled, play it without paying its mana cost if able. "); UUID triggerSvar = UUID.randomUUID();
trig.append("If you can't, it remains exiled. If you cast a creature spell this way, it gains haste until you lose control of the spell or the permanent it becomes."); UUID removeCounterSvar = UUID.randomUUID();
upkeepTrig.append("Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Exile | CheckSVar$ ");
upkeepTrig.append(triggerSvar);
upkeepTrig.append(" | SVarCompare$ GE1 | References$ ");
upkeepTrig.append(triggerSvar);
upkeepTrig.append(" | Execute$ ");
upkeepTrig.append(removeCounterSvar);
upkeepTrig.append(" | TriggerDescription$ At the beginning of your upkeep, if this card is suspended, remove a time counter from it");
card.setSVar(removeCounterSvar.toString(), "DB$ RemoveCounter | Defined$ Self | CounterType$ TIME | CounterNum$ 1");
card.setSVar(triggerSvar.toString(),"Count$ValidExile Card.Self+suspended");
final Trigger parsedUpkeepTrig = TriggerHandler.parseTrigger(upkeepTrig.toString(), card, true);
card.addTrigger(parsedUpkeepTrig);
//play trigger
StringBuilder playTrig = new StringBuilder();
UUID playSvar = UUID.randomUUID();
playTrig.append("Mode$ CounterRemoved | TriggerZones$ Exile | ValidCard$ Card.Self | NewCounterAmount$ 0 | Secondary$ True | Execute$ ");
playTrig.append(playSvar.toString());
playTrig.append(" | TriggerDescription$ When the last time counter is removed from this card, if it's exiled, play it without paying its mana cost if able. ");
playTrig.append("If you can't, it remains exiled. If you cast a creature spell this way, it gains haste until you lose control of the spell or the permanent it becomes.");
StringBuilder playWithoutCost = new StringBuilder(); StringBuilder playWithoutCost = new StringBuilder();
playWithoutCost.append("DB$ Play | Defined$ Self | WithoutManaCost$ True | SuspendCast$ True"); playWithoutCost.append("DB$ Play | Defined$ Self | WithoutManaCost$ True | SuspendCast$ True");
final Trigger parsedTrigger = TriggerHandler.parseTrigger(trig.toString(), card, true); final Trigger parsedPlayTrigger = TriggerHandler.parseTrigger(playTrig.toString(), card, true);
card.addTrigger(parsedTrigger); card.addTrigger(parsedPlayTrigger);
card.setSVar("DBPlay",playWithoutCost.toString()); card.setSVar(playSvar.toString(),playWithoutCost.toString());
} // Suspend } // Suspend

View File

@@ -96,7 +96,7 @@ public class Upkeep extends Phase {
Upkeep.upkeepOathOfDruids(game); Upkeep.upkeepOathOfDruids(game);
Upkeep.upkeepOathOfGhouls(game); Upkeep.upkeepOathOfGhouls(game);
Upkeep.upkeepSuspend(game); //Upkeep.upkeepSuspend(game);
Upkeep.upkeepVanishing(game); Upkeep.upkeepVanishing(game);
Upkeep.upkeepFading(game); Upkeep.upkeepFading(game);
Upkeep.upkeepBlazeCounters(game); Upkeep.upkeepBlazeCounters(game);