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 94d1d10f119..c1a3a21d874 100644 --- a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java +++ b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java @@ -1328,6 +1328,12 @@ public class AbilityUtils { game.getTriggerHandler().resetActiveTriggers(); } + if (sa.hasParam("Precalc")) { + for (String s : sa.getParam("Precalc").split(",")) { + sa.setSVar(s, String.valueOf(calculateAmount(sa.getHostCard(), s, sa))); + } + } + resolvePreAbilities(sa, game); // count times ability resolves this turn diff --git a/forge-gui/res/cardsfolder/a/arabella_abandoned_doll.txt b/forge-gui/res/cardsfolder/a/arabella_abandoned_doll.txt index 1ba4512a2f4..926e66e7fbe 100644 --- a/forge-gui/res/cardsfolder/a/arabella_abandoned_doll.txt +++ b/forge-gui/res/cardsfolder/a/arabella_abandoned_doll.txt @@ -3,7 +3,7 @@ ManaCost:R W Types:Legendary Artifact Creature Toy PT:1/3 T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigDamageAll | TriggerDescription$ Whenever CARDNAME attacks, it deals X damage to each opponent and you gain X life, where X is the number of creatures you control with power 2 or less. -SVar:TrigDamageAll:DB$ DamageAll | ValidPlayers$ Player.Opponent | NumDmg$ X | SubAbility$ DBGainLife +SVar:TrigDamageAll:DB$ DamageAll | ValidPlayers$ Player.Opponent | NumDmg$ X | Precalc$ X | SubAbility$ DBGainLife SVar:DBGainLife:DB$ GainLife | Defined$ You | LifeAmount$ X SVar:X:Count$Valid Creature.YouCtrl+powerLE2 Oracle:Whenever Arabella, Abandoned Doll attacks, it deals X damage to each opponent and you gain X life, where X is the number of creatures you control with power 2 or less. diff --git a/forge-gui/res/cardsfolder/c/camaraderie.txt b/forge-gui/res/cardsfolder/c/camaraderie.txt index d4ac5fc8359..0e5de967c33 100644 --- a/forge-gui/res/cardsfolder/c/camaraderie.txt +++ b/forge-gui/res/cardsfolder/c/camaraderie.txt @@ -1,7 +1,7 @@ Name:Camaraderie ManaCost:4 G W Types:Sorcery -A:SP$ GainLife | Defined$ You | LifeAmount$ X | SubAbility$ DBDraw | SpellDescription$ You gain X life and draw X cards, where X is the number of creatures you control. +A:SP$ GainLife | Defined$ You | LifeAmount$ X | Precalc$ X | SubAbility$ DBDraw | SpellDescription$ You gain X life and draw X cards, where X is the number of creatures you control. SVar:DBDraw:DB$ Draw | NumCards$ X | SubAbility$ DBPumpAll SVar:DBPumpAll:DB$ PumpAll | ValidCards$ Creature.YouCtrl | NumAtt$ +1 | NumDef$ +1 | SpellDescription$ Creatures you control get +1/+1 until end of turn. SVar:X:Count$Valid Creature.YouCtrl diff --git a/forge-gui/res/cardsfolder/c/champion_of_dusk.txt b/forge-gui/res/cardsfolder/c/champion_of_dusk.txt index a04f577c699..3a9a121180a 100644 --- a/forge-gui/res/cardsfolder/c/champion_of_dusk.txt +++ b/forge-gui/res/cardsfolder/c/champion_of_dusk.txt @@ -3,7 +3,7 @@ ManaCost:3 B B Types:Creature Vampire Knight PT:4/4 T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDraw | TriggerDescription$ When CARDNAME enters, you draw X cards and you lose X life, where X is the number of Vampires you control. -SVar:TrigDraw:DB$ Draw | Defined$ You | NumCards$ X | SubAbility$ DBLoseLife +SVar:TrigDraw:DB$ Draw | Defined$ You | NumCards$ X | Precalc$ X | SubAbility$ DBLoseLife SVar:DBLoseLife:DB$ LoseLife | LifeAmount$ X SVar:X:Count$Valid Vampire.YouCtrl DeckHints:Type$Vampire diff --git a/forge-gui/res/cardsfolder/c/corpse_augur.txt b/forge-gui/res/cardsfolder/c/corpse_augur.txt index e4c37949e92..8b6e3e4f9a9 100644 --- a/forge-gui/res/cardsfolder/c/corpse_augur.txt +++ b/forge-gui/res/cardsfolder/c/corpse_augur.txt @@ -3,7 +3,7 @@ ManaCost:3 B Types:Creature Zombie Wizard PT:4/2 T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigDraw | TriggerDescription$ When CARDNAME dies, you draw X cards and you lose X life, where X is the number of creature cards in target player's graveyard. -SVar:TrigDraw:DB$ Draw | Defined$ TriggeredCardController | ValidTgts$ Player | TgtPrompt$ Choose target player | NumCards$ X | SubAbility$ DBLoseLife +SVar:TrigDraw:DB$ Draw | Defined$ TriggeredCardController | ValidTgts$ Player | TgtPrompt$ Choose target player | NumCards$ X | Precalc$ X | SubAbility$ DBLoseLife SVar:DBLoseLife:DB$ LoseLife | Defined$ TriggeredCardController | LifeAmount$ X SVar:X:TargetedPlayer$ValidGraveyard Creature.YouOwn AI:RemoveDeck:All diff --git a/forge-gui/res/cardsfolder/s/sanguimancy.txt b/forge-gui/res/cardsfolder/s/sanguimancy.txt index d6af6403aa5..2552997e6c2 100644 --- a/forge-gui/res/cardsfolder/s/sanguimancy.txt +++ b/forge-gui/res/cardsfolder/s/sanguimancy.txt @@ -1,7 +1,7 @@ Name:Sanguimancy ManaCost:4 B Types:Sorcery -A:SP$ Draw | NumCards$ X | SubAbility$ DBLoseLife | SpellDescription$ You draw X cards and you lose X life, where X is your devotion to black. +A:SP$ Draw | NumCards$ X | Precalc$ X | SubAbility$ DBLoseLife | SpellDescription$ You draw X cards and you lose X life, where X is your devotion to black. SVar:DBLoseLife:DB$ LoseLife | LifeAmount$ X SVar:X:Count$Devotion.Black AI:RemoveDeck:All diff --git a/forge-gui/res/cardsfolder/s/stinging_study.txt b/forge-gui/res/cardsfolder/s/stinging_study.txt index f2d19bbfe3a..679451a2d3c 100644 --- a/forge-gui/res/cardsfolder/s/stinging_study.txt +++ b/forge-gui/res/cardsfolder/s/stinging_study.txt @@ -2,7 +2,7 @@ Name:Stinging Study ManaCost:4 B Types:Instant A:SP$ ChooseCard | Choices$ Card.IsCommander+YouOwn | ChoiceZone$ Command,Battlefield | Mandatory$ True | ChoiceTitle$ Choose a commander you own | SubAbility$ DBDraw | SpellDescription$ You draw X cards and you lose X life, where X is the mana value of a commander you own on the battlefield or in the command zone. -SVar:DBDraw:DB$ Draw | NumCards$ X | SubAbility$ DBLoseLife +SVar:DBDraw:DB$ Draw | NumCards$ X | Precalc$ X | SubAbility$ DBLoseLife SVar:DBLoseLife:DB$ LoseLife | LifeAmount$ X SVar:X:ChosenCard$CardManaCost AI:RemoveDeck:NonCommander diff --git a/forge-gui/res/cardsfolder/z/zedruu_the_greathearted.txt b/forge-gui/res/cardsfolder/z/zedruu_the_greathearted.txt index 03ced227bf5..446b0ab9427 100644 --- a/forge-gui/res/cardsfolder/z/zedruu_the_greathearted.txt +++ b/forge-gui/res/cardsfolder/z/zedruu_the_greathearted.txt @@ -5,7 +5,7 @@ PT:2/4 A:AB$ Pump | Cost$ U R W | ValidTgts$ Opponent | TgtPrompt$ Select target opponent | SubAbility$ DBGainControl | AILogic$ DonateTargetPerm | SpellDescription$ Target opponent gains control of target permanent you control. | StackDescription$ None SVar:DBGainControl:DB$ GainControl | ValidTgts$ Permanent.YouCtrl | TgtPrompt$ Select target permanent that you control | NewController$ ParentTarget T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ GainLife | TriggerDescription$ At the beginning of your upkeep, you gain X life and draw X cards, where X is the number of permanents you own that your opponents control. -SVar:GainLife:DB$ GainLife | LifeAmount$ X | SubAbility$ DBDraw +SVar:GainLife:DB$ GainLife | LifeAmount$ X | Precalc$ X | SubAbility$ DBDraw SVar:DBDraw:DB$ Draw | NumCards$ X SVar:X:Count$Valid Permanent.YouOwn+OwnerDoesntControl AI:RemoveDeck:All