From 3aa64697d2191a0306e3a8ba345cd40f1eb207ed Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Fri, 8 Jul 2016 17:39:47 +0800 Subject: [PATCH] "previousbattlefield" for mover --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 38 ++++++++++---------- projects/mtg/include/MTGCardInstance.h | 1 + projects/mtg/src/AllAbilities.cpp | 8 +++++ projects/mtg/src/MTGCardInstance.cpp | 1 + 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 70fd067ad..508697533 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -673,7 +673,7 @@ toughness=4 [card] name=Act of Aggression target=creature|opponentbattlefield -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! color=red text=({p(R)} may be paid for with either {R} or 2 life.) -- Gain control of target creature until end of turn. Untap that creature. It gains haste until end of turn. (It can attack and {T} this turn.) mana={3}{p(R)}{p(R)} @@ -682,7 +682,7 @@ type=Instant [card] name=Act of Treason target=creature -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! text=Gain control of target creature until end of turn. Untap that creature. It gains haste until end of turn. (It can attack and {T} this turn.) mana={2}{R} type=Sorcery @@ -10752,7 +10752,7 @@ toughness=3 [card] name=Blind with Anger target=creature[-legendary] -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! text=Untap target nonlegendary creature and gain control of it until end of turn. That creature gains haste until end of turn. mana={3}{R} type=Instant @@ -27596,7 +27596,7 @@ type=Instant name=Disharmony target=creature[attacking] auto=removefromcombat -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap])) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap])) ueot)! restriction=blockersonly text=Cast Disharmony only during combat before blockers are declared. -- Untap target attacking creature and remove it from combat. Gain control of that creature until end of turn. mana={2}{R} @@ -38116,7 +38116,7 @@ toughness=2 name=Flash Conscription target=creature auto=if spent({W}) then teach(creature) spiritlink ueot -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! text=Untap target creature and gain control of it until end of turn. That creature gains haste until end of turn. If {W} was spent to cast Flash Conscription, the creature gains "Whenever this creature deals combat damage, you gain that much life" until end of turn. mana={5}{R} type=Instant @@ -63159,7 +63159,7 @@ toughness=8 name=Lose Calm target=creature auto=menace -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! text=Gain control of target creature until end of turn. Untap that creature. It gains haste and menace until end of turn. (A creature with menace can't be blocked except by two or more creatures.) mana={3}{R} type=Sorcery @@ -64869,7 +64869,7 @@ type=Enchantment name=Malevolent Whispers target=creature auto=2/0 ueot -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! abilities=madness autoexile=restriction{discarded} pay({3}{r}) name(pay 3r to cast) activate name(pay 3r to cast) castcard(normal)?name(put in graveyard) moveto(ownergraveyard) text=Gain control of target creature until end of turn. Untap that creature. It gets +2/+0 and gains haste until end of turn. -- Madness {3}{R} (If you discard this card, discard it into exile. When you do, cast it for its madness cost or put it into your graveyard.) @@ -65782,7 +65782,7 @@ subtype=Aura name=Mark of Mutiny target=creature auto=counter(1/1,1) -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! text=Gain control of target creature until end of turn. Put a +1/+1 counter on it and untap it. That creature gains haste until end of turn. mana={2}{R} type=Sorcery @@ -66273,7 +66273,7 @@ type=Enchantment [card] name=Mass Mutiny target=creature|opponentbattlefield -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! text=For each opponent, gain control of up to one target creature that player controls until end of turn. Untap those creatures. They gain haste until end of turn. mana={3}{R}{R} type=Sorcery @@ -67613,7 +67613,7 @@ type=Instant [card] name=Metallic Mastery target=artifact -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! text=Untap target artifact and gain control of it until end of turn. That artifact gains haste until end of turn. mana={2}{R} type=Sorcery @@ -81135,7 +81135,7 @@ type=Artifact [card] name=Portent of Betrayal target=creature -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! auto=scry:1 scrycore delayed dontshow donothing scrycoreend scryend text=Gain control of target creature until end of turn. Untap that creature. It gains haste until end of turn. Scry 1. (Look at the top card of your library. You may put that card on the bottom of your library.) mana={3}{R} @@ -85349,7 +85349,7 @@ toughness=3 [card] name=Ray of Command target=creature|opponentBattlefield -auto=moveto(mybattlefield) and!(transforms((,newability[phaseactionmulti[endofturn sourceinplay] moveTo(ownerbattlefield) && tap],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseactionmulti[endofturn sourceinplay] moveTo(previousbattlefield) && tap],newability[untap],haste)) ueot)! text=Untap target creature an opponent controls and gain control of it until end of turn. That creature gains haste until end of turn. When you lose control of the creature, tap it. mana={3}{U} type=Instant @@ -110121,7 +110121,7 @@ type=Sorcery [card] name=Temporary Insanity target=creature[power <=type:*:mygraveyard] -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! text=Untap target creature with power less than the number of cards in your graveyard and gain control of it until end of turn. That creature gains haste until end of turn. mana={3}{R} type=Instant @@ -111949,7 +111949,7 @@ subtype=Aura [card] name=Threaten target=creature -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! text=Untap target creature and gain control of it until end of turn. That creature gains haste until end of turn. (It can attack and {T} this turn.) mana={2}{R} type=Sorcery @@ -114189,7 +114189,7 @@ toughness=4 [card] name=Traitorous Blood target=creature -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste,trample)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste,trample)) ueot)! text=Gain control of target creature until end of turn. Untap it. It gains trample and haste until end of turn. mana={1}{R}{R} type=Sorcery @@ -114198,7 +114198,7 @@ type=Sorcery name=Traitorous Instinct target=creature auto=2/0 -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! text=Gain control of target creature until end of turn. Untap that creature. Until end of turn it gets +2/+0 and gains haste. mana={3}{R} type=Sorcery @@ -115639,7 +115639,7 @@ type=Instant [card] name=Turn Against target=creature -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! text=Devoid (This card has no color.) -- Gain control of target creature until end of turn. Untap that creature. It gains haste until end of turn. mana={4}{R} abilities=devoid @@ -117080,7 +117080,7 @@ type=Sorcery name=Unwilling Recruit target=creature auto=X/0 -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! text=Gain control of target creature until end of turn. Untap that creature. It gets +X/+0 and gains haste until end of turn. mana={X}{R}{R}{R} type=Sorcery @@ -125622,7 +125622,7 @@ type=Instant [card] name=Word of Seizing target=*|battlefield -auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(ownerbattlefield)],newability[untap],haste)) ueot)! +auto=moveto(mybattlefield) and!(transforms((,newability[phaseaction[endofturn sourceinplay] moveTo(previousbattlefield)],newability[untap],haste)) ueot)! text=Split second (As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.) -- Untap target permanent and gain control of it until end of turn. It gains haste until end of turn. mana={3}{R}{R} type=Instant diff --git a/projects/mtg/include/MTGCardInstance.h b/projects/mtg/include/MTGCardInstance.h index 8486582dc..4a59bb206 100644 --- a/projects/mtg/include/MTGCardInstance.h +++ b/projects/mtg/include/MTGCardInstance.h @@ -113,6 +113,7 @@ public: bool isDualWielding; bool stillNeeded; Player * lastController; + Player * previousController; MTGGameZone * getCurrentZone(); MTGGameZone * previousZone; MTGCardInstance * previous; diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index db7a3eedb..84a4a4c3d 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -3843,6 +3843,13 @@ AAMover::AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTG MTGGameZone * AAMover::destinationZone(Targetable * target) { MTGCardInstance * _target = (MTGCardInstance *) target; + if(destination == "previousbattlefield") + { + if(_target->previousController) + return _target->previousController->inPlay(); + else + return _target->controller()->inPlay(); + } return MTGGameZone::stringToZone(game, destination, source, _target); } @@ -3866,6 +3873,7 @@ int AAMover::resolve() MTGCardInstance * copy = game->players[i]->game->putInZone(_target, fromZone, game->players[i]->game->temp); Spell * spell = NEW Spell(game, copy); spell->resolve(); + spell->source->previousController = fromZone->owner; if(andAbility) { MTGAbility * andAbilityClone = andAbility->clone(); diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index 6d110cfe3..e5fc325fe 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -49,6 +49,7 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to if (arg_belongs_to) owner = arg_belongs_to->library->owner; lastController = owner; + previousController = owner; defenser = NULL; banding = NULL; life = toughness;