From eebcc9c9258ab0727992d61d091c50b5488c4ee2 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Wed, 27 Jul 2016 06:31:03 +0800 Subject: [PATCH] Fix CDAACTIVE & transformed card colors cdaactive has its own computation, so exclude it on flip/transform cards ability --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 37 ++++++++--- projects/mtg/src/AllAbilities.cpp | 67 ++++++++++---------- 2 files changed, 63 insertions(+), 41 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 383e7190b..6d950a954 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -4616,8 +4616,8 @@ toughness=2 name=Archangel Avacyn abilities=flash,flying,vigilance auto=all(creature|mybattlefield) indestructible ueot -auto=@movedto(*[-angel]|graveyard) from(mybattlefield): flip(Avacyn, the Purifier) -text=flash, flying, vigilance -- when Archangel Avacyn enters the battlefield, creatures you control gain indestructible until end of turn -- when a non-angel you control dies, transform Archangel Avacyn +auto=@movedto(creature[-angel]|graveyard) from(mybattlefield) once:phaseaction[upkeep once,sourceinplay] flip(Avacyn, the Purifier) +text=Flash -- Flying, vigilance -- When Archangel Avacyn enters the battlefield, creatures you control gain indestructible until end of turn. -- When a non-Angel creature you control dies, transform Archangel Avacyn at the beginning of the next upkeep. mana={3}{W}{W} type=Legendary Creature subtype=Angel @@ -5180,6 +5180,7 @@ auto={C(0/0,-6,Loyalty)}:name(emblem) emblem transforms((,newability[lord(creatu text=+1: creatures you control get +1/+1 and trample until end of turn -- -1: Arlinn, Embraced by the Moon deals 3 damage to target creature or player, flip -- -6: you get an emblem with 'creatures you control have haste and '{T}: this creature deals damage equal to its power to target creature or player' type=Planeswalker subtype=Arlinn +color=red,green [/card] [card] name=Arm with AEther @@ -6634,6 +6635,7 @@ auto=damage:3 opponent text=flying -- when this creature transforms into Avacyn, the Purifier, it deals 3 damage to each other creature and each opponent type=Legendary Creature subtype=Angel +color=red power=6 toughness=5 [/card] @@ -7242,6 +7244,7 @@ auto=moveto(ownerhand) all(creature[-horror]) text=When this creature transforms into Awoken Horror, return all non-Horror creatures to their owners' hands. type=Creature subtype=Kraken Horror +color=blue power=7 toughness=8 [/card] @@ -13407,6 +13410,7 @@ auto=@each upkeep restriction{lastturn(*|stack)~morethan~1}:flip(Convicted Kille text=At the beginning of each upkeep, if a player cast two or more spells last turn, transform Branded Howler. type=Creature subtype=Werewolf +color=red power=4 toughness=4 [/card] @@ -19512,6 +19516,7 @@ name=Clue auto={2}{s}: draw:1 text={2}, sacrifice this token, draw a card type=Artifact +subtype=Clue [/card] [card] name=Clutch of Currents @@ -25402,7 +25407,7 @@ type=Artifact [card] name=Declaration in Stone target=creature -auto=transforms((,newability[all(*[share!name!]) moveto(exile)],newability[@movedto(exile) all([share!name!])token(Clue) controller])) +auto=transforms((,newability[all(*[share!name!]) moveto(exile)],newability[moveto(exile)],newability[token(Clue) controller])) text=Exile target creature and all other creatures its controller controls with the same name as that creature. That player investigates for each nontoken creature exiled this way. mana={1}{W} type=Sorcery @@ -26216,6 +26221,7 @@ auto=destroy target(creature) text=When this creature transforms into Demon-Possessed Witch, you may destroy target creature. type=Creature subtype=Human Shaman +color=black power=4 toughness=3 [/card] @@ -37969,6 +37975,7 @@ auto=@each upkeep restriction{lastturn(*|stack)~morethan~1}:flip(Kessig Forgemas text=Whenever Flameheart Werewolf blocks or becomes blocked by a creature, Flameheart Werewolf deals 2 damage to that creature. -- At the beginning of each upkeep, if a player cast two or more spells last turn, transform Flameheart Werewolf. type=Creature subtype=Werewolf +color=red power=3 toughness=2 [/card] @@ -41364,6 +41371,7 @@ abilities=menace text=Menace (This creature can't be blocked except by two or more creatures.) -- At the beginning of each upkeep, if a player cast two or more spells last turn, transform Gatstaf Ravagers. type=Creature subtype=Werewolf +color=red power=6 toughness=5 [/card] @@ -53948,6 +53956,7 @@ auto=@combat(notblocked) source(this):may flip(Elusive Tormentor) text=Hexproof, indestructible -- Insidious Mist can't block and can't be blocked. -- Whenever Insidious Mist attacks and isn't blocked, you may pay {2}{B}. If you do, transform it. type=Creature subtype=Elemental +color=blue power=0 toughness=1 [/card] @@ -59545,6 +59554,7 @@ auto=@each upkeep restriction{lastturn(*|stack)~morethan~1}:flip(Duskwatch Recru text=Creature spells you cast cost {1} less to cast. -- At the beginning of each upkeep, if a player cast two or more spells last turn, transform Krallenhorde Howler. type=Creature subtype=Werewolf +color=green power=3 toughness=3 [/card] @@ -60411,6 +60421,7 @@ auto=@each upkeep restriction{lastturn(*|stack)~morethan~1}:flip(Lambholt Pacifi text=At the beginning of each upkeep, if a player cast two or more spells last turn, transform Lambholt Butcher. type=Creature subtype=Werewolf +color=green power=4 toughness=4 [/card] @@ -60427,7 +60438,7 @@ toughness=2 [card] name=Lambholt Pacifist abilities=cantattack -auto=aslongas(creature[power>3]|mybattlefield)-cantattack +auto=aslongas(creature[power>=4]|mybattlefield) transforms((,newability[-cantattack])) auto=@each upkeep restriction{lastturn(*|stack)~lessthan~1}:flip(Lambholt Butcher) text=Lambholt Pacifist can't attack unless you control a creature with power 4 or greater. -- At the beginning of each upkeep, if no spells were cast last turn, transform Lambholt Pacifist. mana={1}{G} @@ -62978,6 +62989,7 @@ auto=@each upkeep restriction{lastturn(*|stack)~morethan~1}:flip(Hermit of the N text=Whenever an opponent casts a spell during your turn, draw two cards. -- At the beginning of each upkeep, if a player cast two or more spells last turn, transform Lone Wolf of the Natterknolls. type=Creature subtype=Werewolf +color=green power=3 toughness=5 [/card] @@ -63829,6 +63841,7 @@ auto=may (blink)forsrc target(creature) text=When this creature transforms into Lunarch Inquisitors, you may exile another target creature until Lunarch Inquisitors leaves the battlefield. type=Creature subtype=Human Cleric +color=white power=4 toughness=4 [/card] @@ -70419,6 +70432,7 @@ text=Menace (This creature can't be blocked except by two or more creatures.) -- abilities=menace type=Creature subtype=Werewolf +color=red power=2 toughness=2 [/card] @@ -72665,6 +72679,7 @@ auto=@each upkeep restriction{lastturn(*|stack)~morethan~1}:flip(Breakneck Rider text=Attacking creatures you control get +1/+0 and have trample. -- At the beginning of each upkeep, if a player cast two or more spells last turn, transform Neck Breaker. type=Creature subtype=Werewolf +color=red power=4 toughness=3 [/card] @@ -76030,6 +76045,7 @@ auto=@each upkeep restriction{lastturn(*|stack)~morethan~1}:flip(Solitary Hunter text=At the beginning of each upkeep, if a player cast two or more spells last turn, transform One of the Pack. type=Creature subtype=Werewolf +color=green power=5 toughness=6 [/card] @@ -82276,8 +82292,8 @@ type=Enchantment [/card] [card] name=Prized Amalgam -autograveyard=@movedto(other creature|mybattlefield) from(mygraveyard):phaseactionmulti[endofturn once] moveto(mybattlefield) && tap -autograveyard=@movedto(other creature|mystack) from(mygraveyard):phaseactionmulti[endofturn once] moveto(mybattlefield) && tap +autograveyard=@movedto(other creature|mybattlefield) from(mygraveyard) once:phaseactionmulti[endofturn once] moveto(mybattlefield) && tap +autograveyard=@movedto(other creature|mystack) from(mygraveyard) once:phaseactionmulti[endofturn once] moveto(mybattlefield) && tap text=Whenever a creature enters the battlefield, if it entered from your graveyard or you cast it from your graveyard, return Prized Amalgam from your graveyard to the battlefield tapped at the beginning of the next end step. mana={1}{U}{B} type=Creature @@ -112858,6 +112874,7 @@ auto=@each upkeep restriction{lastturn(*|stack)~morethan~1}:flip(Hinterland Logg text=Trample -- At the beginning of each upkeep, if a player cast two or more spells last turn, transform Timber Shredder. type=Creature subtype=Werewolf +color=green power=4 toughness=2 [/card] @@ -113153,7 +113170,7 @@ toughness=3 [card] name=Tireless Tracker auto=@movedto(land|mybattlefield):token(Clue) controller -auto=@sacrificed(clue|mybattlefield):(counter(1/1,1) +auto=@sacrificed(clue|mybattlefield):counter(1/1,1) text=Whenever a land enters the battlefield under your control, investigate. (Put a colorless Clue artifact token onto the battlefield with "{2}, Sacrifice this artifact: Draw a card.") -- Whenever you sacrifice a Clue, put a +1/+1 counter on Tireless Tracker. mana={2}{G} type=Creature @@ -117382,7 +117399,7 @@ type=Enchantment [/card] [card] name=Urabrask the Hidden -auto=lord(creature|mybattlefield) haste +auto=emblem transforms((,newability[aslongas(Urabrask the Hidden|mybattlefield) lord(creature|mybattlefield) haste >0])) ueot auto=lord(creature|opponentbattlefield) transforms((,newability[tap(noevent)])) text=Creatures you control have Haste. -- Creatures your opponents control enter the battlefield tapped. mana={3}{R}{R} @@ -119753,6 +119770,7 @@ auto=@each upkeep restriction{lastturn(*|stack)~morethan~1}:flip(Geier Reach Ban text=Whenever a Werewolf enters the battlefield under your control, you may transform it. -- At the beginning of each upkeep, if a player cast two or more spells last turn, transform Vildin-Pack Alpha. type=Creature subtype=Werewolf +color=red power=4 toughness=3 [/card] @@ -123588,11 +123606,12 @@ type=Land [/card] [card] name=Westvale Cult Leader -auto=foreach(creature|mybattlefield) 1/1 +anyzone=type:creature:mybattlefield/type:creature:mybattlefield cdaactive auto=@each my endofturn:token(Human Cleric,Creature Human Cleric,1/1,white,black) text=Westvale Cult Leader's power and toughness are each equal to the number of creatures you control. -- At the beginning of your end step, put a 1/1 white and black Human Cleric creature token onto the battlefield. type=Creature subtype=Human Cleric +color=white power=* toughness=* [/card] diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 7d2bb4d39..58e8c65b6 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -1126,27 +1126,27 @@ AADepleter::AADepleter(GameObserver* observer, int _id, MTGCardInstance * card, } } - for (vector::iterator it = found.begin(); it != found.end(); it++) - { - MTGCardInstance * cardFirst = *it; - if (cardFirst->isLand()) - continue; + for (vector::iterator it = found.begin(); it != found.end(); it++) + { + MTGCardInstance * cardFirst = *it; + if (cardFirst->isLand()) + continue; for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i) - { - if (cardFirst->hasColor(i)) - { - for (vector::iterator secondit = found.begin(); secondit != found.end(); secondit++) - { - MTGCardInstance * cardSecond = *secondit; - if (cardSecond->isLand()) - continue; - if (cardSecond->hasColor(i) && cardFirst != cardSecond) - { - repeating = true; - } - } - } - } + { + if (cardFirst->hasColor(i)) + { + for (vector::iterator secondit = found.begin(); secondit != found.end(); secondit++) + { + MTGCardInstance * cardSecond = *secondit; + if (cardSecond->isLand()) + continue; + if (cardSecond->hasColor(i) && cardFirst != cardSecond) + { + repeating = true; + } + } + } + } } do @@ -1183,18 +1183,18 @@ AADepleter::AADepleter(GameObserver* observer, int _id, MTGCardInstance * card, } } - for (vector::iterator it = found.begin(); it != found.end(); it++) - { - MTGCardInstance * cardFirst = *it; - for (vector::iterator secondit = found.begin(); secondit != found.end(); secondit++) - { - MTGCardInstance * cardSecond = *secondit; - if (cardSecond->name == cardFirst->name && cardFirst != cardSecond) - { - repeating = true; - } - } - + for (vector::iterator it = found.begin(); it != found.end(); it++) + { + MTGCardInstance * cardFirst = *it; + for (vector::iterator secondit = found.begin(); secondit != found.end(); secondit++) + { + MTGCardInstance * cardSecond = *secondit; + if (cardSecond->name == cardFirst->name && cardFirst != cardSecond) + { + repeating = true; + } + } + } do @@ -3224,11 +3224,14 @@ int AAFlip::resolve() { toughMod =_target->toughness - _target->origtoughness; } + if(!_target->isCDA) + { _target->power = powerlessThanOriginal?myFlip->power - powerMod:myFlip->power + powerMod; _target->life = toughLessThanOriginal?myFlip->toughness - toughMod:myFlip->toughness + toughMod; _target->toughness = toughLessThanOriginal?myFlip->toughness - toughMod:myFlip->toughness + toughMod; _target->origpower = myFlip->origpower; _target->origtoughness = myFlip->origtoughness; + } SAFE_DELETE(myFlip); _target->mPropertiesChangedSinceLastUpdate = true; }