From 65bf65086827bf878bd9aa7eca21d4ea90de0588 Mon Sep 17 00:00:00 2001 From: Vittorio Alfieri Date: Fri, 1 Jan 2021 03:47:02 +0100 Subject: [PATCH] Improved and added new "starting life" related keywords, fixed all primitives related to "starting life" keywords. --- .../bin/Res/sets/primitives/borderline.txt | 19 +++++++++---------- projects/mtg/bin/Res/sets/primitives/mtg.txt | 8 ++++---- .../bin/Res/sets/primitives/planeswalkers.txt | 2 +- projects/mtg/include/AllAbilities.h | 16 ++++++++++++++-- 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/borderline.txt b/projects/mtg/bin/Res/sets/primitives/borderline.txt index b6bb83d46..b3c7653e5 100644 --- a/projects/mtg/bin/Res/sets/primitives/borderline.txt +++ b/projects/mtg/bin/Res/sets/primitives/borderline.txt @@ -1264,7 +1264,7 @@ name=Angel of Destiny abilities=flying,double strike auto=@combatdamaged(player) from(creature|myBattlefield):life:thatmuch controller auto=@combatdamaged(player) from(creature|myBattlefield):life:thatmuch opponent -auto=@each my endofturn restriction{compare(lifetotal)~morethan~34,type(Angel of Destiny[attacking]|myBattlefield)~morethan~0}:winGame controller +auto=@each my endofturn restriction{compare(lifetotalminusstartinglifeminusend)~morethan~14,type(Angel of Destiny[attacking]|myBattlefield)~morethan~0}:winGame controller text=Flying, double strike -- Whenever a creature you control deals combat damage to a player, you and that player each gain that much life. -- At the beginning of your end step, if you have at least 15 life more than your starting life total, each player Angel of Destiny attacked this turn loses the game. mana={3}{W}{W} type=Creature @@ -15342,8 +15342,8 @@ type=Instant [/card] [card] name=Exquisite Archangel -abilities=flying -auto=@damageof(player):if compare(lifetotal)~lessthan~thatmuchplus1plusend then moveTo(exile) && lifeset:20 +abilities=flying,cantlifelose +auto=this(variable{lifetotal}<1) all(this) moveTo(exile) && lifeset:startinglife controller text=Flying -- If you would lose the game, instead exile Exquisite Archangel and your life total becomes equal to your starting life total. mana={5}{W}{W} type=Creature @@ -21161,7 +21161,7 @@ auto=draw:1 controller auto=draw:1 opponent auto=life:5 controller auto=life:5 opponent -auto=@each my upkeep restriction{type(*[white]|myBattlefield)~morethan~0,type(*[black]|myBattlefield)~morethan~0,type(*[green]|myBattlefield)~morethan~0,type(*[blue]|myBattlefield)~morethan~0,type(*[red]|myBattlefield)~morethan~0,type(*[planeswalker]|mybattlefield,myGraveyard)~morethan~0,type(*[land]|mybattlefield,myGraveyard)~morethan~0,type(*[artifact]|mybattlefield,myGraveyard)~morethan~0,type(*[enchantment]|mybattlefield,myGraveyard)~morethan~0,type(*[creature]|mybattlefield,myGraveyard)~morethan~0,type(*[instant;sorcery]|mybattlefield,myGraveyard)~morethan~0,compare(lifetotal)~morethan~19}:winGame controller +auto=@each my upkeep restriction{type(*[white]|myBattlefield)~morethan~0,type(*[black]|myBattlefield)~morethan~0,type(*[green]|myBattlefield)~morethan~0,type(*[blue]|myBattlefield)~morethan~0,type(*[red]|myBattlefield)~morethan~0,type(*[planeswalker]|mybattlefield,myGraveyard)~morethan~0,type(*[land]|mybattlefield,myGraveyard)~morethan~0,type(*[artifact]|mybattlefield,myGraveyard)~morethan~0,type(*[enchantment]|mybattlefield,myGraveyard)~morethan~0,type(*[creature]|mybattlefield,myGraveyard)~morethan~0,type(*[instant;sorcery]|mybattlefield,myGraveyard)~morethan~0,compare(abundantlife)~morethan~0}:winGame controller text=When Happily Ever After enters the battlefield, each player gains 5 life and draws a card. -- At the beginning of your upkeep, if there are five colors among permanents you control, there are six or more card types among permanents you control and/or cards in your graveyard, and your life total is greater than or equal to your starting life total, you win the game. mana={2}{W} type=Enchantment @@ -45440,7 +45440,7 @@ toughness=4 [card] name=Speaker of the Heavens abilities=vigilance,lifelink -auto={T}:token(Angel Spe) restriction{compare(lifetotal)~morethan~26} asSorcery +auto={T}:token(Angel Spe) restriction{compare(lifetotalminusstartinglifeminusend)~morethan~6} asSorcery text=Vigilance, lifelink -- {T}: Create a 4/4 white Angel creature token with flying. Activate this ability only if you have at least 7 life more than your starting life total and only any time you could cast a sorcery. mana={W} type=Creature @@ -50875,11 +50875,10 @@ toughness=1 [/card] [card] name=Torgaar, Famine Incarnate -target=player -auto=lifeset:10 -other={2}{B}{B}{S(creature|myBattlefield)} name(Sacrifice 1) -other={1}{B}{B}{S(creature|myBattlefield)}{S(creature|myBattlefield)} name(Sacrifice 2) -other={B}{B}{S(creature|myBattlefield)}{S(creature|myBattlefield)}{S(creature|myBattlefield)} name(Sacrifice 3) +auto=may name(Set life of player) name(Set life of player) lifeset:halfdownstartinglife target(player) +autohand={4}{B}{B}{S(creature|myBattlefield)} restriction{type(creature|mybattlefield)~morethan~0}:name(Sacrifice 1) activate name(Sacrifice 1) castcard(restricted) +autohand={2}{B}{B}{S(creature|myBattlefield)}{S(creature|myBattlefield)} restriction{type(creature|mybattlefield)~morethan~1}:name(Sacrifice 2) activate name(Sacrifice 2) castcard(restricted) +autohand={B}{B}{S(creature|myBattlefield)}{S(creature|myBattlefield)}{S(creature|myBattlefield)} restriction{type(creature|mybattlefield)~morethan~2}:name(Sacrifice 3) activate name(Sacrifice 3) castcard(restricted) text=As an additional cost to cast this spell, you may sacrifice any number of creatures. This spell costs {2} less to cast for each creature sacrificed this way. -- When Torgaar, Famine Incarnate enters the battlefield, up to one target player's life total becomes half their starting life total, rounded down. mana={6}{B}{B} type=Legendary Creature diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index f23c99b43..20b450192 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -4397,8 +4397,8 @@ toughness=1 [card] name=Anya, Merciless Angel abilities=flying -auto=this(opponentlife < 10) indestructible -auto=this(opponentlife < 10) 3/3 +auto=this(variable{ohalfinitlife}) indestructible +auto=this(variable{ohalfinitlife}) 3/3 text=Flying -- Anya, Merciless Angel gets +3/+3 for each opponent whose life total is less than half his or her starting life total. -- As long as an opponent's life total is less than half his or her starting life total, Anya has indestructible. mana={3}{R}{W} type=Legendary Creature @@ -7980,7 +7980,7 @@ toughness=5 name=Ayli, Eternal Pilgrim abilities=deathtouch auto={1}{S(other creature|myBattlefield)}:name(you gain life) life:storedtoughness controller -auto=this(controllerlife > 29) transforms((,newability[{1}{w}{b}{S(other creature|myBattlefield)}:moveto(exile) target(*[-land])])) +auto=this(variable{pdiffinitlife}>9) transforms((,newability[{1}{w}{b}{S(other creature|myBattlefield)}:moveto(exile) target(*[-land])])) text=Deathtouch -- {1}, Sacrifice another creature: You gain life equal to the sacrificed creature's toughness. -- {1}{W}{B}, Sacrifice another creature: Exile target nonland permanent. Activate this ability only if you have at least 10 life more than your starting life total. mana={W}{B} type=Legendary Creature @@ -18512,7 +18512,7 @@ type=Artifact [/card] [card] name=Chalice of Life -auto={t}:life:1 && if compare(lifetotal)~morethan~29 then flip(Chalice of Death) +auto={t}:life:1 && if compare(lifetotalminusstartinglifeminusend)~morethan~9 then flip(Chalice of Death) text={T}: You gain 1 life. Then if you have at least 10 life more than your starting life total, transform Chalice of Life. mana={3} type=Artifact diff --git a/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt b/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt index 18e1e6128..95ba483a9 100644 --- a/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt +++ b/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt @@ -116,7 +116,7 @@ name=Ajani, Strength of the Pride auto=counter(0/0,5,loyalty) auto={C(0/0,1,Loyalty)}:name(+1: Gain life equal to planeswalkers and creatures) life:type:creature:myBattlefield controller && life:type:planeswalkers:myBattlefield controller auto={C(0/0,-2,Loyalty)}:name(-2: Create Ajani's Pridemate) token(Ajani's Pridemate) -auto={C(0/0,0,Loyalty)}:name(-0: Exile Ajani and creatures opponent) if compare(lifetotal)~morethan~34 then moveto(exile) all(this) && moveto(exile) all(creature,artifact|opponentbattlefield) +auto={C(0/0,0,Loyalty)}:name(-0: Exile Ajani and creatures opponent) if compare(lifetotalminusstartinglifeminusend)~morethan~14 then moveto(exile) all(this) && moveto(exile) all(*[creature;artifact]|opponentbattlefield) text=+1: You gain life equal to the number of creatures you control plus the number of planeswalkers you control. -- -2: Create a 2/2 white Cat Soldier creature token named Ajani's Pridemate with "Whenever you gain life, put a +1/+1 counter on Ajani's Pridemate." -- 0: If you have at least 15 life more than your starting life total, exile Ajani, Strength of the Pride and each artifact and creature your opponents control. mana={2}{W}{W} type=Legendary Planeswalker diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index a6d9f1dde..3d8e25d37 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -681,9 +681,21 @@ private: { intValue = (s == "lifetotal")?target->controller()->life:target->controller()->opponent()->life; } - else if (s == "startinglife") + else if (s == "startinglife" || s == "ostartinglife") { - intValue = target->controller()->initLife; + intValue = (s == "startinglife")?target->controller()->initLife:target->controller()->opponent()->initLife; + } + else if (s == "pdiffinitlife" || s == "odiffinitlife") + { + intValue = (s == "pdiffinitlife")?(target->controller()->life - target->controller()->initLife):(target->controller()->opponent()->life - target->controller()->opponent()->initLife); + } + else if (s == "phalfinitlife" || s == "ohalfinitlife") + { + if(s == "phalfinitlife"){ + intValue = (target->controller()->initLife > 2*target->controller()->life)?1:0; + } else { + intValue = (target->controller()->opponent()->initLife > 2*target->controller()->opponent()->life)?1:0; + } } else if (s == "abundantlife")//current life is morethan or equal to starting life {