add support for activated copier
thespian stage etc...
This commit is contained in:
@@ -1539,6 +1539,7 @@ AACopier::AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, M
|
||||
{
|
||||
target = _target;
|
||||
andAbility = NULL;
|
||||
isactivated = false;
|
||||
}
|
||||
|
||||
int AACopier::resolve()
|
||||
@@ -1546,6 +1547,8 @@ int AACopier::resolve()
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
if (_target)
|
||||
{
|
||||
if(isactivated)
|
||||
source->isPhased = true;
|
||||
bool tokencopied = false;
|
||||
if(_target->isToken || (_target->isACopier && _target->hasCopiedToken))
|
||||
tokencopied = true;
|
||||
@@ -1606,6 +1609,57 @@ int AACopier::resolve()
|
||||
TokenandAbilityClone->addToGame();
|
||||
}
|
||||
}
|
||||
if(isactivated)
|
||||
{//activated version grant
|
||||
source->GrantedAndAbility = andAbility;
|
||||
AbilityFactory af(game);
|
||||
for(unsigned int i = 0;i < source->cardsAbilities.size();i++)
|
||||
{
|
||||
MTGAbility * a = dynamic_cast<MTGAbility *>(source->cardsAbilities[i]);
|
||||
|
||||
if(a) game->removeObserver(a);
|
||||
}
|
||||
source->cardsAbilities.clear();
|
||||
source->magicText = _target->magicText;
|
||||
|
||||
af.getAbilities(¤tAbilities, NULL, source);
|
||||
for (size_t i = 0; i < currentAbilities.size(); ++i)
|
||||
{
|
||||
MTGAbility * a = currentAbilities[i];
|
||||
a->source = (MTGCardInstance *) source;
|
||||
if (a)
|
||||
{
|
||||
if (a->oneShot)
|
||||
{
|
||||
SAFE_DELETE(a);
|
||||
}
|
||||
else
|
||||
{
|
||||
a->addToGame();
|
||||
MayAbility * dontAdd = dynamic_cast<MayAbility*>(a);
|
||||
if(!dontAdd)
|
||||
{
|
||||
source->cardsAbilities.push_back(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(source->GrantedAndAbility)
|
||||
{
|
||||
MTGAbility * andAbilityClone = source->GrantedAndAbility->clone();
|
||||
andAbilityClone->target = source;
|
||||
if(andAbility->oneShot)
|
||||
{
|
||||
andAbilityClone->resolve();
|
||||
SAFE_DELETE(andAbilityClone);
|
||||
}
|
||||
else
|
||||
{
|
||||
andAbilityClone->addToGame();
|
||||
}
|
||||
}
|
||||
source->isPhased = false;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user