- Experimental fix for Suspend keyworded ability. This switches the internal SVars used by Suspend from random UUIDs (which do not work correctly across zones, it seems) to fixed SVar names. Note the following:

* if there was a reason to use randomized SVars for Suspend, then there might be something else wrong with it now - please review and correct if my implementation is wrong.
* the AI has issues targeting with (some?) suspended cards (e.g. Rift Bolt used by the AI will always fizzle, the AI never targets correctly), please assist if possible.
This commit is contained in:
Agetian
2015-02-15 19:26:28 +00:00
parent 80d9bd9cf2
commit aca4e04d8e

View File

@@ -370,8 +370,8 @@ public class CardFactoryUtil {
public static void addSuspendUpkeepTrigger(Card card) { public static void addSuspendUpkeepTrigger(Card card) {
//upkeep trigger //upkeep trigger
StringBuilder upkeepTrig = new StringBuilder(); StringBuilder upkeepTrig = new StringBuilder();
UUID triggerSvar = UUID.randomUUID(); String triggerSvar = "SuspendTrigSV"; // FIXME: the SVars were previously random UUIDs (which caused the keyword not to work).
UUID removeCounterSvar = UUID.randomUUID(); String removeCounterSvar = "SuspendRemoveCtrSV";
upkeepTrig.append("Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Exile | CheckSVar$ "); upkeepTrig.append("Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Exile | CheckSVar$ ");
upkeepTrig.append(triggerSvar); upkeepTrig.append(triggerSvar);
@@ -382,8 +382,8 @@ public class CardFactoryUtil {
// Mark this trigger as Secondary, so it's not displayed twice // Mark this trigger as Secondary, so it's not displayed twice
upkeepTrig.append(" | Secondary$ True | TriggerDescription$ At the beginning of your upkeep, if this card is suspended, remove a time counter from it"); upkeepTrig.append(" | Secondary$ True | 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(removeCounterSvar, "DB$ RemoveCounter | Defined$ Self | CounterType$ TIME | CounterNum$ 1");
card.setSVar(triggerSvar.toString(),"Count$ValidExile Card.Self+suspended"); card.setSVar(triggerSvar,"Count$ValidExile Card.Self+suspended");
final Trigger parsedUpkeepTrig = TriggerHandler.parseTrigger(upkeepTrig.toString(), card, true); final Trigger parsedUpkeepTrig = TriggerHandler.parseTrigger(upkeepTrig.toString(), card, true);
card.addTrigger(parsedUpkeepTrig); card.addTrigger(parsedUpkeepTrig);
@@ -392,10 +392,10 @@ public class CardFactoryUtil {
public static void addSuspendPlayTrigger(Card card) { public static void addSuspendPlayTrigger(Card card) {
//play trigger //play trigger
StringBuilder playTrig = new StringBuilder(); StringBuilder playTrig = new StringBuilder();
UUID playSvar = UUID.randomUUID(); String playSvar = "SuspendPlaySV"; // FIXME: the SVars were previously random UUIDs (which caused the keyword not to work).
playTrig.append("Mode$ CounterRemoved | TriggerZones$ Exile | ValidCard$ Card.Self | CounterType$ TIME | NewCounterAmount$ 0 | Secondary$ True | Execute$ "); playTrig.append("Mode$ CounterRemoved | TriggerZones$ Exile | ValidCard$ Card.Self | CounterType$ TIME | NewCounterAmount$ 0 | Secondary$ True | Execute$ ");
playTrig.append(playSvar.toString()); playTrig.append(playSvar);
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(" | 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."); 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.");
@@ -405,7 +405,7 @@ public class CardFactoryUtil {
final Trigger parsedPlayTrigger = TriggerHandler.parseTrigger(playTrig.toString(), card, true); final Trigger parsedPlayTrigger = TriggerHandler.parseTrigger(playTrig.toString(), card, true);
card.addTrigger(parsedPlayTrigger); card.addTrigger(parsedPlayTrigger);
card.setSVar(playSvar.toString(),playWithoutCost.toString()); card.setSVar(playSvar, playWithoutCost.toString());
} }
/** /**