diff --git a/forge-game/src/main/java/forge/game/ability/effects/LifeGainEffect.java b/forge-game/src/main/java/forge/game/ability/effects/LifeGainEffect.java index f3851bc8892..5bd9fc5b00f 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/LifeGainEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/LifeGainEffect.java @@ -7,6 +7,7 @@ import forge.game.ability.SpellAbilityEffect; import forge.game.player.Player; import forge.game.spellability.SpellAbility; import forge.util.Lang; +import org.apache.commons.lang3.StringUtils; public class LifeGainEffect extends SpellAbilityEffect { @@ -20,8 +21,11 @@ public class LifeGainEffect extends SpellAbilityEffect { sb.append(Lang.joinHomogenous(getDefinedPlayersOrTargeted(sa))); sb.append(getDefinedPlayersOrTargeted(sa).size() > 1 ? " gain " : " gains "); - if (sa.hasParam("XDesc")) { - sb.append("life equal to ").append(sa.getParam("XDesc")).append("."); + if (!StringUtils.isNumeric(amountStr) && sa.hasParam("SpellDescription") && + sa.getParam("SpellDescription").contains("life equal to")) { + String xDesc = sa.getParam("SpellDescription"); + xDesc = xDesc.substring(xDesc.indexOf("life equal to")); + sb.append(xDesc); } else if (!amountStr.equals("AFLifeLost") || sa.hasSVar(amountStr)) { final int amount = AbilityUtils.calculateAmount(sa.getHostCard(), amountStr, sa); diff --git a/forge-gui/res/cardsfolder/a/ajani_unyielding.txt b/forge-gui/res/cardsfolder/a/ajani_unyielding.txt index 37d78f505ab..ecee6ffdfcf 100644 --- a/forge-gui/res/cardsfolder/a/ajani_unyielding.txt +++ b/forge-gui/res/cardsfolder/a/ajani_unyielding.txt @@ -3,9 +3,10 @@ ManaCost:4 G W Types:Legendary Planeswalker Ajani Loyalty:4 A:AB$ Dig | Cost$ AddCounter<2/LOYALTY> | Planeswalker$ True | DigNum$ 3 | Reveal$ True | ChangeNum$ All | ChangeValid$ Permanent.nonLand | SpellDescription$ Reveal the top three cards of your library. Put all nonland permanent cards revealed this way into your hand and the rest on the bottom of your library in any order. -A:AB$ ChangeZone | Cost$ SubCounter<2/LOYALTY> | Planeswalker$ True | ValidTgts$ Creature | TgtPrompt$ Select target creature | Origin$ Battlefield | Destination$ Exile | SubAbility$ DBGainLife | SpellDescription$ Exile target creature. -SVar:DBGainLife:DB$ GainLife | Defined$ TargetedController | LifeAmount$ X | XDesc$ its power | SpellDescription$ Its controller gains life equal to its power. -SVar:X:TargetedLKI$CardPower +A:AB$ ChangeZone | Cost$ SubCounter<2/LOYALTY> | Planeswalker$ True | ValidTgts$ Creature | RememberLKI$ True | Origin$ Battlefield | Destination$ Exile | SubAbility$ DBGainLife | SpellDescription$ Exile target creature. +SVar:DBGainLife:DB$ GainLife | Defined$ RememberedController | LifeAmount$ X | SubAbility$ DBCleanup | SpellDescription$ Its controller gains life equal to its power. +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:X:RememberedLKI$CardPower A:AB$ PutCounterAll | Cost$ SubCounter<9/LOYALTY> | ValidCards$ Creature.YouCtrl | CounterType$ P1P1 | CounterNum$ 5 | Planeswalker$ True | Ultimate$ True | ValidCards2$ Planeswalker.YouCtrl+Other | CounterType2$ LOYALTY | AILogic$ OwnCreatsAndOtherPWs | SpellDescription$ Put five +1/+1 counters on each creature you control and five loyalty counters on each other planeswalker you control. DeckHas:Ability$Counters DeckHints:Type$Planeswalker diff --git a/forge-gui/res/cardsfolder/a/avenger_en_dal.txt b/forge-gui/res/cardsfolder/a/avenger_en_dal.txt index a65182a6b06..09d9d5e940b 100644 --- a/forge-gui/res/cardsfolder/a/avenger_en_dal.txt +++ b/forge-gui/res/cardsfolder/a/avenger_en_dal.txt @@ -2,10 +2,10 @@ Name:Avenger en-Dal ManaCost:1 W Types:Creature Human Spellshaper PT:1/1 -A:AB$ ChangeZone | Cost$ 2 W T Discard<1/Card> | ValidTgts$ Creature.attacking | TgtPrompt$ Select target attacking creature | RememberLKI$ True | Origin$ Battlefield | Destination$ Exile | SpellDescription$ Exile target attacking creature. Its controller gains life equal to its toughness. | SubAbility$ DBGainLife -SVar:DBGainLife:DB$ GainLife | Defined$ RememberedController | LifeAmount$ X | SubAbility$ DBCleanup +A:AB$ ChangeZone | Cost$ 2 W T Discard<1/Card> | ValidTgts$ Creature.attacking | TgtPrompt$ Select target attacking creature | RememberLKI$ True | Origin$ Battlefield | Destination$ Exile | SubAbility$ DBGainLife | SpellDescription$ Exile target attacking creature. +SVar:DBGainLife:DB$ GainLife | Defined$ RememberedController | LifeAmount$ X | SubAbility$ DBCleanup | SpellDescription$ Its controller gains life equal to its toughness. SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True -SVar:X:TargetedLKI$CardToughness +SVar:X:RememberedLKI$CardToughness SVar:AIPreference:DiscardCost$Card AI:RemoveDeck:Random DeckHas:Ability$Discard diff --git a/forge-gui/res/cardsfolder/c/condemn.txt b/forge-gui/res/cardsfolder/c/condemn.txt index dc27cdb8b56..153b2b66ad7 100644 --- a/forge-gui/res/cardsfolder/c/condemn.txt +++ b/forge-gui/res/cardsfolder/c/condemn.txt @@ -1,7 +1,8 @@ Name:Condemn ManaCost:W Types:Instant -A:SP$ ChangeZone | ValidTgts$ Creature.attacking | TgtPrompt$ Select target attacking creature | Origin$ Battlefield | Destination$ Library | LibraryPosition$ -1 | SubAbility$ DBGainLife | SpellDescription$ Put target attacking creature on the bottom of its owner's library. -SVar:DBGainLife:DB$ GainLife | Defined$ RememberedController | LifeAmount$ X | XDesc$ its toughness | SpellDescription$ Its controller gains life equal to its toughness. -SVar:X:TargetedLKI$CardToughness +A:SP$ ChangeZone | ValidTgts$ Creature.attacking | TgtPrompt$ Select target attacking creature | RememberLKI$ True | Origin$ Battlefield | Destination$ Library | LibraryPosition$ -1 | SubAbility$ DBGainLife | SpellDescription$ Put target attacking creature on the bottom of its owner's library. +SVar:DBGainLife:DB$ GainLife | Defined$ RememberedController | LifeAmount$ X | SubAbility$ DBCleanup | SpellDescription$ Its controller gains life equal to its toughness. +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:X:RememberedLKI$CardToughness Oracle:Put target attacking creature on the bottom of its owner's library. Its controller gains life equal to its toughness. diff --git a/forge-gui/res/cardsfolder/c/crumble.txt b/forge-gui/res/cardsfolder/c/crumble.txt index 833aa2e41aa..37c673b2209 100644 --- a/forge-gui/res/cardsfolder/c/crumble.txt +++ b/forge-gui/res/cardsfolder/c/crumble.txt @@ -1,8 +1,9 @@ Name:Crumble ManaCost:G Types:Instant -A:SP$ Destroy | ValidTgts$ Artifact | NoRegen$ True | SubAbility$ DBGainLife | SpellDescription$ Destroy target artifact. It can't be regenerated. -SVar:DBGainLife:DB$ GainLife | Defined$ TargetedController | LifeAmount$ X | XDesc$ its mana value | SpellDescription$ That artifact's controller gains life equal to its mana value. -SVar:X:Targeted$CardManaCost +A:SP$ Destroy | ValidTgts$ Artifact | NoRegen$ True | SubAbility$ DBGainLife | RememberLKI$ True | SpellDescription$ Destroy target artifact. It can't be regenerated. +SVar:DBGainLife:DB$ GainLife | Defined$ RememberedController | LifeAmount$ X | SubAbility$ DBCleanup | SpellDescription$ That artifact's controller gains life equal to its mana value. +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:X:RememberedLKI$CardManaCost AI:RemoveDeck:Random Oracle:Destroy target artifact. It can't be regenerated. That artifact's controller gains life equal to its mana value. diff --git a/forge-gui/res/cardsfolder/d/devour_flesh.txt b/forge-gui/res/cardsfolder/d/devour_flesh.txt index e771fb1836e..9af8cde6b73 100644 --- a/forge-gui/res/cardsfolder/d/devour_flesh.txt +++ b/forge-gui/res/cardsfolder/d/devour_flesh.txt @@ -1,8 +1,8 @@ Name:Devour Flesh ManaCost:1 B Types:Instant -A:SP$ Sacrifice | ValidTgts$ Player | SacValid$ Creature | SacMessage$ creature | RememberSacrificed$ True | SubAbility$ DBGainLife | StackDescription$ SpellDescription | SpellDescription$ Target player sacrifices a creature, then gains life equal to that creature's toughness. -SVar:DBGainLife:DB$ GainLife | Defined$ Targeted | LifeAmount$ X | SubAbility$ DBCleanup | StackDescription$ None +A:SP$ Sacrifice | ValidTgts$ Player | SacValid$ Creature | SacMessage$ creature | RememberSacrificed$ True | SubAbility$ DBGainLife | SpellDescription$ Target player sacrifices a creature, +SVar:DBGainLife:DB$ GainLife | Defined$ Targeted | LifeAmount$ X | SubAbility$ DBCleanup | SpellDescription$ then gains life equal to that creature's toughness. SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:X:RememberedLKI$CardToughness Oracle:Target player sacrifices a creature, then gains life equal to that creature's toughness. diff --git a/forge-gui/res/cardsfolder/d/dismantle.txt b/forge-gui/res/cardsfolder/d/dismantle.txt index 951a91b5a3b..7f0ab22e326 100644 --- a/forge-gui/res/cardsfolder/d/dismantle.txt +++ b/forge-gui/res/cardsfolder/d/dismantle.txt @@ -1,7 +1,7 @@ Name:Dismantle ManaCost:2 R Types:Sorcery -A:SP$ Destroy | Cost$ 2 R | ValidTgts$ Artifact | TgtPrompt$ Select target artifact | SubAbility$ DBPutCounter | SpellDescription$ Destroy target artifact. If that artifact had counters on it, put that many +1/+1 counters or charge counters on an artifact you control. -SVar:DBPutCounter:DB$ PutCounter | Choices$ Artifact.YouCtrl | CounterType$ P1P1,CHARGE | CounterNum$ X | CounterTypePerDefined$ True | ConditionDefined$ Targeted | ConditionPresent$ Card.HasCounters | ConditionCompare$ GE1 | StackDescription$ put that many +1/+1 counters or charge counters on an artifact you control. -SVar:X:TargetedLKI$CardCounters.ALL +A:SP$ Destroy | ValidTgts$ Artifact | SubAbility$ DBPutCounter | RememberLKI$ True | SpellDescription$ Destroy target artifact. +SVar:DBPutCounter:DB$ PutCounter | Choices$ Artifact.YouCtrl | CounterType$ P1P1,CHARGE | CounterNum$ X | CounterTypePerDefined$ True | ConditionDefined$ RememberedLKI | ConditionPresent$ Card.HasCounters | SpellDescription$ If that artifact had counters on it, put that many +1/+1 counters or charge counters on an artifact you control. +SVar:X:RememberedLKI$CardCounters.ALL Oracle:Destroy target artifact. If that artifact had counters on it, put that many +1/+1 counters or charge counters on an artifact you control. diff --git a/forge-gui/res/cardsfolder/g/gloomwidows_feast.txt b/forge-gui/res/cardsfolder/g/gloomwidows_feast.txt index 1969517967f..514a88215c0 100644 --- a/forge-gui/res/cardsfolder/g/gloomwidows_feast.txt +++ b/forge-gui/res/cardsfolder/g/gloomwidows_feast.txt @@ -1,7 +1,9 @@ Name:Gloomwidow's Feast ManaCost:3 G Types:Instant -A:SP$ Destroy | Cost$ 3 G | ValidTgts$ Creature.withFlying | TgtPrompt$ Select target creature with flying | RememberLKI$ True | SubAbility$ DBToken | SpellDescription$ Destroy target creature with flying. If that creature was blue or black, create a 1/2 green Spider creature token with reach. -SVar:DBToken:DB$ Token | ConditionDefined$ RememberedLKI | ConditionPresent$ Card.Blue,Card.Black | ConditionCompare$ EQ1 | TokenAmount$ 1 | TokenScript$ g_1_2_spider_reach | TokenOwner$ You | ConditionDescription$ If that creature was blue or black, put a 1/2 green Spider creature token with reach onto the battlefield. | SubAbility$ DBCleanup +A:SP$ Destroy | ValidTgts$ Creature.withFlying | TgtPrompt$ Select target creature with flying | RememberLKI$ True | SubAbility$ DBToken | SpellDescription$ Destroy target creature with flying. +SVar:DBToken:DB$ Token | ConditionDefined$ RememberedLKI | ConditionPresent$ Card.Blue,Card.Black | TokenScript$ g_1_2_spider_reach | SubAbility$ DBCleanup | SpellDescription$ If that creature was blue or black, create a 1/2 green Spider creature token with reach. (It can block creatures with flying.) SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +AI:RemoveDeck:Random +DeckHas:Ability$Token & Type$Spider Oracle:Destroy target creature with flying. If that creature was blue or black, create a 1/2 green Spider creature token with reach. (It can block creatures with flying.) diff --git a/forge-gui/res/cardsfolder/i/illumination.txt b/forge-gui/res/cardsfolder/i/illumination.txt index fa0642ce083..78e499268d2 100644 --- a/forge-gui/res/cardsfolder/i/illumination.txt +++ b/forge-gui/res/cardsfolder/i/illumination.txt @@ -2,6 +2,6 @@ Name:Illumination ManaCost:W W Types:Instant A:SP$ Counter | TargetType$ Spell | TgtPrompt$ Select target artifact or enchantment spell | ValidTgts$ Artifact,Enchantment | SubAbility$ DBGainLife | SpellDescription$ Counter target artifact or enchantment spell. -SVar:DBGainLife:DB$ GainLife | Defined$ TargetedController | LifeAmount$ X | XDesc$ its mana value | SpellDescription$ Its controller gains life equal to its mana value. +SVar:DBGainLife:DB$ GainLife | Defined$ TargetedController | LifeAmount$ X | SpellDescription$ Its controller gains life equal to its mana value. SVar:X:Targeted$CardManaCost Oracle:Counter target artifact or enchantment spell. Its controller gains life equal to its mana value. diff --git a/forge-gui/res/cardsfolder/k/kaerveks_purge.txt b/forge-gui/res/cardsfolder/k/kaerveks_purge.txt index c607a01a58d..f3948e0ec03 100644 --- a/forge-gui/res/cardsfolder/k/kaerveks_purge.txt +++ b/forge-gui/res/cardsfolder/k/kaerveks_purge.txt @@ -1,8 +1,8 @@ Name:Kaervek's Purge ManaCost:X B R Types:Sorcery -A:SP$ Destroy | Cost$ X B R | ValidTgts$ Creature.cmcEQX | TgtPrompt$ Select target creature | RememberLKI$ True | SubAbility$ DBDamage | SpellDescription$ Destroy target creature with mana value X. If that creature dies this way, CARDNAME deals damage equal to the creature's power to the creature's controller. -SVar:DBDamage:DB$ DealDamage | Defined$ TargetedController | NumDmg$ Z | ConditionCheckSVar$ Y | ConditionSVarCompare$ GE1 | SubAbility$ DBCleanup +A:SP$ Destroy | Cost$ X B R | ValidTgts$ Creature.cmcEQX | TgtPrompt$ Select target creature with mana value X | RememberLKI$ True | SubAbility$ DBDamage | SpellDescription$ Destroy target creature with mana value X. If that creature dies this way, CARDNAME deals damage equal to the creature's power to the creature's controller. +SVar:DBDamage:DB$ DealDamage | Defined$ RememberedController | NumDmg$ Z | ConditionCheckSVar$ Y | ConditionSVarCompare$ GE1 | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:X:Count$xPaid SVar:Y:Remembered$Amount diff --git a/forge-gui/res/cardsfolder/r/rite_of_the_serpent.txt b/forge-gui/res/cardsfolder/r/rite_of_the_serpent.txt index 55f1790b4eb..ec35926cfd1 100644 --- a/forge-gui/res/cardsfolder/r/rite_of_the_serpent.txt +++ b/forge-gui/res/cardsfolder/r/rite_of_the_serpent.txt @@ -1,7 +1,8 @@ Name:Rite of the Serpent ManaCost:4 B B Types:Sorcery -A:SP$ Destroy | Cost$ 4 B B | ValidTgts$ Creature | TgtPrompt$ Select target creature | SubAbility$ DBToken | SpellDescription$ Destroy target creature. If that creature had a +1/+1 counter on it, create a 1/1 green Snake creature token. -SVar:DBToken:DB$ Token | TokenAmount$ 1 | TokenScript$ g_1_1_snake | TokenOwner$ You | ConditionCheckSVar$ X | ConditionSVarCompare$ GE1 -SVar:X:TargetedLKI$Valid Creature.counters_GE1_P1P1 +A:SP$ Destroy | ValidTgts$ Creature | SubAbility$ DBToken | RememberLKI$ True | SpellDescription$ Destroy target creature. +SVar:DBToken:DB$ Token | TokenScript$ g_1_1_snake | ConditionDefined$ RememberedLKI | ConditionPresent$ Creature.counters_GE1_P1P1 | SubAbility$ DBCleanup | SpellDescription$ If that creature had a +1/+1 counter on it, create a 1/1 green Snake creature token. +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +DeckHas:Ability$Token & Type$Snake Oracle:Destroy target creature. If that creature had a +1/+1 counter on it, create a 1/1 green Snake creature token. diff --git a/forge-gui/res/cardsfolder/s/solitude.txt b/forge-gui/res/cardsfolder/s/solitude.txt index f4988aed0be..3a44daf7058 100644 --- a/forge-gui/res/cardsfolder/s/solitude.txt +++ b/forge-gui/res/cardsfolder/s/solitude.txt @@ -7,7 +7,7 @@ K:Lifelink K:Evoke:ExileFromHand<1/Card.White+Other/white card> T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigExile | TriggerDescription$ When CARDNAME enters the battlefield, exile up to one other target creature. That creature's controller gains life equal to its power. SVar:TrigExile:DB$ ChangeZone | Origin$ Battlefield | Destination$ Exile | ValidTgts$ Creature.Other | RememberLKI$ True | TgtPrompt$ Select up to one other target creature | TargetMin$ 0 | TargetMax$ 1 | SubAbility$ DBGainLife -SVar:DBGainLife:DB$ GainLife | Defined$ TargetedController | LifeAmount$ X | XDesc$ its power | SpellDescription$ Its controller gains life equal to its power. -SVar:X:TargetedLKI$CardPower +SVar:DBGainLife:DB$ GainLife | Defined$ RememberedController | LifeAmount$ X +SVar:X:RememberedLKI$CardPower DeckHas:Ability$LifeGain Oracle:Flash\nLifelink\nWhen Solitude enters the battlefield, exile up to one other target creature. That creature's controller gains life equal to its power.\nEvoke—Exile a white card from your hand. diff --git a/forge-gui/res/cardsfolder/s/swords_to_plowshares.txt b/forge-gui/res/cardsfolder/s/swords_to_plowshares.txt index f528651c64e..e75a18cde30 100644 --- a/forge-gui/res/cardsfolder/s/swords_to_plowshares.txt +++ b/forge-gui/res/cardsfolder/s/swords_to_plowshares.txt @@ -1,7 +1,7 @@ Name:Swords to Plowshares ManaCost:W Types:Instant -A:SP$ ChangeZone | ValidTgts$ Creature | Origin$ Battlefield | Destination$ Exile | SubAbility$ DBGainLife | SpellDescription$ Exile target creature. -SVar:DBGainLife:DB$ GainLife | Defined$ TargetedController | LifeAmount$ X | XDesc$ its power | SpellDescription$ Its controller gains life equal to its power. -SVar:X:TargetedLKI$CardPower +A:SP$ ChangeZone | ValidTgts$ Creature | Origin$ Battlefield | Destination$ Exile | RememberLKI$ True | SubAbility$ DBGainLife | SpellDescription$ Exile target creature. +SVar:DBGainLife:DB$ GainLife | Defined$ RememberedController | LifeAmount$ X | SpellDescription$ Its controller gains life equal to its power. +SVar:X:RememberedLKI$CardPower Oracle:Exile target creature. Its controller gains life equal to its power.