AACloner & AACopier TokenAndAbility

if the token has andAbility, the cloner/copier also has that andAbility
also...
This commit is contained in:
Anthony Calosa
2016-08-04 02:12:59 +08:00
parent 067279d2e8
commit 52fb40d543
4 changed files with 32 additions and 0 deletions

View File

@@ -3692,6 +3692,8 @@ public:
//andability
if(andAbility)
{
//backup andAbility for copier and cloner
spell->source->TokenAndAbility = andAbility->clone();
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = spell->source;
if(andAbility->oneShot)

View File

@@ -121,6 +121,7 @@ public:
MTGGameZone * previousZone;
MTGCardInstance * previous;
MTGCardInstance * next;
MTGAbility * TokenAndAbility;
int doDamageTest;
bool skipDamageTestOnce;
int summoningSickness;

View File

@@ -1503,6 +1503,20 @@ int AACopier::resolve()
source->basicAbilities.reset();
source->getManaCost()->resetCosts();
}
if(_target->TokenAndAbility)
{//the source copied a token with andAbility
MTGAbility * andAbilityClone = _target->TokenAndAbility->clone();
andAbilityClone->target = source;
if(_target->TokenAndAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
}
return 1;
}
return 0;
@@ -3971,6 +3985,20 @@ int AACloner::resolve()
if(_target->model->data->basicAbilities[k])
spell->source->basicAbilities[k] = _target->model->data->basicAbilities[k];
}
if(_target->TokenAndAbility)
{//the source copied a token with andAbility
MTGAbility * andAbilityClone = _target->TokenAndAbility->clone();
andAbilityClone->target = spell->source;
if(_target->TokenAndAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
}
delete spell;
}
return 1;

View File

@@ -265,6 +265,7 @@ void MTGCardInstance::initMTGCI()
previousZone = NULL;
previous = NULL;
next = NULL;
TokenAndAbility = NULL;
lastController = NULL;
regenerateTokens = 0;
blocked = false;