Merge pull request #1126 from tool4ever/stateTrig

Fix multiple state trigger
This commit is contained in:
Anthony Calosa
2022-07-15 17:43:51 +08:00
committed by GitHub
4 changed files with 11 additions and 5 deletions

View File

@@ -154,8 +154,6 @@ public class AnimateEffect extends AnimateEffectBase {
} }
} }
List<Card> tgts = getCardsfromTargets(sa); List<Card> tgts = getCardsfromTargets(sa);
if (sa.hasParam("Optional")) { if (sa.hasParam("Optional")) {

View File

@@ -71,6 +71,7 @@ import forge.util.TextUtil;
*/ */
public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbilityStackInstance> { public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbilityStackInstance> {
private final List<SpellAbility> simultaneousStackEntryList = Lists.newArrayList(); private final List<SpellAbility> simultaneousStackEntryList = Lists.newArrayList();
private final List<SpellAbility> activePlayerSAs = Lists.newArrayList();
// They don't provide a LIFO queue, so had to use a deque // They don't provide a LIFO queue, so had to use a deque
private final Deque<SpellAbilityStackInstance> stack = new LinkedBlockingDeque<>(); private final Deque<SpellAbilityStackInstance> stack = new LinkedBlockingDeque<>();
@@ -824,7 +825,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
return false; return false;
} }
final List<SpellAbility> activePlayerSAs = Lists.newArrayList(); activePlayerSAs.clear();
for (int i = 0; i < simultaneousStackEntryList.size(); i++) { for (int i = 0; i < simultaneousStackEntryList.size(); i++) {
SpellAbility sa = simultaneousStackEntryList.get(i); SpellAbility sa = simultaneousStackEntryList.get(i);
Player activator = sa.getActivatingPlayer(); Player activator = sa.getActivatingPlayer();
@@ -843,6 +844,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
} }
activePlayer.getController().orderAndPlaySimultaneousSa(activePlayerSAs); activePlayer.getController().orderAndPlaySimultaneousSa(activePlayerSAs);
activePlayerSAs.clear();
return true; return true;
} }
@@ -864,6 +866,12 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
return true; return true;
} }
} }
for (final SpellAbility sa : activePlayerSAs) {
if (sa.getSourceTrigger() == triggerID) {
return true;
}
}
return false; return false;
} }

View File

@@ -3,7 +3,7 @@ ManaCost:2 G
Types:Snow Creature Elf Warrior Types:Snow Creature Elf Warrior
PT:3/2 PT:3/2
T:Mode$ SpellCast | ValidCard$ Creature | ValidActivatingPlayer$ You | Execute$ TrigEffect | TriggerZones$ Battlefield | SnowSpentForCardsColor$ True | TriggerDescription$ Whenever you cast a creature spell, if {S} of any of that spell's colors was spent to cast it, that creature enters the battlefield with an additional +1/+1 counter on it. ({S} is mana from a snow source.) T:Mode$ SpellCast | ValidCard$ Creature | ValidActivatingPlayer$ You | Execute$ TrigEffect | TriggerZones$ Battlefield | SnowSpentForCardsColor$ True | TriggerDescription$ Whenever you cast a creature spell, if {S} of any of that spell's colors was spent to cast it, that creature enters the battlefield with an additional +1/+1 counter on it. ({S} is mana from a snow source.)
SVar:TrigEffect:DB$ Effect | RememberObjects$ TriggeredCard | ReplacementEffects$ ETBCreat SVar:TrigEffect:DB$ Effect | RememberObjects$ TriggeredCard | ReplacementEffects$ ETBCreat | ExileOnMoved$ Stack
SVar:ETBCreat:Event$ Moved | ValidCard$ Card.IsRemembered | Destination$ Battlefield | ReplaceWith$ DBPutP1P1 | ReplacementResult$ Updated | Description$ That creature enters the battlefield with an additional +1/+1 counter on it. SVar:ETBCreat:Event$ Moved | ValidCard$ Card.IsRemembered | Destination$ Battlefield | ReplaceWith$ DBPutP1P1 | ReplacementResult$ Updated | Description$ That creature enters the battlefield with an additional +1/+1 counter on it.
SVar:DBPutP1P1:DB$ PutCounter | Defined$ ReplacedCard | CounterType$ P1P1 | ETB$ True | CounterNum$ 1 | SubAbility$ DBExile SVar:DBPutP1P1:DB$ PutCounter | Defined$ ReplacedCard | CounterType$ P1P1 | ETB$ True | CounterNum$ 1 | SubAbility$ DBExile
SVar:DBExile:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile SVar:DBExile:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile

View File

@@ -5,7 +5,7 @@ PT:3/4
K:Flying K:Flying
K:Haste K:Haste
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigChange | TriggerZones$ Battlefield | TriggerDescription$ Whenever CARDNAME attacks, return target creature card from your graveyard to the battlefield tapped and attacking. It gains "When you don't control a legendary Vampire, exile this creature." T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigChange | TriggerZones$ Battlefield | TriggerDescription$ Whenever CARDNAME attacks, return target creature card from your graveyard to the battlefield tapped and attacking. It gains "When you don't control a legendary Vampire, exile this creature."
SVar:TrigChange:DB$ ChangeZone | Origin$ Graveyard | Destination$ Battlefield | ValidTgts$ Creature.YouOwn | Tapped$ True | Attacking$ True | RememberChanged$ True | AnimateSubAbility$ DBAnimate SVar:TrigChange:DB$ ChangeZone | Origin$ Graveyard | Destination$ Battlefield | ValidTgts$ Creature.YouOwn | Tapped$ True | Attacking$ True | AnimateSubAbility$ DBAnimate
SVar:DBAnimate:DB$ Animate | Defined$ Remembered | Duration$ Permanent | Triggers$ TrigOlivia SVar:DBAnimate:DB$ Animate | Defined$ Remembered | Duration$ Permanent | Triggers$ TrigOlivia
SVar:TrigOlivia:Mode$ Always | TriggerZones$ Battlefield | IsPresent$ Vampire.YouCtrl+Legendary | PresentCompare$ EQ0 | Execute$ TrigExile | TriggerDescription$ When you don't control a legendary Vampire, exile this creature. SVar:TrigOlivia:Mode$ Always | TriggerZones$ Battlefield | IsPresent$ Vampire.YouCtrl+Legendary | PresentCompare$ EQ0 | Execute$ TrigExile | TriggerDescription$ When you don't control a legendary Vampire, exile this creature.
SVar:TrigExile:DB$ ChangeZone | Defined$ Self | Origin$ Battlefield | Destination$ Exile SVar:TrigExile:DB$ ChangeZone | Defined$ Self | Origin$ Battlefield | Destination$ Exile