From 6bc7de3370182366886815d70e60d38064cc99bd Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 18 Jun 2016 09:11:57 +0800 Subject: [PATCH 01/12] Minor Fix --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 7 ++++--- projects/mtg/include/AllAbilities.h | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index c2c2b4154..ad1b6fd9d 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -37416,7 +37416,7 @@ subtype=Aura [card] name=Fury Charm auto=may destroy target(artifact) -auto=may 1/1 && trample target(creature) +auto=may name(1/1 & trample) target(creature) transforms((,newability[1/1],newability[trample])) ueot auto=may counter(0/0,-2,Time) target(*) text=Choose one - Destroy target artifact; or target creature gets +1/+1 and gains trample until end of turn; or remove two time counters from target permanent or suspended card. mana={1}{R} @@ -79332,6 +79332,7 @@ auto=this(variable{plandu}>0) {t}:add{u} auto=this(variable{plandr}>0) {t}:add{r} auto=this(variable{plandb}>0) {t}:add{b} auto=this(variable{plandw}>0) {t}:add{w} +auto=this(variable{plandc}>0) {t}:add{1} text={T}: Add to your mana pool one mana of any type that a land you control could produce. type=Land [/card] @@ -86780,7 +86781,7 @@ type=Artifact [/card] [card] name=Selesnya Charm -auto=choice target(creature) 2/2 && trample ueot +auto=choice name(2/2 & trample) target(creature) transforms((,newability[2/2],newability[trample])) ueot auto=choice moveTo(exile) target(creature[power>=5]) auto=choice token(Knight,Creature Knight,2/2,white,vigilance) text=Choose one — Target creature gets +2/+2 and gains trample until end of turn; or exile target creature with power 5 or greater; or put a 2/2 white Knight creature token with vigilance onto the battlefield. @@ -110430,7 +110431,7 @@ toughness=1 [card] name=Vitality Charm auto=choice token(Insect,creature insect, 1/1,green) -auto=aslongas(creature|battlefield) choice 1/1 && trample target(creature) +auto=aslongas(creature|battlefield) choice name(1/1 & trample) target(creature) transforms((,newability[1/1],newability[trample])) ueot auto=aslongas(beast|battlefield) choice regenerate target(beast) text=Choose one - Put a 1/1 green Insect creature token onto the battlefield; or target creature gets +1/+1 and gains trample until end of turn; or regenerate target Beast. mana={G} diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 79f3dc0ba..f8c9646b6 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -584,6 +584,11 @@ private: { intValue = countManaProducedby(Constants::MTG_COLOR_WHITE, target, target->controller()->opponent()); } + else if (s == "olandc") + { + intValue = countManaProducedby(Constants::MTG_COLOR_ARTIFACT, target, target->controller()->opponent()) + + countManaProducedby(Constants::MTG_COLOR_WASTE, target, target->controller()->opponent()); + } else if (s == "plandg") { intValue = countManaProducedby(Constants::MTG_COLOR_GREEN, target, target->controller()); @@ -604,6 +609,11 @@ private: { intValue = countManaProducedby(Constants::MTG_COLOR_WHITE, target, target->controller()); } + else if (s == "plandc") + { + intValue = countManaProducedby(Constants::MTG_COLOR_ARTIFACT, target, target->controller()) + + countManaProducedby(Constants::MTG_COLOR_WASTE, target, target->controller()); + } else if (s == "cantargetmycre")// can target my creature { intValue = countCanTargetby("creature", card, card->controller()); From cd645b33b2d118f34d70c1fa523e974b583767ad Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 18 Jun 2016 12:31:23 +0800 Subject: [PATCH 02/12] Fix for Aura's that are put into play --- projects/mtg/src/AllAbilities.cpp | 62 +++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 21d0ccba5..bfb859b37 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -3013,28 +3013,52 @@ int AAMover::resolve() if (destZone == game->players[i]->game->inPlay && fromZone != game->players[i]->game->inPlay && fromZone != game->players[i]->opponent()->game->inPlay) { - MTGCardInstance * copy = game->players[i]->game->putInZone(_target, fromZone, game->players[i]->game->temp); - Spell * spell = NEW Spell(game, copy); - spell->resolve(); - if(andAbility) - { - MTGAbility * andAbilityClone = andAbility->clone(); - andAbilityClone->target = spell->source; - if(andAbility->oneShot) + if(_target->hasSubtype(Subtypes::TYPE_AURA) && destZone == game->players[i]->game->inPlay) + {//put into play aura if there is no valid targets then it will be in its current zone + MTGAbility *a = NEW AACastCard(game, game->mLayers->actionLayer()->getMaxId(), _target, _target,false,false,false,"","Put in play",false,true); + a->oneShot = false; + a->canBeInterrupted = false; + a->addToGame(); + if(andAbility) { - andAbilityClone->resolve(); - SAFE_DELETE(andAbilityClone); - } - else - { - andAbilityClone->addToGame(); + MTGAbility * andAbilityClone = andAbility->clone(); + andAbilityClone->target = _target->next; + if(andAbility->oneShot) + { + andAbilityClone->resolve(); + SAFE_DELETE(andAbilityClone); + } + else + { + andAbilityClone->addToGame(); + } } } - if(persist) - spell->source->counters->addCounter(-1,-1); - if(undying) - spell->source->counters->addCounter(1,1); - delete spell; + else + { + MTGCardInstance * copy = game->players[i]->game->putInZone(_target, fromZone, game->players[i]->game->temp); + Spell * spell = NEW Spell(game, copy); + spell->resolve(); + if(andAbility) + { + MTGAbility * andAbilityClone = andAbility->clone(); + andAbilityClone->target = spell->source; + if(andAbility->oneShot) + { + andAbilityClone->resolve(); + SAFE_DELETE(andAbilityClone); + } + else + { + andAbilityClone->addToGame(); + } + } + if(persist) + spell->source->counters->addCounter(-1,-1); + if(undying) + spell->source->counters->addCounter(1,1); + delete spell; + } return 1; } } From bae2502d8ff0903565a15faa16c08dfc5e485a7b Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 18 Jun 2016 12:37:52 +0800 Subject: [PATCH 03/12] Create Replenish.txt --- projects/mtg/bin/Res/test/Replenish.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/mtg/bin/Res/test/Replenish.txt diff --git a/projects/mtg/bin/Res/test/Replenish.txt b/projects/mtg/bin/Res/test/Replenish.txt new file mode 100644 index 000000000..2d5e7f67a --- /dev/null +++ b/projects/mtg/bin/Res/test/Replenish.txt @@ -0,0 +1,22 @@ +#Put in play Fists of Ironwood via Replenish +[INIT] +FIRSTMAIN +[PLAYER1] +life:20 +hand:Replenish +graveyard:Fists of Ironwood, Opalescence, Opalescence +manapool:{3}{W} +[PLAYER2] +life:20 +[DO] +Replenish +eot +[ASSERT] +UNTAP +[PLAYER1] +graveyard:Replenish, Fists of Ironwood +inplay:Opalescence, Opalescence +life:20 +[PLAYER2] +life:20 +[END] From 7247abd5f1755f1632d22a641b784e1007d939e2 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 18 Jun 2016 12:38:30 +0800 Subject: [PATCH 04/12] Create Show_and_Tell.txt --- projects/mtg/bin/Res/test/Show_and_Tell.txt | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/mtg/bin/Res/test/Show_and_Tell.txt diff --git a/projects/mtg/bin/Res/test/Show_and_Tell.txt b/projects/mtg/bin/Res/test/Show_and_Tell.txt new file mode 100644 index 000000000..7a0094c79 --- /dev/null +++ b/projects/mtg/bin/Res/test/Show_and_Tell.txt @@ -0,0 +1,23 @@ +#Put in play Fists of Ironwood via Show and Tell +[INIT] +FIRSTMAIN +[PLAYER1] +life:20 +hand:Show and Tell, Fists of Ironwood +manapool:{2}{U} +[PLAYER2] +life:20 +[DO] +Show and Tell +choice 0 +Fists of Ironwood +eot +[ASSERT] +UNTAP +[PLAYER1] +graveyard:Show and Tell +hand:Fists of Ironwood +life:20 +[PLAYER2] +life:20 +[END] From a48568526b8ef385b75df2395f6bed78c6e8b318 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 18 Jun 2016 12:39:20 +0800 Subject: [PATCH 05/12] Update _tests.txt --- projects/mtg/bin/Res/test/_tests.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 4d565dae5..850a0603e 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -577,6 +577,7 @@ regal_force.txt reinforcements_1.txt Rending_Vines.txt Rending_Vines2.txt +Replenish.txt resounding_roar.txt resurrection.txt resuscitate_i210.txt @@ -623,6 +624,7 @@ shimmer_myr_FORCEDALIVE.txt shivan_hellkite.txt shock.txt shock2.txt +Show_and_Tell.txt siege_gang_commander.txt simic_initiate.txt slate_of_ancestry.txt From eb99680986761af684e7e882c04157d2b347c70c Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 18 Jun 2016 19:55:58 +0800 Subject: [PATCH 06/12] Modified --- projects/mtg/src/AllAbilities.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index bfb859b37..f9760ed2e 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -3013,7 +3013,7 @@ int AAMover::resolve() if (destZone == game->players[i]->game->inPlay && fromZone != game->players[i]->game->inPlay && fromZone != game->players[i]->opponent()->game->inPlay) { - if(_target->hasSubtype(Subtypes::TYPE_AURA) && destZone == game->players[i]->game->inPlay) + if(_target->hasSubtype(Subtypes::TYPE_AURA)) {//put into play aura if there is no valid targets then it will be in its current zone MTGAbility *a = NEW AACastCard(game, game->mLayers->actionLayer()->getMaxId(), _target, _target,false,false,false,"","Put in play",false,true); a->oneShot = false; @@ -3033,6 +3033,7 @@ int AAMover::resolve() andAbilityClone->addToGame(); } } + return 1; } else { From 3f40a6db4b351c067f10f3b673852af06ea9037f Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 18 Jun 2016 20:06:36 +0800 Subject: [PATCH 07/12] Update Replenish.txt --- projects/mtg/bin/Res/test/Replenish.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/mtg/bin/Res/test/Replenish.txt b/projects/mtg/bin/Res/test/Replenish.txt index 2d5e7f67a..6acebe626 100644 --- a/projects/mtg/bin/Res/test/Replenish.txt +++ b/projects/mtg/bin/Res/test/Replenish.txt @@ -10,6 +10,7 @@ manapool:{3}{W} life:20 [DO] Replenish +choice 0 eot [ASSERT] UNTAP From e315cad0f513e661d267b0c35a1f792ce8c7f09c Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 18 Jun 2016 20:22:50 +0800 Subject: [PATCH 08/12] Revert to previous --- projects/mtg/src/AllAbilities.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index f9760ed2e..bfb859b37 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -3013,7 +3013,7 @@ int AAMover::resolve() if (destZone == game->players[i]->game->inPlay && fromZone != game->players[i]->game->inPlay && fromZone != game->players[i]->opponent()->game->inPlay) { - if(_target->hasSubtype(Subtypes::TYPE_AURA)) + if(_target->hasSubtype(Subtypes::TYPE_AURA) && destZone == game->players[i]->game->inPlay) {//put into play aura if there is no valid targets then it will be in its current zone MTGAbility *a = NEW AACastCard(game, game->mLayers->actionLayer()->getMaxId(), _target, _target,false,false,false,"","Put in play",false,true); a->oneShot = false; @@ -3033,7 +3033,6 @@ int AAMover::resolve() andAbilityClone->addToGame(); } } - return 1; } else { From a73030ac9bc5ba1e1e2d1f3add7997685b639b2d Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 18 Jun 2016 21:20:30 +0800 Subject: [PATCH 09/12] Overlooked this Should be fine now, reverted the test --- projects/mtg/src/AllAbilities.cpp | 112 +++++++++++++++--------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index bfb859b37..2aaaf1987 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -3010,73 +3010,73 @@ int AAMover::resolve() //inplay is a special zone ! for (int i = 0; i < 2; i++) { - if (destZone == game->players[i]->game->inPlay && fromZone != game->players[i]->game->inPlay && fromZone + if (!_target->hasSubtype(Subtypes::TYPE_AURA) && destZone == game->players[i]->game->inPlay && fromZone != game->players[i]->game->inPlay && fromZone != game->players[i]->opponent()->game->inPlay) { - if(_target->hasSubtype(Subtypes::TYPE_AURA) && destZone == game->players[i]->game->inPlay) - {//put into play aura if there is no valid targets then it will be in its current zone - MTGAbility *a = NEW AACastCard(game, game->mLayers->actionLayer()->getMaxId(), _target, _target,false,false,false,"","Put in play",false,true); - a->oneShot = false; - a->canBeInterrupted = false; - a->addToGame(); - if(andAbility) - { - MTGAbility * andAbilityClone = andAbility->clone(); - andAbilityClone->target = _target->next; - if(andAbility->oneShot) - { - andAbilityClone->resolve(); - SAFE_DELETE(andAbilityClone); - } - else - { - andAbilityClone->addToGame(); - } - } - } - else + MTGCardInstance * copy = game->players[i]->game->putInZone(_target, fromZone, game->players[i]->game->temp); + Spell * spell = NEW Spell(game, copy); + spell->resolve(); + if(andAbility) { - MTGCardInstance * copy = game->players[i]->game->putInZone(_target, fromZone, game->players[i]->game->temp); - Spell * spell = NEW Spell(game, copy); - spell->resolve(); - if(andAbility) + MTGAbility * andAbilityClone = andAbility->clone(); + andAbilityClone->target = spell->source; + if(andAbility->oneShot) { - MTGAbility * andAbilityClone = andAbility->clone(); - andAbilityClone->target = spell->source; - if(andAbility->oneShot) - { - andAbilityClone->resolve(); - SAFE_DELETE(andAbilityClone); - } - else - { - andAbilityClone->addToGame(); - } + andAbilityClone->resolve(); + SAFE_DELETE(andAbilityClone); + } + else + { + andAbilityClone->addToGame(); } - if(persist) - spell->source->counters->addCounter(-1,-1); - if(undying) - spell->source->counters->addCounter(1,1); - delete spell; } + if(persist) + spell->source->counters->addCounter(-1,-1); + if(undying) + spell->source->counters->addCounter(1,1); + delete spell; return 1; } } - p->game->putInZone(_target, fromZone, destZone); - while(_target->next) - _target = _target->next; - if(andAbility) - { - MTGAbility * andAbilityClone = andAbility->clone(); - andAbilityClone->target = _target; - if(andAbility->oneShot) - { - andAbilityClone->resolve(); - SAFE_DELETE(andAbilityClone); + if(_target->hasSubtype(Subtypes::TYPE_AURA) && (destZone == game->players[0]->game->inPlay || destZone == game->players[1]->game->inPlay)) + {//put into play aura if there is no valid targets then it will be in its current zone + MTGAbility *a = NEW AACastCard(game, game->mLayers->actionLayer()->getMaxId(), _target, _target,false,false,false,"","Put in play",false,true); + a->oneShot = false; + a->canBeInterrupted = false; + a->addToGame(); + if(andAbility && _target->next) + {//if successful target->next should be valid + MTGAbility * andAbilityClone = andAbility->clone(); + andAbilityClone->target = _target->next; + if(andAbility->oneShot) + { + andAbilityClone->resolve(); + SAFE_DELETE(andAbilityClone); + } + else + { + andAbilityClone->addToGame(); + } } - else + } + else + { + p->game->putInZone(_target, fromZone, destZone); + while(_target->next) + _target = _target->next; + if(andAbility) { - andAbilityClone->addToGame(); + MTGAbility * andAbilityClone = andAbility->clone(); + andAbilityClone->target = _target; + if(andAbility->oneShot) + { + andAbilityClone->resolve(); + SAFE_DELETE(andAbilityClone); + } + else + { + andAbilityClone->addToGame(); + } } } return 1; From ba0cab3743fd95cb125f9de2391f07c4b4148b9d Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 18 Jun 2016 21:21:08 +0800 Subject: [PATCH 10/12] Revert test --- projects/mtg/bin/Res/test/Replenish.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/mtg/bin/Res/test/Replenish.txt b/projects/mtg/bin/Res/test/Replenish.txt index 6acebe626..2d5e7f67a 100644 --- a/projects/mtg/bin/Res/test/Replenish.txt +++ b/projects/mtg/bin/Res/test/Replenish.txt @@ -10,7 +10,6 @@ manapool:{3}{W} life:20 [DO] Replenish -choice 0 eot [ASSERT] UNTAP From cd34c4ebdf0fd3da8f5623fba1ae1e5d37c22bcd Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 18 Jun 2016 21:55:14 +0800 Subject: [PATCH 11/12] Modified test Replenish + other enchantments --- projects/mtg/bin/Res/test/Replenish.txt | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/projects/mtg/bin/Res/test/Replenish.txt b/projects/mtg/bin/Res/test/Replenish.txt index 2d5e7f67a..be6425fd6 100644 --- a/projects/mtg/bin/Res/test/Replenish.txt +++ b/projects/mtg/bin/Res/test/Replenish.txt @@ -3,20 +3,33 @@ FIRSTMAIN [PLAYER1] life:20 -hand:Replenish -graveyard:Fists of Ironwood, Opalescence, Opalescence +hand:Replenish, 4683, Replenish +graveyard:83672, Mass Hysteria +inplay:Swamp, Forest, Island, Mountain, Plains manapool:{3}{W} [PLAYER2] life:20 [DO] Replenish +Swamp +4683 +Forest +Island +Plains +Mountain +Replenish +-4683 +next +next +-83672 +-4683 eot [ASSERT] UNTAP [PLAYER1] -graveyard:Replenish, Fists of Ironwood -inplay:Opalescence, Opalescence +graveyard:Replenish, Replenish +inplay:Sarcomancy, Mass Hysteria, Swamp, Forest, Island, Mountain, Plains, -4683, -83672, -83672, 83672 life:20 [PLAYER2] -life:20 -[END] +life:17 +[END] \ No newline at end of file From de3ce6f676205b54108d21eabff9dd59f6962c67 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 18 Jun 2016 21:58:24 +0800 Subject: [PATCH 12/12] add description --- projects/mtg/bin/Res/test/Replenish.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/mtg/bin/Res/test/Replenish.txt b/projects/mtg/bin/Res/test/Replenish.txt index be6425fd6..9d429243c 100644 --- a/projects/mtg/bin/Res/test/Replenish.txt +++ b/projects/mtg/bin/Res/test/Replenish.txt @@ -11,6 +11,7 @@ manapool:{3}{W} life:20 [DO] Replenish +#Fists of Ironwood remains on graveyard since there are no valid targets Swamp 4683 Forest @@ -18,6 +19,7 @@ Island Plains Mountain Replenish +#Fists of Ironwood attach on Zombie Token created by Sarcomancy, Then produces 2 Saproling Tokens -4683 next next