From d068388e7fa253d4a23dc74ea038ff8b767e458d Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Thu, 24 Sep 2015 09:53:10 +0800 Subject: [PATCH] added aura targets for castcard putinplay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the special putinplay keyword for castcard is used for aura so we can "retarget" their intended targets but without casting them instead they are put onto the battlefield and the ability is not targetted :+1: 303.4c If an Aura is enchanting an illegal object or player as defined by its enchant ability and other applicable effects, the object it was attached to no longer exists, or the player it was attached to has left the game, the Aura is put into its owner’s graveyard. (This is a state-based action. See rule 704.) 303.4f If an Aura is entering the battlefield under a player’s control by any means other than by resolving as an Aura spell, and the effect putting it onto the battlefield doesn’t specify the object or player the Aura will enchant, that player chooses what it will enchant as the Aura enters the battlefield. The player must choose a legal object or player according to the Aura’s enchant ability and any other applicable effects. --- projects/mtg/src/AllAbilities.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 080918a46..f02f76ef3 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -5526,6 +5526,20 @@ void AACastCard::Update(float dt) { theNamedCard = makeCard(); } + if(putinplay) + { + MTGCardInstance * toCheck = (MTGCardInstance*)target; + toCheck->bypassTC = true; + TargetChooserFactory tcf(game); + TargetChooser * atc = tcf.createTargetChooser(toCheck->spellTargetType,toCheck); + if (toCheck->hasType(Subtypes::TYPE_AURA) && !atc->validTargetsExist()) + { + processed = true; + this->forceDestroy = 1; + return ; + } + SAFE_DELETE(atc); + } if (restricted) { MTGCardInstance * toCheck = (MTGCardInstance*)target; @@ -5551,8 +5565,6 @@ void AACastCard::Update(float dt) } } MTGCardInstance * toCheck = (MTGCardInstance*)target; - if(putinplay) - toCheck->bypassTC = true; if(theNamedCard) toCheck = theNamedCard; if (Spell * checkSpell = dynamic_cast(target))