diff --git a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java index 1620fcf3cf9..dc4ecb9a93f 100644 --- a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java +++ b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java @@ -1096,7 +1096,7 @@ public class AbilityUtils { o = ((CardCollection) c).get(0).getController(); } } - else if (defParsed.endsWith("Opponent")) { + else if (defParsed.endsWith("Opponent") && !defParsed.endsWith("IfOpponent")) { String triggeringType = defParsed.substring(9); triggeringType = triggeringType.substring(0, triggeringType.length() - 8); final Object c = root.getTriggeringObject(AbilityKey.fromString(triggeringType)); @@ -1124,8 +1124,22 @@ public class AbilityUtils { } } else { - final String triggeringType = defParsed.substring(9); + String triggeringType = defParsed.substring(9); + String filter = null; + if (triggeringType.contains("=")) { + filter = triggeringType.split("If")[1]; + triggeringType = triggeringType.split("If")[0]; + } o = root.getTriggeringObject(AbilityKey.fromString(triggeringType)); + if (filter != null) { + if (filter.equals("Opponent")) { + if (!(Player) o.isOpponentOf(((SpellAbility) sa).getActivatingPlayer())) { + o = null; + } + } else { + System.err.println("getDefinedPlayers needs additional code for =Filter"); + } + } } if (o != null) { if (o instanceof Player) { diff --git a/forge-gui/res/cardsfolder/c/captive_audience.txt b/forge-gui/res/cardsfolder/c/captive_audience.txt index a1aae500f63..cb9e37ed1df 100644 --- a/forge-gui/res/cardsfolder/c/captive_audience.txt +++ b/forge-gui/res/cardsfolder/c/captive_audience.txt @@ -5,11 +5,10 @@ R:Event$ Moved | ValidCard$ Card.Self | Destination$ Battlefield | ReplaceWith$ SVar:DBChooseOpp:DB$ ChoosePlayer | Defined$ You | Choices$ Player.Opponent | ChoiceTitle$ Choose an opponent to give control to: | AILogic$ Curse | SubAbility$ MoveToPlay SVar:MoveToPlay:DB$ ChangeZone | Hidden$ True | Origin$ All | Destination$ Battlefield | Defined$ ReplacedCard | GainControl$ True | NewController$ ChosenPlayer T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Execute$ TrigCharm | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your upkeep, ABILITY -SVar:TrigCharm:DB$ Charm | Choices$ LifePact,DiscardPact,ZombiesPact | ChoiceRestriction$ ThisGame | CharmNum$ 1 +SVar:TrigCharm:DB$ Charm | Choices$ LifePact,DiscardPact,MakeZombies | ChoiceRestriction$ ThisGame | CharmNum$ 1 SVar:LifePact:DB$ SetLife | Defined$ You | LifeAmount$ 4 | SpellDescription$ Your life total becomes 4. SVar:DiscardPact:DB$ Discard | Defined$ You | Mode$ Hand | SpellDescription$ Discard your hand. -SVar:ZombiesPact:DB$ RepeatEach | RepeatPlayers$ Player.Opponent | RepeatSubAbility$ MakeZombies | ChangeZoneTable$ True | SpellDescription$ Each opponent creates five 2/2 black Zombie creature tokens. -SVar:MakeZombies:DB$ Token | LegacyImage$ b 2 2 zombie rna | TokenAmount$ 5 | TokenScript$ b_2_2_zombie | TokenOwner$ Remembered | SpellDescription$ Each opponent creates five 2/2 black Zombie creature tokens. +SVar:MakeZombies:DB$ Token | TokenAmount$ 5 | TokenScript$ b_2_2_zombie | TokenOwner$ Opponent | SpellDescription$ Each opponent creates five 2/2 black Zombie creature tokens. SVar:SacMe:6 AI:RemoveDeck:Random DeckHas:Ability$Token diff --git a/forge-gui/res/cardsfolder/c/curse_of_bounty.txt b/forge-gui/res/cardsfolder/c/curse_of_bounty.txt index 9b2104aa9ee..e64645f2ff4 100644 --- a/forge-gui/res/cardsfolder/c/curse_of_bounty.txt +++ b/forge-gui/res/cardsfolder/c/curse_of_bounty.txt @@ -2,9 +2,8 @@ Name:Curse of Bounty ManaCost:1 G Types:Enchantment Aura Curse K:Enchant player -A:SP$ Attach | Cost$ 1 G | ValidTgts$ Player | AILogic$ Curse -T:Mode$ AttackersDeclared | ValidCard$ Creature | AttackedTarget$ Player.EnchantedBy | Execute$ TrigRepeat | TriggerZones$ Battlefield | TriggerDescription$ Whenever enchanted player is attacked, untap all nonland permanents you control. Each opponent attacking that player untaps all nonland permanents they control. -SVar:TrigRepeat:DB$ RepeatEach | RepeatPlayers$ TriggeredAttackingPlayerAndYou | RepeatSubAbility$ TrigUntap -SVar:TrigUntap:DB$ UntapAll | Defined$ Player.IsRemembered | ValidCards$ Permanent.nonLand | SpellDescription$ Whenever enchanted player is attacked, untap all nonland permanents you control. Each opponent attacking that player untaps all nonland permanents they control. -SVar:Picture:http://www.wizards.com/global/images/magic/general/curse_of_vitality.jpg +A:SP$ Attach | ValidTgts$ Player | AILogic$ Curse +T:Mode$ AttackersDeclared | ValidCard$ Creature | AttackedTarget$ Player.EnchantedBy | Execute$ TrigUntap | TriggerZones$ Battlefield | TriggerDescription$ Whenever enchanted player is attacked, untap all nonland permanents you control. Each opponent attacking that player untaps all nonland permanents they control. +SVar:TrigUntap:DB$ UntapAll | Defined$ You | ValidCards$ Permanent.nonLand | SubAbility$ DBUntap +SVar:DBUntap:DB$ UntapAll | Defined$ TriggeredAttackingPlayerIfOpponent | ValidCards$ Permanent.nonLand Oracle:Enchant player\nWhenever enchanted player is attacked, untap all nonland permanents you control. Each opponent attacking that player untaps all nonland permanents they control. diff --git a/forge-gui/res/cardsfolder/c/curse_of_disturbance.txt b/forge-gui/res/cardsfolder/c/curse_of_disturbance.txt index e0b164be4b6..df53532df34 100644 --- a/forge-gui/res/cardsfolder/c/curse_of_disturbance.txt +++ b/forge-gui/res/cardsfolder/c/curse_of_disturbance.txt @@ -2,9 +2,8 @@ Name:Curse of Disturbance ManaCost:2 B Types:Enchantment Aura Curse K:Enchant player -A:SP$ Attach | Cost$ 2 B | ValidTgts$ Player | AILogic$ Curse -T:Mode$ AttackersDeclared | ValidCard$ Creature | AttackedTarget$ Player.EnchantedBy | Execute$ TrigRepeat | TriggerZones$ Battlefield | TriggerDescription$ Whenever enchanted player is attacked, create a 2/2 black Zombie creature token. Each opponent attacking that player does the same. -SVar:TrigRepeat:DB$ RepeatEach | RepeatPlayers$ TriggeredAttackingPlayerAndYou | RepeatSubAbility$ TrigToken | ChangeZoneTable$ True -SVar:TrigToken:DB$ Token | TokenOwner$ Player.IsRemembered | TokenAmount$ 1 | TokenScript$ b_2_2_zombie | LegacyImage$ b 2 2 zombie c17 | SpellDescription$ Create a 2/2 black Zombie creature token. Activate only any time you could cast a sorcery. -SVar:Picture:http://www.wizards.com/global/images/magic/general/curse_of_vitality.jpg +A:SP$ Attach | ValidTgts$ Player | AILogic$ Curse +T:Mode$ AttackersDeclared | ValidCard$ Creature | AttackedTarget$ Player.EnchantedBy | Execute$ TrigToken | TriggerZones$ Battlefield | TriggerDescription$ Whenever enchanted player is attacked, create a 2/2 black Zombie creature token. Each opponent attacking that player does the same. +SVar:TrigToken:DB$ Token | TokenScript$ b_2_2_zombie | SubAbility$ DBToken +SVar:DBToken:DB$ Token | TokenOwner$ TriggeredAttackingPlayerIfOpponent | TokenScript$ b_2_2_zombie Oracle:Enchant player\nWhenever enchanted player is attacked, create a 2/2 black Zombie creature token. Each opponent attacking that player does the same. diff --git a/forge-gui/res/cardsfolder/c/curse_of_opulence.txt b/forge-gui/res/cardsfolder/c/curse_of_opulence.txt index 615942a8c45..5a073423ab2 100644 --- a/forge-gui/res/cardsfolder/c/curse_of_opulence.txt +++ b/forge-gui/res/cardsfolder/c/curse_of_opulence.txt @@ -2,8 +2,8 @@ Name:Curse of Opulence ManaCost:R Types:Enchantment Aura Curse K:Enchant player -A:SP$ Attach | Cost$ R | ValidTgts$ Player | AILogic$ Curse -T:Mode$ AttackersDeclared | ValidCard$ Creature | AttackedTarget$ Player.EnchantedBy | Execute$ TrigRepeat | TriggerZones$ Battlefield | TriggerDescription$ Whenever enchanted player is attacked, create a Gold token. Each opponent attacking that player does the same. (A Gold token is an artifact with "Sacrifice this artifact: Add one mana of any color.") -SVar:TrigRepeat:DB$ RepeatEach | RepeatPlayers$ TriggeredAttackingPlayerAndYou | RepeatSubAbility$ TrigToken | ChangeZoneTable$ True -SVar:TrigToken:DB$ Token | TokenScript$ c_a_gold_draw | TokenOwner$ Player.IsRemembered | TokenAmount$ 1 +A:SP$ Attach | ValidTgts$ Player | AILogic$ Curse +T:Mode$ AttackersDeclared | ValidCard$ Creature | AttackedTarget$ Player.EnchantedBy | Execute$ TrigToken | TriggerZones$ Battlefield | TriggerDescription$ Whenever enchanted player is attacked, create a Gold token. Each opponent attacking that player does the same. (A Gold token is an artifact with "Sacrifice this artifact: Add one mana of any color.") +SVar:TrigToken:DB$ Token | TokenScript$ c_a_gold_draw | SubAbility$ DBToken +SVar:DBToken:DB$ Token | TokenOwner$ TriggeredAttackingPlayerIfOpponent | TokenScript$ c_a_gold_draw Oracle:Enchant player\nWhenever enchanted player is attacked, create a Gold token. Each opponent attacking that player does the same. (A Gold token is an artifact with "Sacrifice this artifact: Add one mana of any color.") diff --git a/forge-gui/res/cardsfolder/c/curse_of_verbosity.txt b/forge-gui/res/cardsfolder/c/curse_of_verbosity.txt index 2d7d225c3e2..c9503bf4ca1 100644 --- a/forge-gui/res/cardsfolder/c/curse_of_verbosity.txt +++ b/forge-gui/res/cardsfolder/c/curse_of_verbosity.txt @@ -2,9 +2,8 @@ Name:Curse of Verbosity ManaCost:2 U Types:Enchantment Aura Curse K:Enchant player -A:SP$ Attach | Cost$ 2 U | ValidTgts$ Player | AILogic$ Curse +A:SP$ Attach | ValidTgts$ Player | AILogic$ Curse T:Mode$ AttackersDeclared | ValidCard$ Creature | AttackedTarget$ Player.EnchantedBy | Execute$ TrigRepeat | TriggerZones$ Battlefield | TriggerDescription$ Whenever enchanted player is attacked, draw a card. Each opponent attacking that player does the same. -SVar:TrigRepeat:DB$ RepeatEach | RepeatPlayers$ TriggeredAttackingPlayerAndYou | RepeatSubAbility$ TrigDraw -SVar:TrigDraw:DB$ Draw | NumCards$ 1 | Defined$ Player.IsRemembered -SVar:Picture:http://www.wizards.com/global/images/magic/general/curse_of_verbosity.jpg +SVar:TrigDraw:DB$ Draw | NumCards$ 1 | Defined$ You +SVar:DBDraw:DB$ Draw | NumCards$ 1 | Defined$ TriggeredAttackingPlayerIfOpponent Oracle:Enchant player\nWhenever enchanted player is attacked, you draw a card. Each opponent attacking that player does the same. diff --git a/forge-gui/res/cardsfolder/c/curse_of_vitality.txt b/forge-gui/res/cardsfolder/c/curse_of_vitality.txt index b8ca75058ab..acb55715ac5 100644 --- a/forge-gui/res/cardsfolder/c/curse_of_vitality.txt +++ b/forge-gui/res/cardsfolder/c/curse_of_vitality.txt @@ -2,9 +2,9 @@ Name:Curse of Vitality ManaCost:2 W Types:Enchantment Aura Curse K:Enchant player -A:SP$ Attach | Cost$ 2 W | ValidTgts$ Player | AILogic$ Curse -T:Mode$ AttackersDeclared | ValidCard$ Creature | AttackedTarget$ Player.EnchantedBy | Execute$ TrigRepeat | TriggerZones$ Battlefield | TriggerDescription$ Whenever enchanted player is attacked, you gain 2 life. Each opponent attacking that player does the same. -SVar:TrigRepeat:DB$ RepeatEach | RepeatPlayers$ TriggeredAttackingPlayerAndYou | RepeatSubAbility$ TrigGainLife -SVar:TrigGainLife:DB$ GainLife | Defined$ Player.IsRemembered | LifeAmount$ 2 -SVar:Picture:http://www.wizards.com/global/images/magic/general/curse_of_vitality.jpg +A:SP$ Attach | ValidTgts$ Player | AILogic$ Curse +T:Mode$ AttackersDeclared | ValidCard$ Creature | AttackedTarget$ Player.EnchantedBy | Execute$ TrigGainLife | TriggerZones$ Battlefield | TriggerDescription$ Whenever enchanted player is attacked, you gain 2 life. Each opponent attacking that player does the same. +SVar:TrigGainLife:DB$ GainLife | Defined$ You | LifeAmount$ 2 | SubAbility$ DBGainLife +SVar:DBGainLife:DB$ GainLife | Defined$ TriggeredAttackingPlayerIfOpponent | LifeAmount$ 2 +DeckHas:Ability$LifeGain Oracle:Enchant player\nWhenever enchanted player is attacked, you gain 2 life. Each opponent attacking that player does the same. diff --git a/forge-gui/res/cardsfolder/e/elephant_resurgence.txt b/forge-gui/res/cardsfolder/e/elephant_resurgence.txt index 543b4946a5d..000305a7031 100644 --- a/forge-gui/res/cardsfolder/e/elephant_resurgence.txt +++ b/forge-gui/res/cardsfolder/e/elephant_resurgence.txt @@ -1,12 +1,10 @@ Name:Elephant Resurgence ManaCost:1 G Types:Sorcery -A:SP$ RepeatEach | Cost$ 1 G | RepeatPlayers$ Player | RepeatSubAbility$ DBToken | ChangeZoneTable$ True | SpellDescription$ Each player creates a green Elephant creature token. Those creatures have "This creature's power and toughness are each equal to the number of creature cards in its controller's graveyard." -SVar:DBToken:DB$ Token | TokenAmount$ 1 | TokenScript$ g_x_x_elephant_resurgence | TokenOwner$ Player.IsRemembered | LegacyImage$ g x x elephant resurgence pcy +A:SP$ Token | TokenScript$ g_x_x_elephant_resurgence | TokenOwner$ Player | SpellDescription$ Each player creates a green Elephant creature token. Those creatures have "This creature's power and toughness are each equal to the number of creature cards in its controller's graveyard." SVar:NeedsToPlayVar:Z GE2 SVar:Z:SVar$Z1/Minus.Z2 SVar:Z1:Count$ValidGraveyard Creature.YouOwn SVar:Z2:Count$ValidGraveyard Creature.OppOwn AI:RemoveDeck:Random -SVar:Picture:http://www.wizards.com/global/images/magic/general/elephant_resurgence.jpg Oracle:Each player creates a green Elephant creature token. Those creatures have "This creature's power and toughness are each equal to the number of creature cards in its controller's graveyard."