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 ccf695ca712..3f22941ab29 100644 --- a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java +++ b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java @@ -1415,77 +1415,12 @@ public class AbilityUtils { final boolean execSubsWhenNotPaid = "WhenNotPaid".equals(resolveSubs) || StringUtils.isBlank(resolveSubs); final boolean isSwitched = sa.hasParam("UnlessSwitched"); - // The cost - Cost cost; String unlessCost = sa.getParam("UnlessCost").trim(); - if (unlessCost.equals("CardManaCost")) { - cost = new Cost(source.getManaCost(), true); - } - else if (unlessCost.equals("ChosenManaCost")) { - if (!source.hasChosenCard()) { - cost = new Cost(ManaCost.ZERO, true); - } else { - cost = new Cost(Iterables.getFirst(source.getChosenCards(), null).getManaCost(), true); - } - } - else if (unlessCost.equals("ChosenNumber")) { - cost = new Cost(new ManaCost(new ManaCostParser(String.valueOf(source.getChosenNumber()))), true); - } - else if (unlessCost.startsWith("DefinedCost")) { - CardCollection definedCards = getDefinedCards(source, unlessCost.split("_")[1], sa); - if (definedCards.isEmpty()) { - sa.resolve(); - resolveSubAbilities(sa, game); - return; - } - Card card = definedCards.getFirst(); - ManaCostBeingPaid newCost = new ManaCostBeingPaid(card.getManaCost()); - // Check if there's a third underscore for cost modifying - if (unlessCost.split("_").length == 3) { - String modifier = unlessCost.split("_")[2]; - if (modifier.startsWith("Minus")) { - int max = Integer.parseInt(modifier.substring(5)); - if (sa.hasParam("UnlessUpTo")) { // Flash - max = allPayers.get(0).getController().chooseNumber(sa, Localizer.getInstance().getMessage("lblChooseNumber"), 0, max); - } - newCost.decreaseGenericMana(max); - } else { - newCost.increaseGenericMana(Integer.parseInt(modifier.substring(4))); - } - } - cost = new Cost(newCost.toManaCost(), true); - } - else if (unlessCost.startsWith("DefinedSACost")) { - FCollection definedSAs = getDefinedSpellAbilities(source, unlessCost.split("_")[1], sa); - if (definedSAs.isEmpty()) { - sa.resolve(); - resolveSubAbilities(sa, game); - return; - } - Card host = definedSAs.getFirst().getHostCard(); - if (host.getManaCost() == null) { - cost = new Cost(ManaCost.ZERO, true); - } else { - int xCount = host.getManaCost().countX(); - int xPaid = host.getXManaCostPaid() * xCount; - ManaCostBeingPaid toPay = new ManaCostBeingPaid(host.getManaCost()); - toPay.decreaseShard(ManaCostShard.X, xCount); - toPay.increaseGenericMana(xPaid); - cost = new Cost(toPay.toManaCost(), true); - } - } - else if (!StringUtils.isBlank(sa.getSVar(unlessCost)) || !StringUtils.isBlank(source.getSVar(unlessCost))) { - // check for X costs (stored in SVars - int xCost = calculateAmount(source, TextUtil.fastReplace(sa.getParam("UnlessCost"), - " ", ""), sa); - //Check for XColor - ManaCostBeingPaid toPay = new ManaCostBeingPaid(ManaCost.ZERO); - byte xColor = ManaAtom.fromName(sa.getParamOrDefault("UnlessXColor", "1")); - toPay.increaseShard(ManaCostShard.valueOf(xColor), xCost); - cost = new Cost(toPay.toManaCost(), true); - } - else { - cost = new Cost(unlessCost, true); + Cost cost = calculateUnlessCost(sa, unlessCost, true); + if (cost == null) { + sa.resolve(); + resolveSubAbilities(sa, game); + return; } boolean alreadyPaid = false; @@ -1510,6 +1445,67 @@ public class AbilityUtils { } } + public static Cost calculateUnlessCost(SpellAbility sa, String unlessCost, boolean beforePayment) { + final Card source = sa.getHostCard(); + Cost cost; + if (unlessCost.equals("ChosenNumber")) { + cost = new Cost(new ManaCost(new ManaCostParser(String.valueOf(source.getChosenNumber()))), true); + } + else if (unlessCost.startsWith("DefinedCost")) { + CardCollection definedCards = getDefinedCards(source, unlessCost.split("_")[1], sa); + if (definedCards.isEmpty()) { + return null; + } + Card card = definedCards.getFirst(); + ManaCostBeingPaid newCost = new ManaCostBeingPaid(card.getManaCost()); + // Check if there's a third underscore for cost modifying + if (unlessCost.split("_").length == 3) { + String modifier = unlessCost.split("_")[2]; + if (modifier.startsWith("Minus")) { + int max = Integer.parseInt(modifier.substring(5)); + if (sa.hasParam("UnlessUpTo") && beforePayment) { // Flash + max = sa.getActivatingPlayer().getController().chooseNumber(sa, Localizer.getInstance().getMessage("lblChooseNumber"), 0, max); + } + newCost.decreaseGenericMana(max); + } else { + newCost.increaseGenericMana(Integer.parseInt(modifier.substring(4))); + } + } + cost = new Cost(newCost.toManaCost(), true); + } + else if (unlessCost.startsWith("DefinedSACost")) { + FCollection definedSAs = getDefinedSpellAbilities(source, unlessCost.split("_")[1], sa); + if (definedSAs.isEmpty()) { + return null; + } + Card host = definedSAs.getFirst().getHostCard(); + if (host.getManaCost() == null) { + cost = new Cost(ManaCost.ZERO, true); + } else { + int xCount = host.getManaCost().countX(); + int xPaid = host.getXManaCostPaid() * xCount; + ManaCostBeingPaid toPay = new ManaCostBeingPaid(host.getManaCost()); + toPay.decreaseShard(ManaCostShard.X, xCount); + toPay.increaseGenericMana(xPaid); + cost = new Cost(toPay.toManaCost(), true); + } + } + else if (!StringUtils.isBlank(sa.getSVar(unlessCost)) && !unlessCost.equals("X")) { + // check for non-X costs (stored in SVars + int xCost = calculateAmount(source, TextUtil.fastReplace(sa.getParam("UnlessCost"), + " ", ""), sa); + //Check for XColor + ManaCostBeingPaid toPay = new ManaCostBeingPaid(ManaCost.ZERO); + byte xColor = ManaAtom.fromName(sa.getParamOrDefault("UnlessColor", "1")); + toPay.increaseShard(ManaCostShard.valueOf(xColor), xCost); + cost = new Cost(toPay.toManaCost(), true); + } + else { + cost = new Cost(unlessCost, true); + } + return cost; + } + /** *

* handleRemembering. diff --git a/forge-game/src/main/java/forge/game/mana/ManaRefundService.java b/forge-game/src/main/java/forge/game/mana/ManaRefundService.java index acfbc8edef9..3f84237fe00 100644 --- a/forge-game/src/main/java/forge/game/mana/ManaRefundService.java +++ b/forge-game/src/main/java/forge/game/mana/ManaRefundService.java @@ -54,7 +54,7 @@ public class ManaRefundService { payingAbilities.clear(); // update battlefield of all activating players - to redraw cards used to pay mana as untapped - for(Player p : payers) { + for (Player p : payers) { p.getGame().fireEvent(new GameEventZone(ZoneType.Battlefield, p, EventValueChangeType.ComplexUpdate, null)); } } diff --git a/forge-game/src/main/java/forge/game/spellability/AbilityManaPart.java b/forge-game/src/main/java/forge/game/spellability/AbilityManaPart.java index a187c9b2db9..1d41b4ad6d8 100644 --- a/forge-game/src/main/java/forge/game/spellability/AbilityManaPart.java +++ b/forge-game/src/main/java/forge/game/spellability/AbilityManaPart.java @@ -32,10 +32,12 @@ import forge.game.Game; import forge.game.GameActionUtil; import forge.game.IHasSVars; import forge.game.ability.AbilityKey; +import forge.game.ability.AbilityUtils; import forge.game.ability.ApiType; import forge.game.ability.SpellAbilityEffect; import forge.game.card.Card; import forge.game.card.CardUtil; +import forge.game.cost.Cost; import forge.game.mana.Mana; import forge.game.mana.ManaPool; import forge.game.player.Player; @@ -389,10 +391,19 @@ public class AbilityManaPart implements java.io.Serializable { } if (restriction.startsWith("CostContains")) { - if (restriction.endsWith("X") && sa.costHasManaX()) { + Game game = sa.getHostCard().getGame(); + Cost payment = sa.getPayCosts(); + if (game.getStack().isResolving() && sa.hasParam("UnlessCost")) { + payment = AbilityUtils.calculateUnlessCost(sa, sa.getParam("UnlessCost"), false); + } + if (payment.hasNoManaCost()) { + continue; + } + // TODO Thassa's Intervention with "twice {X}" is tricky + if (restriction.endsWith("X") && payment.getCostMana().getAmountOfX() > 0) { return true; } - if (restriction.endsWith("C") && sa.getPayCosts().hasManaCost() && sa.getPayCosts().getCostMana().getMana().getShardCount(ManaCostShard.COLORLESS) > 0) { + if (restriction.endsWith("C") && payment.getCostMana().getMana().getShardCount(ManaCostShard.COLORLESS) > 0) { return true; } continue; diff --git a/forge-game/src/main/java/forge/game/zone/MagicStack.java b/forge-game/src/main/java/forge/game/zone/MagicStack.java index 2eaa04df70b..335eabb1d12 100644 --- a/forge-game/src/main/java/forge/game/zone/MagicStack.java +++ b/forge-game/src/main/java/forge/game/zone/MagicStack.java @@ -191,6 +191,13 @@ public class MagicStack /* extends MyObservable */ implements Iterable pred) { if (source == null) { return false; diff --git a/forge-gui/res/cardsfolder/a/alliance_of_arms.txt b/forge-gui/res/cardsfolder/a/alliance_of_arms.txt index 08fdc05b838..979dd8c3b46 100644 --- a/forge-gui/res/cardsfolder/a/alliance_of_arms.txt +++ b/forge-gui/res/cardsfolder/a/alliance_of_arms.txt @@ -3,9 +3,9 @@ ManaCost:W Types:Sorcery A:SP$ RepeatEach | RepeatPlayers$ Player | StartingWithActivator$ True | RepeatSubAbility$ DBPay | SubAbility$ DBToken | StackDescription$ SpellDescription | SpellDescription$ Join forces — Starting with you, each player may pay any amount of mana. Each player creates X 1/1 white Soldier creature tokens, where X is the total amount of mana paid this way. SVar:DBPay:DB$ ChooseNumber | Defined$ Player.IsRemembered | ChooseAnyNumber$ True | ListTitle$ Pay Any Mana | SubAbility$ DBStore -SVar:DBStore:DB$ StoreSVar | SVar$ JoinForcesAmount | Type$ CountSVar | Expression$ JoinForcesAmount/Plus.X | UnlessCost$ X | UnlessPayer$ Player.IsRemembered | UnlessSwitched$ True | UnlessAI$ OnlyOwn +SVar:DBStore:DB$ StoreSVar | SVar$ JoinForcesAmount | Type$ CountSVar | Expression$ JoinForcesAmount/Plus.Y | UnlessCost$ Y | UnlessPayer$ Player.IsRemembered | UnlessSwitched$ True | UnlessAI$ OnlyOwn SVar:DBToken:DB$ Token | TokenAmount$ JoinForcesAmount | TokenScript$ w_1_1_soldier | TokenOwner$ Player | StackDescription$ None -SVar:X:Count$ChosenNumber +SVar:Y:Count$ChosenNumber SVar:JoinForcesAmount:Number$0 AI:RemoveDeck:All Oracle:Join forces — Starting with you, each player may pay any amount of mana. Each player creates X 1/1 white Soldier creature tokens, where X is the total amount of mana paid this way. diff --git a/forge-gui/res/cardsfolder/b/brine_seer.txt b/forge-gui/res/cardsfolder/b/brine_seer.txt index a7977a0eacb..1a8b0375055 100644 --- a/forge-gui/res/cardsfolder/b/brine_seer.txt +++ b/forge-gui/res/cardsfolder/b/brine_seer.txt @@ -3,8 +3,8 @@ ManaCost:3 U Types:Creature Human Wizard PT:1/1 A:AB$ Reveal | Cost$ 2 U T | Defined$ You | RevealValid$ Card.Blue | AnyNumber$ True | RememberRevealed$ True | SubAbility$ DBCounter | SpellDescription$ Reveal any number of blue cards in your hand. Counter target spell unless its controller pays {1} for each card revealed this way. -SVar:DBCounter:DB$ Counter | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ X | SubAbility$ DBCleanup +SVar:DBCounter:DB$ Counter | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ Y | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True -SVar:X:Remembered$Amount +SVar:Y:Remembered$Amount AI:RemoveDeck:All Oracle:{2}{U}, {T}: Reveal any number of blue cards in your hand. Counter target spell unless its controller pays {1} for each card revealed this way. diff --git a/forge-gui/res/cardsfolder/c/circular_logic.txt b/forge-gui/res/cardsfolder/c/circular_logic.txt index 3b449ecad66..fdd889b1f9b 100644 --- a/forge-gui/res/cardsfolder/c/circular_logic.txt +++ b/forge-gui/res/cardsfolder/c/circular_logic.txt @@ -1,7 +1,7 @@ Name:Circular Logic ManaCost:2 U Types:Instant -A:SP$ Counter | Cost$ 2 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ X | SpellDescription$ Counter target spell unless its controller pays {1} for each card in your graveyard. +A:SP$ Counter | Cost$ 2 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ Y | SpellDescription$ Counter target spell unless its controller pays {1} for each card in your graveyard. K:Madness:U -SVar:X:Count$InYourYard +SVar:Y:Count$InYourYard Oracle:Counter target spell unless its controller pays {1} for each card in your graveyard.\nMadness {U} (If you discard this card, discard it into exile. When you do, cast it for its madness cost or put it into your graveyard.) diff --git a/forge-gui/res/cardsfolder/c/collective_voyage.txt b/forge-gui/res/cardsfolder/c/collective_voyage.txt index aaa0162d248..6cd1f80c546 100644 --- a/forge-gui/res/cardsfolder/c/collective_voyage.txt +++ b/forge-gui/res/cardsfolder/c/collective_voyage.txt @@ -3,10 +3,10 @@ ManaCost:G Types:Sorcery A:SP$ RepeatEach | Cost$ G | RepeatPlayers$ Player | StartingWithActivator$ True | RepeatSubAbility$ DBPay | SubAbility$ DBSearch | StackDescription$ SpellDescription | SpellDescription$ Join forces — Starting with you, each player may pay any amount of mana. Each player searches their library for up to X basic land cards, where X is the total amount of mana paid this way, puts them onto the battlefield tapped, then shuffles. SVar:DBPay:DB$ ChooseNumber | Defined$ Player.IsRemembered | ChooseAnyNumber$ True | ListTitle$ Pay Any Mana | SubAbility$ DBStore -SVar:DBStore:DB$ StoreSVar | SVar$ JoinForcesAmount | Type$ CountSVar | Expression$ JoinForcesAmount/Plus.X | UnlessCost$ X | UnlessPayer$ Player.IsRemembered | UnlessSwitched$ True | UnlessAI$ OnlyOwn +SVar:DBStore:DB$ StoreSVar | SVar$ JoinForcesAmount | Type$ CountSVar | Expression$ JoinForcesAmount/Plus.Y | UnlessCost$ Y | UnlessPayer$ Player.IsRemembered | UnlessSwitched$ True | UnlessAI$ OnlyOwn SVar:DBSearch:DB$ ChangeZone | DefinedPlayer$ Player | ChangeType$ Land.Basic | ChangeNum$ JoinForcesAmount | Origin$ Library | Destination$ Battlefield | Tapped$ True | SubAbility$ DBReset | StackDescription$ None SVar:DBReset:DB$ StoreSVar | SVar$ JoinForcesAmount | Type$ Number | Expression$ 0 -SVar:X:Count$ChosenNumber +SVar:Y:Count$ChosenNumber SVar:JoinForcesAmount:Number$0 AI:RemoveDeck:All Oracle:Join forces — Starting with you, each player may pay any amount of mana. Each player searches their library for up to X basic land cards, where X is the total amount of mana paid this way, puts them onto the battlefield tapped, then shuffles. diff --git a/forge-gui/res/cardsfolder/c/concerted_defense.txt b/forge-gui/res/cardsfolder/c/concerted_defense.txt index b34be17c8ae..c60bda1e580 100644 --- a/forge-gui/res/cardsfolder/c/concerted_defense.txt +++ b/forge-gui/res/cardsfolder/c/concerted_defense.txt @@ -1,8 +1,8 @@ Name:Concerted Defense ManaCost:U Types:Instant -A:SP$ Counter | Cost$ U | TargetType$ Spell | TgtPrompt$ Select target noncreature spell | ValidTgts$ Card.nonCreature | UnlessCost$ X | SpellDescription$ Counter target noncreature spell unless its controller pays {1} plus an additional {1} for each creature for your party. (Your party consists of up to one each of Cleric, Rogue, Warrior, and Wizard.) -SVar:X:Count$Party/Plus.1 +A:SP$ Counter | Cost$ U | TargetType$ Spell | TgtPrompt$ Select target noncreature spell | ValidTgts$ Card.nonCreature | UnlessCost$ Y | SpellDescription$ Counter target noncreature spell unless its controller pays {1} plus an additional {1} for each creature for your party. (Your party consists of up to one each of Cleric, Rogue, Warrior, and Wizard.) +SVar:Y:Count$Party/Plus.1 DeckHas:Ability$Party DeckHints:Type$Cleric|Rogue|Warrior|Wizard Oracle:Counter target noncreature spell unless its controller pays {1} plus an additional {1} for each creature in your party. (Your party consists of up to one each of Cleric, Rogue, Warrior, and Wizard.) diff --git a/forge-gui/res/cardsfolder/c/countervailing_winds.txt b/forge-gui/res/cardsfolder/c/countervailing_winds.txt index a504393359d..38c4277bb2f 100644 --- a/forge-gui/res/cardsfolder/c/countervailing_winds.txt +++ b/forge-gui/res/cardsfolder/c/countervailing_winds.txt @@ -1,7 +1,7 @@ Name:Countervailing Winds ManaCost:2 U Types:Instant -A:SP$ Counter | Cost$ 2 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ X | SpellDescription$ Counter target spell unless its controller pays {1} for each card in your graveyard. +A:SP$ Counter | Cost$ 2 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ Y | SpellDescription$ Counter target spell unless its controller pays {1} for each card in your graveyard. K:Cycling:2 -SVar:X:Count$InYourYard +SVar:Y:Count$InYourYard Oracle:Counter target spell unless its controller pays {1} for each card in your graveyard.\nCycling {2} ({2}, Discard this card: Draw a card.) diff --git a/forge-gui/res/cardsfolder/c/cyclone.txt b/forge-gui/res/cardsfolder/c/cyclone.txt index 79647a37c05..fb1522a1f2f 100644 --- a/forge-gui/res/cardsfolder/c/cyclone.txt +++ b/forge-gui/res/cardsfolder/c/cyclone.txt @@ -3,9 +3,9 @@ ManaCost:2 G G Types:Enchantment T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigPutCounter | TriggerDescription$ At the beginning of your upkeep, put a wind counter on CARDNAME, then sacrifice CARDNAME unless you pay {G} for each wind counter on it. If you pay, CARDNAME deals damage equal to the number of wind counters on it to each creature and each player. SVar:TrigPutCounter:DB$ PutCounter | Defined$ Self | CounterType$ WIND | CounterNum$ 1 | SubAbility$ SacSelf -SVar:SacSelf:DB$ Sacrifice | UnlessCost$ X | UnlessXColor$ G | UnlessPayer$ You | UnlessResolveSubs$ WhenPaid | SubAbility$ DBDamageAll -SVar:DBDamageAll:DB$ DamageAll | NumDmg$ X | ValidCards$ Creature | ValidPlayers$ Player -SVar:X:Count$CardCounters.WIND +SVar:SacSelf:DB$ Sacrifice | UnlessCost$ Y | UnlessColor$ G | UnlessPayer$ You | UnlessResolveSubs$ WhenPaid | SubAbility$ DBDamageAll +SVar:DBDamageAll:DB$ DamageAll | NumDmg$ Y | ValidCards$ Creature | ValidPlayers$ Player +SVar:Y:Count$CardCounters.WIND AI:RemoveDeck:All DeckHas:Ability$Counters Oracle:At the beginning of your upkeep, put a wind counter on Cyclone, then sacrifice Cyclone unless you pay {G} for each wind counter on it. If you pay, Cyclone deals damage equal to the number of wind counters on it to each creature and each player. diff --git a/forge-gui/res/cardsfolder/d/disruption_aura.txt b/forge-gui/res/cardsfolder/d/disruption_aura.txt index b286a3535b4..388e3d0707e 100644 --- a/forge-gui/res/cardsfolder/d/disruption_aura.txt +++ b/forge-gui/res/cardsfolder/d/disruption_aura.txt @@ -5,6 +5,6 @@ K:Enchant artifact A:SP$ Attach | Cost$ 2 U | ValidTgts$ Artifact | TgtPrompt$ Select target artifact | AITgts$ Card.cmcGE1 | AILogic$ Curse S:Mode$ Continuous | Affected$ Artifact.EnchantedBy | AddTrigger$ TrigPhase | AddSVar$ TrigDisruptionAura | Description$ Enchanted artifact has "At the beginning of your upkeep, sacrifice this artifact unless you pay its mana cost." SVar:TrigPhase:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Execute$ TrigDisruptionAura | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your upkeep, sacrifice this artifact unless you pay its mana cost. -SVar:TrigDisruptionAura:DB$ Sacrifice | UnlessCost$ CardManaCost | UnlessPayer$ You +SVar:TrigDisruptionAura:DB$ Sacrifice | UnlessCost$ DefinedCost_Self | UnlessPayer$ You SVar:NonStackingAttachEffect:True Oracle:Enchant artifact\nEnchanted artifact has "At the beginning of your upkeep, sacrifice this artifact unless you pay its mana cost." diff --git a/forge-gui/res/cardsfolder/e/errant_minion.txt b/forge-gui/res/cardsfolder/e/errant_minion.txt index 9d280a80a11..0882842528e 100644 --- a/forge-gui/res/cardsfolder/e/errant_minion.txt +++ b/forge-gui/res/cardsfolder/e/errant_minion.txt @@ -7,9 +7,9 @@ T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player.EnchantedController | Execut R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Card.Self | ReplaceWith$ DBReplace | PreventionEffect$ True | Secondary$ True SVar:DBReplace:DB$ ReplaceDamage | Amount$ PaidAmount SVar:DBPay:DB$ ChooseNumber | Defined$ EnchantedController | ChooseAnyNumber$ True | ListTitle$ Pay Any Mana | AILogic$ PowerLeakMaxMana.2 | SubAbility$ DBStore -SVar:DBStore:DB$ StoreSVar | SVar$ PaidAmount | Type$ CountSVar | Expression$ X | UnlessCost$ X | UnlessPayer$ EnchantedController | UnlessSwitched$ True | SubAbility$ DBDmg +SVar:DBStore:DB$ StoreSVar | SVar$ PaidAmount | Type$ CountSVar | Expression$ Y | UnlessCost$ Y | UnlessPayer$ EnchantedController | UnlessSwitched$ True | SubAbility$ DBDmg SVar:DBDmg:DB$ DealDamage | Defined$ EnchantedController | NumDmg$ 2 | SubAbility$ DBReset | StackDescription$ None SVar:DBReset:DB$ StoreSVar | SVar$ PaidAmount | Type$ Number | Expression$ 0 -SVar:X:Count$ChosenNumber +SVar:Y:Count$ChosenNumber SVar:PaidAmount:Number$0 Oracle:Enchant creature\nAt the beginning of the upkeep of enchanted creature's controller, that player may pay any amount of mana. Errant Minion deals 2 damage to that player. Prevent X of that damage, where X is the amount of mana that player paid this way. diff --git a/forge-gui/res/cardsfolder/e/essence_leak.txt b/forge-gui/res/cardsfolder/e/essence_leak.txt index b4cd578be1c..518147b2b1b 100644 --- a/forge-gui/res/cardsfolder/e/essence_leak.txt +++ b/forge-gui/res/cardsfolder/e/essence_leak.txt @@ -5,7 +5,7 @@ K:Enchant permanent A:SP$ Attach | Cost$ U | ValidTgts$ Permanent | TgtPrompt$ Select target permanent | AITgts$ Card.cmcGE1+Green,Card.cmcGE1+Red | AILogic$ Curse S:Mode$ Continuous | Affected$ Permanent.AttachedBy+Red,Permanent.AttachedBy+Green | AddTrigger$ TrigEssencePhase | AddSVar$ TrigEssenceLeak | Description$ As long as enchanted permanent is red or green, it has "At the beginning of your upkeep, sacrifice this permanent unless you pay its mana cost." SVar:TrigEssencePhase:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Execute$ TrigEssenceLeak | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your upkeep, sacrifice this permanent unless you pay its mana cost. -SVar:TrigEssenceLeak:DB$ Sacrifice | UnlessCost$ CardManaCost | UnlessPayer$ You +SVar:TrigEssenceLeak:DB$ Sacrifice | UnlessCost$ DefinedCost_Self | UnlessPayer$ You AI:RemoveDeck:Random SVar:NonStackingAttachEffect:True Oracle:Enchant permanent\nAs long as enchanted permanent is red or green, it has "At the beginning of your upkeep, sacrifice this permanent unless you pay its mana cost." diff --git a/forge-gui/res/cardsfolder/e/evasive_action.txt b/forge-gui/res/cardsfolder/e/evasive_action.txt index 077c97e583b..efe8c9f35ef 100644 --- a/forge-gui/res/cardsfolder/e/evasive_action.txt +++ b/forge-gui/res/cardsfolder/e/evasive_action.txt @@ -1,6 +1,6 @@ Name:Evasive Action ManaCost:1 U Types:Instant -A:SP$ Counter | Cost$ 1 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ X | SpellDescription$ Domain — Counter target spell unless its controller pays {1} for each basic land type among lands you control. -SVar:X:Count$Domain +A:SP$ Counter | Cost$ 1 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ Y | SpellDescription$ Domain — Counter target spell unless its controller pays {1} for each basic land type among lands you control. +SVar:Y:Count$Domain Oracle:Domain — Counter target spell unless its controller pays {1} for each basic land type among lands you control. diff --git a/forge-gui/res/cardsfolder/g/goblin_lyre.txt b/forge-gui/res/cardsfolder/g/goblin_lyre.txt index 3fdbf71868c..fd2a64fdb06 100644 --- a/forge-gui/res/cardsfolder/g/goblin_lyre.txt +++ b/forge-gui/res/cardsfolder/g/goblin_lyre.txt @@ -1,10 +1,10 @@ Name:Goblin Lyre ManaCost:3 Types:Artifact -A:AB$ FlipACoin | Cost$ Sac<1/CARDNAME> | WinSubAbility$ DBDamageOpp | LoseSubAbility$ DBDamageYou | ValidTgts$ Opponent | TgtPrompt$ Choose target opponent | SpellDescription$ Flip a coin. If you win the flip, Goblin Lyre deals damage to target opponent equal to the number of creatures you control. If you lose the flip, Goblin Lyre deals damage to you equal to the number of creatures that opponent controls. +A:AB$ FlipACoin | Cost$ Sac<1/CARDNAME> | WinSubAbility$ DBDamageOpp | LoseSubAbility$ DBDamageYou | ValidTgts$ Opponent,Planeswalker | TgtPrompt$ Choose target opponent or planeswalker | SpellDescription$ Flip a coin. If you win the flip, CARDNAME deals damage to target opponent or planeswalker equal to the number of creatures you control. If you lose the flip, CARDNAME deals damage to you equal to the number of creatures that opponent or that planeswalker's controller controls. SVar:DBDamageOpp:DB$ DealDamage | Defined$ Targeted | NumDmg$ X SVar:DBDamageYou:DB$ DealDamage | Defined$ You | NumDmg$ Y SVar:X:Count$Valid Creature.YouCtrl -SVar:Y:Count$Valid Creature.OppCtrl +SVar:Y:Count$Valid Creature.ControlledBy TargetedOrController AI:RemoveDeck:All Oracle:Sacrifice Goblin Lyre: Flip a coin. If you win the flip, Goblin Lyre deals damage to target opponent or planeswalker equal to the number of creatures you control. If you lose the flip, Goblin Lyre deals damage to you equal to the number of creatures that opponent or that planeswalker's controller controls. diff --git a/forge-gui/res/cardsfolder/i/ingenious_mastery.txt b/forge-gui/res/cardsfolder/i/ingenious_mastery.txt index bf02c23a878..4be0fdad21d 100644 --- a/forge-gui/res/cardsfolder/i/ingenious_mastery.txt +++ b/forge-gui/res/cardsfolder/i/ingenious_mastery.txt @@ -2,7 +2,7 @@ Name:Ingenious Mastery ManaCost:X 2 U Types:Sorcery SVar:AltCost:Cost$ 2 U | Description$ You may pay {2}{U} rather than pay this spell's mana cost. | StackDescription$ If the {2}{U} cost was paid, you draw three cards, then an opponent creates two Treasure tokens and they scry 2. If that cost wasn't paid, you draw X cards. -A:SP$ Branch | BranchConditionSVar$ AltCostPaid | BranchConditionSVarCompare$ GE1 | TrueSubAbility$ DBAltCostEffect | FalseSubAbility$ DBDrawX +A:SP$ Branch | BranchConditionSVar$ AltCostPaid | BranchConditionSVarCompare$ GE1 | TrueSubAbility$ DBAltCostEffect | FalseSubAbility$ DBDrawX | SpellDescription$ If the {2}{U} cost was paid, you draw three cards, then an opponent creates two Treasure tokens and they scry 2. If that cost wasn't paid, you draw X cards. SVar:DBAltCostEffect:DB$ Draw | Defined$ You | NumCards$ 3 | SubAbility$ OppTreasureScry SVar:OppTreasureScry:DB$ ChoosePlayer | Defined$ You | Choices$ Player.Opponent | ChoiceTitle$ Choose an opponent to create treasure tokens and scry 2 | SubAbility$ OppTreasure SVar:OppTreasure:DB$ Token | TokenAmount$ 2 | TokenScript$ c_a_treasure_sac | TokenOwner$ ChosenPlayer | SubAbility$ OppScry diff --git a/forge-gui/res/cardsfolder/i/ixidors_will.txt b/forge-gui/res/cardsfolder/i/ixidors_will.txt index 3c54bf29fba..e1db3a3ff66 100644 --- a/forge-gui/res/cardsfolder/i/ixidors_will.txt +++ b/forge-gui/res/cardsfolder/i/ixidors_will.txt @@ -1,7 +1,7 @@ Name:Ixidor's Will ManaCost:2 U Types:Instant -A:SP$ Counter | Cost$ 2 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ X | SpellDescription$ Counter target spell unless its controller pays {2} for each Wizard on the battlefield. -SVar:X:Count$TypeYouCtrl.Wizard/Twice +A:SP$ Counter | Cost$ 2 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ Y | SpellDescription$ Counter target spell unless its controller pays {2} for each Wizard on the battlefield. +SVar:Y:Count$TypeYouCtrl.Wizard/Twice AI:RemoveDeck:Random Oracle:Counter target spell unless its controller pays {2} for each Wizard on the battlefield. diff --git a/forge-gui/res/cardsfolder/k/karn_living_legacy.txt b/forge-gui/res/cardsfolder/k/karn_living_legacy.txt index ff7ac03c743..caff7f593e0 100644 --- a/forge-gui/res/cardsfolder/k/karn_living_legacy.txt +++ b/forge-gui/res/cardsfolder/k/karn_living_legacy.txt @@ -4,11 +4,11 @@ Types:Legendary Planeswalker Karn Loyalty:4 A:AB$ Token | Cost$ AddCounter<1/LOYALTY> | Planeswalker$ True | TokenAmount$ 1 | TokenTapped$ True | TokenScript$ c_a_powerstone | TokenOwner$ You | SpellDescription$ Create a tapped Powerstone token. (It's an artifact with "{T}: Add {C}. This mana can't be spent to cast a nonartifact spell.") A:AB$ ChooseNumber | Cost$ SubCounter<1/LOYALTY> | Planeswalker$ True | Defined$ You | ChooseAnyNumber$ True | ListTitle$ Pay Any Mana | SubAbility$ DBDig | SpellDescription$ Pay any amount of mana. Look at that many cards from the top of your library, then put one of those cards into your hand and the rest on the bottom of your library in a random order. -SVar:DBDig:DB$ Dig | DigNum$ X | ChangeNum$ 1 | RestRandomOrder$ True | UnlessCost$ X | UnlessPayer$ You | UnlessSwitched$ True +SVar:DBDig:DB$ Dig | DigNum$ X | ChangeNum$ 1 | RestRandomOrder$ True | UnlessCost$ Y | UnlessPayer$ You | UnlessSwitched$ True A:AB$ Effect | Cost$ SubCounter<7/LOYALTY> | Planeswalker$ True | Ultimate$ True | AILogic$ Always | Stackable$ False | Name$ Emblem - Karn, Living Legacy | Image$ emblem_karn_living_legacy | Duration$ Permanent | Abilities$ KarnPing | SpellDescription$ You get an emblem with "Tap an untapped artifact you control: This emblem deals 1 damage to any target." SVar:KarnPing:AB$ DealDamage | Cost$ tapXType<1/Artifact> | ActivationZone$ Command | ValidTgts$ Any | NumDmg$ 1 SVar:PlayMain1:TRUE DeckHas:Ability$Token & Type$Artifact DeckNeeds:Type$Artifact -SVar:X:Count$ChosenNumber +SVar:Y:Count$ChosenNumber Oracle:[+1]: Create a tapped Powerstone token. (It's an artifact with "{T}: Add {C}. This mana can't be spent to cast a nonartifact spell.")\n[-1]: Pay any amount of mana. Look at that many cards from the top of your library, then put one of those cards into your hand and the rest on the bottom of your library in a random order.\n[-7]: You get an emblem with "Tap an untapped artifact you control: This emblem deals 1 damage to any target." diff --git a/forge-gui/res/cardsfolder/l/laboratory_drudge.txt b/forge-gui/res/cardsfolder/l/laboratory_drudge.txt index cab0ebbf3aa..5f3d8f92477 100644 --- a/forge-gui/res/cardsfolder/l/laboratory_drudge.txt +++ b/forge-gui/res/cardsfolder/l/laboratory_drudge.txt @@ -2,13 +2,9 @@ Name:Laboratory Drudge ManaCost:3 U Types:Creature Zombie Horror PT:3/4 -T:Mode$ Phase | Phase$ End of Turn | TriggerZones$ Battlefield | CheckSVar$ X | SVarCompare$ EQ1 | Execute$ TrigDraw | TriggerDescription$ At the beginning of each end step, draw a card if you've cast a spell from a graveyard or activated an ability of a card in a graveyard this turn. +T:Mode$ Phase | Phase$ End of Turn | TriggerZones$ Battlefield | CheckSVar$ NumCast | Execute$ TrigDraw | TriggerDescription$ At the beginning of each end step, draw a card if you've cast a spell from a graveyard or activated an ability of a card in a graveyard this turn. SVar:TrigDraw:DB$ Draw | Defined$ You | NumCards$ 1 -T:Mode$ SpellCast | ValidActivatingPlayer$ You | ValidCard$ Card.wasCastFromGraveyard | Execute$ TrigStore | TriggerZones$ Battlefield | Static$ True -T:Mode$ AbilityCast | ValidActivatingPlayer$ You | ValidCard$ Card.inZoneGraveyard | Execute$ TrigStore | TriggerZones$ Battlefield | Static$ True -SVar:TrigStore:DB$ StoreSVar | SVar$ X | Type$ Number | Expression$ 1 -SVar:X:Number$0 -T:Mode$ TurnBegin | Execute$ TrigReset | Static$ True -SVar:TrigReset:DB$ StoreSVar | SVar$ X | Type$ Number | Expression$ 0 +SVar:NumCast:Count$ThisTurnCast_Card.YouCtrl+wasCastFromGraveyard/Plus.NumAct +SVar:NumAct:Count$ThisTurnActivated_Activated.YouCtrl+inZoneGraveyard DeckHas:Ability$Graveyard Oracle:At the beginning of each end step, draw a card if you've cast a spell from a graveyard or activated an ability of a card in a graveyard this turn. diff --git a/forge-gui/res/cardsfolder/l/liege_of_the_hollows.txt b/forge-gui/res/cardsfolder/l/liege_of_the_hollows.txt index 881d0a35340..bfb64ca2e18 100644 --- a/forge-gui/res/cardsfolder/l/liege_of_the_hollows.txt +++ b/forge-gui/res/cardsfolder/l/liege_of_the_hollows.txt @@ -6,6 +6,6 @@ T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ SVar:RepeatPayment:DB$ RepeatEach | RepeatPlayers$ Player | StartingWithActivator$ True | ChangeZoneTable$ True | RepeatSubAbility$ DBPay | StackDescription$ When CARDNAME dies, each player may pay any amount of mana. Then each player creates a number of 1/1 green Squirrel creature tokens equal to the amount of mana they paid this way. SVar:DBPay:DB$ ChooseNumber | Defined$ Player.IsRemembered | ChooseAnyNumber$ True | ListTitle$ Pay Any Mana | AILogic$ MaxForAnyController | SubAbility$ DBToken # TODO: ideally the tokens should be created simultaneously after all the players have finished paying mana, but that's difficult to implement. -SVar:DBToken:DB$ Token | TokenAmount$ X | TokenScript$ g_1_1_squirrel | TokenOwner$ Player.IsRemembered | UnlessCost$ X | UnlessPayer$ Player.IsRemembered | UnlessSwitched$ True -SVar:X:Count$ChosenNumber +SVar:DBToken:DB$ Token | TokenAmount$ X | TokenScript$ g_1_1_squirrel | TokenOwner$ Player.IsRemembered | UnlessCost$ Y | UnlessPayer$ Player.IsRemembered | UnlessSwitched$ True +SVar:Y:Count$ChosenNumber Oracle:When Liege of the Hollows dies, each player may pay any amount of mana. Then each player creates a number of 1/1 green Squirrel creature tokens equal to the amount of mana they paid this way. diff --git a/forge-gui/res/cardsfolder/l/lofty_denial.txt b/forge-gui/res/cardsfolder/l/lofty_denial.txt index 13745e21859..61a92fa0531 100644 --- a/forge-gui/res/cardsfolder/l/lofty_denial.txt +++ b/forge-gui/res/cardsfolder/l/lofty_denial.txt @@ -1,8 +1,8 @@ Name:Lofty Denial ManaCost:1 U Types:Instant -A:SP$ Counter | Cost$ 1 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ X | SpellDescription$ Counter target spell unless its controller pays {1}. If you control a creature with flying, counter that spell unless its controller pays {4} instead. +A:SP$ Counter | Cost$ 1 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ Z | SpellDescription$ Counter target spell unless its controller pays {1}. If you control a creature with flying, counter that spell unless its controller pays {4} instead. SVar:Y:Count$Valid Creature.YouCtrl+withFlying -SVar:X:Count$Compare Y GE1.4.1 +SVar:Z:Count$Compare Y GE1.4.1 DeckHints:Keyword$Flying Oracle:Counter target spell unless its controller pays {1}. If you control a creature with flying, counter that spell unless its controller pays {4} instead. diff --git a/forge-gui/res/cardsfolder/m/mana_charged_dragon.txt b/forge-gui/res/cardsfolder/m/mana_charged_dragon.txt index 76f547194c3..f82f9b2b07e 100644 --- a/forge-gui/res/cardsfolder/m/mana_charged_dragon.txt +++ b/forge-gui/res/cardsfolder/m/mana_charged_dragon.txt @@ -8,9 +8,9 @@ T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigJoinForces | TriggerDescri T:Mode$ Blocks | ValidCard$ Card.Self | Execute$ TrigJoinForces | Secondary$ True | TriggerDescription$ Join forces — Whenever CARDNAME attacks or blocks, each player starting with you may pay any amount of mana. CARDNAME gets +X/+0 until end of turn, where X is the total amount of mana paid this way. SVar:TrigJoinForces:DB$ RepeatEach | RepeatPlayers$ Player | StartingWithActivator$ True | RepeatSubAbility$ DBPay | SubAbility$ DBPump SVar:DBPay:DB$ ChooseNumber | Defined$ Player.IsRemembered | ChooseAnyNumber$ True | ListTitle$ Pay Any Mana | SubAbility$ DBStore -SVar:DBStore:DB$ StoreSVar | SVar$ JoinForcesAmount | Type$ CountSVar | Expression$ JoinForcesAmount/Plus.X | UnlessCost$ X | UnlessPayer$ Player.IsRemembered | UnlessSwitched$ True | UnlessAI$ OnlyOwn +SVar:DBStore:DB$ StoreSVar | SVar$ JoinForcesAmount | Type$ CountSVar | Expression$ JoinForcesAmount/Plus.Y | UnlessCost$ Y | UnlessPayer$ Player.IsRemembered | UnlessSwitched$ True | UnlessAI$ OnlyOwn SVar:DBPump:DB$ Pump | Defined$ Self | NumAtt$ JoinForcesAmount | SubAbility$ DBReset SVar:DBReset:DB$ StoreSVar | SVar$ JoinForcesAmount | Type$ Number | Expression$ 0 -SVar:X:Count$ChosenNumber +SVar:Y:Count$ChosenNumber SVar:JoinForcesAmount:Number$0 Oracle:Flying, trample\nJoin forces — Whenever Mana-Charged Dragon attacks or blocks, each player starting with you may pay any amount of mana. Mana-Charged Dragon gets +X/+0 until end of turn, where X is the total amount of mana paid this way. diff --git a/forge-gui/res/cardsfolder/m/megatherium.txt b/forge-gui/res/cardsfolder/m/megatherium.txt index f46e5d8e4b6..6eb9fa98c37 100644 --- a/forge-gui/res/cardsfolder/m/megatherium.txt +++ b/forge-gui/res/cardsfolder/m/megatherium.txt @@ -4,7 +4,7 @@ Types:Creature Beast PT:4/4 K:Trample T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigSac | TriggerDescription$ When CARDNAME enters the battlefield, sacrifice it unless you pay {1} for each card in your hand. -SVar:TrigSac:DB$ Sacrifice | UnlessCost$ X | UnlessPayer$ You -SVar:X:Count$InYourHand +SVar:TrigSac:DB$ Sacrifice | UnlessCost$ Y | UnlessPayer$ You +SVar:Y:Count$InYourHand AI:RemoveDeck:All Oracle:Trample\nWhen Megatherium enters the battlefield, sacrifice it unless you pay {1} for each card in your hand. diff --git a/forge-gui/res/cardsfolder/m/minds_aglow.txt b/forge-gui/res/cardsfolder/m/minds_aglow.txt index 0d32e738282..aa253c145c8 100644 --- a/forge-gui/res/cardsfolder/m/minds_aglow.txt +++ b/forge-gui/res/cardsfolder/m/minds_aglow.txt @@ -3,10 +3,10 @@ ManaCost:U Types:Sorcery A:SP$ RepeatEach | Cost$ U | RepeatPlayers$ Player | StartingWithActivator$ True | RepeatSubAbility$ DBPay | SubAbility$ DBDraw | StackDescription$ SpellDescription | SpellDescription$ Join forces — Starting with you, each player may pay any amount of mana. Each player draws X cards, where X is the total amount of mana paid this way. SVar:DBPay:DB$ ChooseNumber | Defined$ Player.IsRemembered | ChooseAnyNumber$ True | ListTitle$ Pay Any Mana | SubAbility$ DBStore -SVar:DBStore:DB$ StoreSVar | SVar$ JoinForcesAmount | Type$ CountSVar | Expression$ JoinForcesAmount/Plus.X | UnlessCost$ X | UnlessPayer$ Player.IsRemembered | UnlessSwitched$ True | UnlessAI$ OnlyOwn +SVar:DBStore:DB$ StoreSVar | SVar$ JoinForcesAmount | Type$ CountSVar | Expression$ JoinForcesAmount/Plus.Y | UnlessCost$ Y | UnlessPayer$ Player.IsRemembered | UnlessSwitched$ True | UnlessAI$ OnlyOwn SVar:DBDraw:DB$ Draw | Defined$ Player | NumCards$ JoinForcesAmount | SubAbility$ DBReset | StackDescription$ None SVar:DBReset:DB$ StoreSVar | SVar$ JoinForcesAmount | Type$ Number | Expression$ 0 -SVar:X:Count$ChosenNumber +SVar:Y:Count$ChosenNumber SVar:JoinForcesAmount:Number$0 AI:RemoveDeck:All Oracle:Join forces — Starting with you, each player may pay any amount of mana. Each player draws X cards, where X is the total amount of mana paid this way. diff --git a/forge-gui/res/cardsfolder/o/oppressive_will.txt b/forge-gui/res/cardsfolder/o/oppressive_will.txt index 55c3a634d81..d84898d6771 100644 --- a/forge-gui/res/cardsfolder/o/oppressive_will.txt +++ b/forge-gui/res/cardsfolder/o/oppressive_will.txt @@ -1,7 +1,7 @@ Name:Oppressive Will ManaCost:2 U Types:Instant -A:SP$ Counter | Cost$ 2 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ X | SpellDescription$ Counter target spell unless its controller pays {1} for each card in your hand. -SVar:X:Count$InYourHand +A:SP$ Counter | Cost$ 2 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ Y | SpellDescription$ Counter target spell unless its controller pays {1} for each card in your hand. +SVar:Y:Count$InYourHand AI:RemoveDeck:All Oracle:Counter target spell unless its controller pays {1} for each card in your hand. diff --git a/forge-gui/res/cardsfolder/o/overencumbered.txt b/forge-gui/res/cardsfolder/o/overencumbered.txt index ffeeea0f65b..bbe8469dc44 100644 --- a/forge-gui/res/cardsfolder/o/overencumbered.txt +++ b/forge-gui/res/cardsfolder/o/overencumbered.txt @@ -6,8 +6,8 @@ A:SP$ Attach | ValidTgts$ Opponent | AILogic$ Curse T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigToken | TriggerDescription$ When CARDNAME enters the battlefield, enchanted opponent creates a Clue token, a Food token, and a Junk token. SVar:TrigToken:DB$ Token | TokenAmount$ 1 | TokenScript$ c_a_clue_draw,c_a_food_sac,c_a_junk_sac_exileplay | TokenOwner$ EnchantedPlayer T:Mode$ Phase | Phase$ BeginCombat | ValidPlayer$ Opponent.EnchantedBy | TriggerZones$ Battlefield | Execute$ TrigEffect | TriggerDescription$ At the beginning of combat on enchanted opponent's turn, that player may pay {1} for each artifact they control. If they don't, creatures can't attack this combat. -SVar:TrigEffect:DB$ Effect | UnlessCost$ X | UnlessPayer$ EnchantedPlayer | Duration$ UntilEndOfCombat | StaticAbilities$ StaticCantAttack +SVar:TrigEffect:DB$ Effect | UnlessCost$ Y | UnlessPayer$ EnchantedPlayer | Duration$ UntilEndOfCombat | StaticAbilities$ StaticCantAttack SVar:StaticCantAttack:Mode$ CantAttack | ValidCard$ Creature | Description$ Creatures can't attack this turn. -SVar:X:Count$Valid Artifact.EnchantedPlayerCtrl +SVar:Y:Count$Valid Artifact.EnchantedPlayerCtrl DeckHas:Ability$Token & Type$Clue|Food|Junk Oracle:Enchant opponent\nWhen Overencumbered enters the battlefield, enchanted opponent creates a Clue token, a Food token, and a Junk token.\nAt the beginning of combat on enchanted opponent's turn, that player may pay {1} for each artifact they control. If they don't, creatures can't attack this combat. diff --git a/forge-gui/res/cardsfolder/o/override.txt b/forge-gui/res/cardsfolder/o/override.txt index cb8c302937e..ea7326e2495 100644 --- a/forge-gui/res/cardsfolder/o/override.txt +++ b/forge-gui/res/cardsfolder/o/override.txt @@ -1,7 +1,7 @@ Name:Override ManaCost:2 U Types:Instant -A:SP$ Counter | Cost$ 2 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ X | SpellDescription$ Counter target spell unless its controller pays {1} for each artifact you control. -SVar:X:Count$Valid Artifact.YouCtrl +A:SP$ Counter | Cost$ 2 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ Y | SpellDescription$ Counter target spell unless its controller pays {1} for each artifact you control. +SVar:Y:Count$Valid Artifact.YouCtrl DeckNeeds:Type$Artifact Oracle:Counter target spell unless its controller pays {1} for each artifact you control. diff --git a/forge-gui/res/cardsfolder/p/pendrell_flux.txt b/forge-gui/res/cardsfolder/p/pendrell_flux.txt index f6a54be0b31..051c8d6e7c2 100644 --- a/forge-gui/res/cardsfolder/p/pendrell_flux.txt +++ b/forge-gui/res/cardsfolder/p/pendrell_flux.txt @@ -5,6 +5,6 @@ K:Enchant creature A:SP$ Attach | Cost$ 1 U | ValidTgts$ Creature | TgtPrompt$ Select target creature | AITgts$ Card.cmcGE1 | AILogic$ Curse S:Mode$ Continuous | Affected$ Creature.AttachedBy | AddTrigger$ TrigPhase | AddSVar$ TrigPendrellFlux | Description$ Enchanted creature has "At the beginning of your upkeep, sacrifice this creature unless you pay its mana cost." SVar:TrigPhase:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Execute$ TrigPendrellFlux | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your upkeep, sacrifice this creature unless you pay its mana cost. -SVar:TrigPendrellFlux:DB$ Sacrifice | UnlessCost$ CardManaCost | UnlessPayer$ You +SVar:TrigPendrellFlux:DB$ Sacrifice | UnlessCost$ DefinedCost_Self | UnlessPayer$ You SVar:NonStackingAttachEffect:True Oracle:Enchant creature\nEnchanted creature has "At the beginning of your upkeep, sacrifice this creature unless you pay its mana cost." diff --git a/forge-gui/res/cardsfolder/p/phantasmal_sphere.txt b/forge-gui/res/cardsfolder/p/phantasmal_sphere.txt index 80bc0d0574a..db61e54a462 100644 --- a/forge-gui/res/cardsfolder/p/phantasmal_sphere.txt +++ b/forge-gui/res/cardsfolder/p/phantasmal_sphere.txt @@ -5,10 +5,10 @@ PT:0/1 K:Flying T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigPutCounter | TriggerDescription$ At the beginning of your upkeep, put a +1/+1 counter on CARDNAME, then sacrifice CARDNAME unless you pay {1} for each +1/+1 counter on it. SVar:TrigPutCounter:DB$ PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1 | SubAbility$ SacSelf -SVar:SacSelf:DB$ Sacrifice | UnlessCost$ X | UnlessPayer$ You +SVar:SacSelf:DB$ Sacrifice | UnlessCost$ Y | UnlessPayer$ You T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.Self | Execute$ OrbToken | TriggerDescription$ When CARDNAME leaves the battlefield, target opponent creates an X/X blue Orb creature token with flying, where X is the number of +1/+1 counters on CARDNAME. SVar:OrbToken:DB$ Token | ValidTgts$ Opponent | TokenOwner$ Targeted | TokenScript$ u_x_x_orb_flying | TokenPower$ XLKI | TokenToughness$ XLKI | TokenAmount$ 1 -SVar:X:Count$CardCounters.P1P1 +SVar:Y:Count$CardCounters.P1P1 SVar:XLKI:TriggeredCard$CardCounters.P1P1 AI:RemoveDeck:All Oracle:Flying\nAt the beginning of your upkeep, put a +1/+1 counter on Phantasmal Sphere, then sacrifice Phantasmal Sphere unless you pay {1} for each +1/+1 counter on it.\nWhen Phantasmal Sphere leaves the battlefield, target opponent creates an X/X blue Orb creature token with flying, where X is the number of +1/+1 counters on Phantasmal Sphere. diff --git a/forge-gui/res/cardsfolder/p/power_leak.txt b/forge-gui/res/cardsfolder/p/power_leak.txt index d4a5b738138..ad5d9d1e858 100644 --- a/forge-gui/res/cardsfolder/p/power_leak.txt +++ b/forge-gui/res/cardsfolder/p/power_leak.txt @@ -7,9 +7,9 @@ T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player.EnchantedController | Execut R:Event$ DamageDone | ActiveZones$ Battlefield | ValidSource$ Card.Self | ReplaceWith$ DBReplace | PreventionEffect$ True | Secondary$ True SVar:DBReplace:DB$ ReplaceDamage | Amount$ PaidAmount SVar:DBPay:DB$ ChooseNumber | Defined$ EnchantedController | ChooseAnyNumber$ True | ListTitle$ Pay Any Mana | AILogic$ PowerLeakMaxMana.2 | SubAbility$ DBStore -SVar:DBStore:DB$ StoreSVar | SVar$ PaidAmount | Type$ CountSVar | Expression$ X | UnlessCost$ X | UnlessPayer$ EnchantedController | UnlessSwitched$ True | SubAbility$ DBDmg +SVar:DBStore:DB$ StoreSVar | SVar$ PaidAmount | Type$ CountSVar | Expression$ Y | UnlessCost$ Y | UnlessPayer$ EnchantedController | UnlessSwitched$ True | SubAbility$ DBDmg SVar:DBDmg:DB$ DealDamage | Defined$ EnchantedController | NumDmg$ 2 | SubAbility$ DBReset | StackDescription$ None SVar:DBReset:DB$ StoreSVar | SVar$ PaidAmount | Type$ Number | Expression$ 0 -SVar:X:Count$ChosenNumber +SVar:Y:Count$ChosenNumber SVar:PaidAmount:Number$0 Oracle:Enchant enchantment\nAt the beginning of the upkeep of enchanted enchantment's controller, that player may pay any amount of mana. Power Leak deals 2 damage to that player. Prevent X of that damage, where X is the amount of mana that player paid this way. diff --git a/forge-gui/res/cardsfolder/p/protect_the_negotiators.txt b/forge-gui/res/cardsfolder/p/protect_the_negotiators.txt index 55f911f0326..da9d718e4b6 100644 --- a/forge-gui/res/cardsfolder/p/protect_the_negotiators.txt +++ b/forge-gui/res/cardsfolder/p/protect_the_negotiators.txt @@ -3,8 +3,8 @@ ManaCost:1 U Types:Instant K:Kicker:W A:SP$ Token | Condition$ Kicked | TokenScript$ w_1_1_soldier | SubAbility$ DBCounter | SpellDescription$ If this spell was kicked, create a 1/1 white Soldier creature token. Counter target spell unless its controller pays {1} for each creature you control. -SVar:DBCounter:DB$ Counter | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ X | SpellDescription$ Counter target spell unless its controller pays {1} for each creature you control. -SVar:X:Count$Valid Creature.YouCtrl +SVar:DBCounter:DB$ Counter | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ Y | SpellDescription$ Counter target spell unless its controller pays {1} for each creature you control. +SVar:Y:Count$Valid Creature.YouCtrl DeckHas:Ability$Token DeckHints:Color$White SVar:BuffedBy:Creature diff --git a/forge-gui/res/cardsfolder/r/rakshasas_disdain.txt b/forge-gui/res/cardsfolder/r/rakshasas_disdain.txt index faaebed8419..5ef8ef9599a 100644 --- a/forge-gui/res/cardsfolder/r/rakshasas_disdain.txt +++ b/forge-gui/res/cardsfolder/r/rakshasas_disdain.txt @@ -1,7 +1,7 @@ Name:Rakshasa's Disdain ManaCost:2 U Types:Instant -A:SP$ Counter | Cost$ 2 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ X | SpellDescription$ Counter target spell unless its controller pays {1} for each card in your graveyard. -SVar:X:Count$InYourYard +A:SP$ Counter | Cost$ 2 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ Y | SpellDescription$ Counter target spell unless its controller pays {1} for each card in your graveyard. +SVar:Y:Count$InYourYard DeckHints:Ability$Graveyard Oracle:Counter target spell unless its controller pays {1} for each card in your graveyard. diff --git a/forge-gui/res/cardsfolder/r/rogue_skycaptain.txt b/forge-gui/res/cardsfolder/r/rogue_skycaptain.txt index 05f6b199cc7..fd83272dbfe 100644 --- a/forge-gui/res/cardsfolder/r/rogue_skycaptain.txt +++ b/forge-gui/res/cardsfolder/r/rogue_skycaptain.txt @@ -5,11 +5,11 @@ PT:3/4 K:Flying T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigPutCounter | TriggerDescription$ At the beginning of your upkeep, put a wage counter on CARDNAME. You may pay {2} for each wage counter on it. If you don't, remove all wage counters from CARDNAME and an opponent gains control of it. SVar:TrigPutCounter:DB$ PutCounter | Defined$ Self | CounterType$ WAGE | CounterNum$ 1 | SubAbility$ DBRemoveCounter -SVar:DBRemoveCounter:DB$ RemoveCounter | CounterNum$ All | CounterType$ WAGE | Defined$ Self | UnlessCost$ X | UnlessPayer$ You | UnlessResolveSubs$ WhenNotPaid | SubAbility$ DBChooseOpp +SVar:DBRemoveCounter:DB$ RemoveCounter | CounterNum$ All | CounterType$ WAGE | Defined$ Self | UnlessCost$ Y | UnlessPayer$ You | UnlessResolveSubs$ WhenNotPaid | SubAbility$ DBChooseOpp SVar:DBChooseOpp:DB$ ChoosePlayer | Defined$ You | Choices$ Player.Opponent | ChoiceTitle$ Choose an opponent to give control to: | AILogic$ Curse | SubAbility$ DBDonate SVar:DBDonate:DB$ GainControl | Defined$ Self | NewController$ Player.Chosen | SubAbility$ DBReset SVar:DBReset:DB$ Cleanup | ClearChosenPlayer$ True -SVar:X:Count$CardCounters.WAGE/Twice +SVar:Y:Count$CardCounters.WAGE/Twice AI:RemoveDeck:All AI:RemoveDeck:Random Oracle:Flying\nAt the beginning of your upkeep, put a wage counter on Rogue Skycaptain. You may pay {2} for each wage counter on it. If you don't, remove all wage counters from Rogue Skycaptain and an opponent gains control of it. diff --git a/forge-gui/res/cardsfolder/r/rune_snag.txt b/forge-gui/res/cardsfolder/r/rune_snag.txt index 198e4db45e9..3c6fd828330 100644 --- a/forge-gui/res/cardsfolder/r/rune_snag.txt +++ b/forge-gui/res/cardsfolder/r/rune_snag.txt @@ -1,8 +1,8 @@ Name:Rune Snag ManaCost:1 U Types:Instant -A:SP$ Counter | Cost$ 1 U | TargetType$ Spell | ValidTgts$ Card | TgtPrompt$ Select target spell | UnlessCost$ X | UnlessPayer$ TargetedController | SpellDescription$ Counter target spell unless its controller pays {2} plus an additional {2} for each card named Rune Snag in each graveyard. +A:SP$ Counter | Cost$ 1 U | TargetType$ Spell | ValidTgts$ Card | TgtPrompt$ Select target spell | UnlessCost$ Z | UnlessPayer$ TargetedController | SpellDescription$ Counter target spell unless its controller pays {2} plus an additional {2} for each card named Rune Snag in each graveyard. SVar:Y:Count$NamedInAllYards.Rune Snag/Times.2 -SVar:X:Number$2/Plus.Y +SVar:Z:Number$2/Plus.Y DeckHints:Name$Rune Snag Oracle:Counter target spell unless its controller pays {2} plus an additional {2} for each card named Rune Snag in each graveyard. diff --git a/forge-gui/res/cardsfolder/s/shared_trauma.txt b/forge-gui/res/cardsfolder/s/shared_trauma.txt index db061fa25ab..893f378973a 100644 --- a/forge-gui/res/cardsfolder/s/shared_trauma.txt +++ b/forge-gui/res/cardsfolder/s/shared_trauma.txt @@ -3,10 +3,10 @@ ManaCost:B Types:Sorcery A:SP$ RepeatEach | Cost$ B | RepeatPlayers$ Player | StartingWithActivator$ True | RepeatSubAbility$ DBPay | SubAbility$ DBMill | StackDescription$ SpellDescription | SpellDescription$ Join forces — Starting with you, each player may pay any amount of mana. Each player mills X cards, where X is the total amount of mana paid this way. SVar:DBPay:DB$ ChooseNumber | Defined$ Player.IsRemembered | ChooseAnyNumber$ True | ListTitle$ Pay Any Mana | SubAbility$ DBStore -SVar:DBStore:DB$ StoreSVar | SVar$ JoinForcesAmount | Type$ CountSVar | Expression$ JoinForcesAmount/Plus.X | UnlessCost$ X | UnlessPayer$ Player.IsRemembered | UnlessSwitched$ True | UnlessAI$ OnlyOwn +SVar:DBStore:DB$ StoreSVar | SVar$ JoinForcesAmount | Type$ CountSVar | Expression$ JoinForcesAmount/Plus.Y | UnlessCost$ Y | UnlessPayer$ Player.IsRemembered | UnlessSwitched$ True | UnlessAI$ OnlyOwn SVar:DBMill:DB$ Mill | Defined$ Player | NumCards$ JoinForcesAmount | SubAbility$ DBReset | StackDescription$ None SVar:DBReset:DB$ StoreSVar | SVar$ JoinForcesAmount | Type$ Number | Expression$ 0 -SVar:X:Count$ChosenNumber +SVar:Y:Count$ChosenNumber SVar:JoinForcesAmount:Number$0 AI:RemoveDeck:All Oracle:Join forces — Starting with you, each player may pay any amount of mana. Each player mills X cards, where X is the total amount of mana paid this way. diff --git a/forge-gui/res/cardsfolder/s/spel_stutter.txt b/forge-gui/res/cardsfolder/s/spel_stutter.txt index 76bb9296deb..90fb4865170 100644 --- a/forge-gui/res/cardsfolder/s/spel_stutter.txt +++ b/forge-gui/res/cardsfolder/s/spel_stutter.txt @@ -1,7 +1,7 @@ Name:Spell Stutter ManaCost:1 U Types:Instant -A:SP$ Counter | TargetType$ Spell | ValidTgts$ Card | UnlessCost$ X | SpellDescription$ Counter target spell unless its controller pays {2} plus an additional {1} for each Faerie you control. -SVar:X:Count$Valid Faerie.YouCtrl/Plus.2 +A:SP$ Counter | TargetType$ Spell | ValidTgts$ Card | UnlessCost$ Y | SpellDescription$ Counter target spell unless its controller pays {2} plus an additional {1} for each Faerie you control. +SVar:Y:Count$Valid Faerie.YouCtrl/Plus.2 DeckHints:Type$Faerie Oracle:Counter target spell unless its controller pays {2} plus an additional {1} for each Faerie you control. diff --git a/forge-gui/res/cardsfolder/s/spell_syphon.txt b/forge-gui/res/cardsfolder/s/spell_syphon.txt index 6829b87e90a..77c5eac3333 100644 --- a/forge-gui/res/cardsfolder/s/spell_syphon.txt +++ b/forge-gui/res/cardsfolder/s/spell_syphon.txt @@ -1,7 +1,7 @@ Name:Spell Syphon ManaCost:1 U Types:Instant -A:SP$ Counter | Cost$ 1 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ X | SpellDescription$ Counter target spell unless its controller pays {1} for each blue permanent you control. -SVar:X:Count$Valid Permanent.YouCtrl+Blue +A:SP$ Counter | Cost$ 1 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ Y | SpellDescription$ Counter target spell unless its controller pays {1} for each blue permanent you control. +SVar:Y:Count$Valid Permanent.YouCtrl+Blue DeckNeeds:Color$Blue Oracle:Counter target spell unless its controller pays {1} for each blue permanent you control. diff --git a/forge-gui/res/cardsfolder/t/tariff.txt b/forge-gui/res/cardsfolder/t/tariff.txt index c12d2ab319a..84fc1400c01 100644 --- a/forge-gui/res/cardsfolder/t/tariff.txt +++ b/forge-gui/res/cardsfolder/t/tariff.txt @@ -3,6 +3,6 @@ ManaCost:1 W Types:Sorcery A:SP$ RepeatEach | Cost$ 1 W | RepeatPlayers$ Player | RepeatSubAbility$ DBChooseCard | SpellDescription$ Each player sacrifices the creature they control with the highest mana value unless they pay that creature's mana cost. If two or more creatures a player controls are tied for highest, that player chooses one. SVar:DBChooseCard:DB$ ChooseCard | Defined$ Player.IsRemembered | Choices$ Creature.greatestCMC_CreatureControlledByRemembered | Mandatory$ True | SubAbility$ DBSac -SVar:DBSac:DB$ Sacrifice | Defined$ Player.IsRemembered | SacValid$ Card.ChosenCard | SacMessage$ the creature with the highest mana value | UnlessCost$ ChosenManaCost | UnlessPayer$ Player.IsRemembered +SVar:DBSac:DB$ Sacrifice | Defined$ Player.IsRemembered | SacValid$ Card.ChosenCard | SacMessage$ the creature with the highest mana value | UnlessCost$ DefinedCost_ChosenCard | UnlessPayer$ Player.IsRemembered AI:RemoveDeck:All Oracle:Each player sacrifices the creature they control with the highest mana value unless they pay that creature's mana cost. If two or more creatures a player controls are tied for highest, that player chooses one. diff --git a/forge-gui/res/cardsfolder/t/tezzeret_betrayer_of_flesh.txt b/forge-gui/res/cardsfolder/t/tezzeret_betrayer_of_flesh.txt index 2b55bfb7f75..1183b0ccc16 100644 --- a/forge-gui/res/cardsfolder/t/tezzeret_betrayer_of_flesh.txt +++ b/forge-gui/res/cardsfolder/t/tezzeret_betrayer_of_flesh.txt @@ -2,12 +2,8 @@ Name:Tezzeret, Betrayer of Flesh ManaCost:2 U U Types:Legendary Planeswalker Tezzeret Loyalty:4 -T:Mode$ AbilityCast | ValidCard$ Artifact | Static$ True | CheckSVar$ ArtAct | SVarCompare$ NE1 | Execute$ TrigStore -SVar:TrigStore:DB$ Pump | Defined$ TriggeredActivator | NoteNumber$ 1 -SVar:ArtAct:Count$NotedNumber -T:Mode$ TurnBegin | Execute$ TrigReset | Static$ True -SVar:TrigReset:DB$ Pump | Defined$ Player | NoteNumber$ 0 -S:Mode$ ReduceCost | ValidCard$ Artifact.inZoneBattlefield | ValidSpell$ Activated.YouCtrl | Amount$ 2 | CheckSVar$ ArtAct | SVarCompare$ NE1 | OnlyFirstActivation$ True | AffectedZone$ Battlefield | Description$ The first activated ability of an artifact you activate each turn costs {2} less to activate. +S:Mode$ ReduceCost | ValidCard$ Artifact.inZoneBattlefield | ValidSpell$ Activated.YouCtrl | Type$ Ability | Amount$ 2 | CheckSVar$ ArtAct | SVarCompare$ EQ0 | OnlyFirstActivation$ True | AffectedZone$ Battlefield | Description$ The first activated ability of an artifact you activate each turn costs {2} less to activate. +SVar:ArtAct:Count$ThisTurnActivated_Activated.Artifact+YouCtrl+inZoneBattlefield A:AB$ Draw | Cost$ AddCounter<1/LOYALTY> | Planeswalker$ True | NumCards$ 2 | SpellDescription$ Draw two cards. Then discard two cards unless you discard an artifact card. | SubAbility$ DBDiscard SVar:DBDiscard:DB$ Discard | Defined$ You | NumCards$ 2 | Mode$ TgtChoose | UnlessType$ Artifact A:AB$ Animate | Cost$ SubCounter<2/LOYALTY> | Planeswalker$ True | ValidTgts$ Artifact | Types$ Creature,Artifact | TgtPrompt$ Select target artifact | SubAbility$ NonVehicle | Duration$ Permanent | SpellDescription$ Target artifact becomes an artifact creature. If it isn't a vehicle, it has base power and toughness 4/4. diff --git a/forge-gui/res/cardsfolder/t/troyan_gutsy_explorer.txt b/forge-gui/res/cardsfolder/t/troyan_gutsy_explorer.txt index af4eeec2647..eb009c1cc91 100644 --- a/forge-gui/res/cardsfolder/t/troyan_gutsy_explorer.txt +++ b/forge-gui/res/cardsfolder/t/troyan_gutsy_explorer.txt @@ -2,7 +2,7 @@ Name:Troyan, Gutsy Explorer ManaCost:1 G U Types:Legendary Creature Vedalken Scout PT:1/3 -A:AB$ Mana | Cost$ T | Produced$ G U | RestrictValid$ CostContainsX,Spell.cmcGE5 | SpellDescription$ Add {G}{U}. Spend this mana only to cast spells with mana value 5 or greater or spells with {X} in their mana costs. +A:AB$ Mana | Cost$ T | Produced$ G U | RestrictValid$ Spell.hasXCost,Spell.cmcGE5 | SpellDescription$ Add {G}{U}. Spend this mana only to cast spells with mana value 5 or greater or spells with {X} in their mana costs. A:AB$ Draw | Cost$ U T | SubAbility$ DBDiscard | SpellDescription$ Draw a card, then discard a card. SVar:DBDiscard:DB$ Discard | Defined$ You | Mode$ TgtChoose DeckHas:Ability$Discard