add andAbility support for AACopier

the granted ability must exists only if you copy a card, if you don't
copy any card, the source doesn't have any granted abillities.
This commit is contained in:
Anthony Calosa
2016-08-07 10:15:11 +08:00
parent dfd0761506
commit 807874ce5d
5 changed files with 33 additions and 14 deletions
+19 -4
View File
@@ -1453,6 +1453,7 @@ AACopier::AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, M
ActivatedAbility(observer, _id, _source, _cost, 0)
{
target = _target;
andAbility = NULL;
}
int AACopier::resolve()
@@ -1505,9 +1506,23 @@ int AACopier::resolve()
}
if(_target->TokenAndAbility)
{//the source copied a token with andAbility
MTGAbility * andAbilityClone = _target->TokenAndAbility->clone();
andAbilityClone->target = source;
MTGAbility * TokenandAbilityClone = _target->TokenAndAbility->clone();
TokenandAbilityClone->target = source;
if(_target->TokenAndAbility->oneShot)
{
TokenandAbilityClone->resolve();
SAFE_DELETE(TokenandAbilityClone);
}
else
{
TokenandAbilityClone->addToGame();
}
}
if(andAbility)
{
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = source;
if(andAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
@@ -3968,10 +3983,10 @@ int AACloner::resolve()
}
}
list<int>::iterator it;
for (it = awith.begin(); it != awith.end(); it++)
/*for (it = awith.begin(); it != awith.end(); it++)
{//there must be a layer of temporary abilities and original abilities
spell->source->basicAbilities[*it] = 1;
}
}*/
for (it = colors.begin(); it != colors.end(); it++)
{
spell->source->setColor(*it);
+1 -1
View File
@@ -1224,7 +1224,7 @@ void CardGui::DrawBorder(string cardsetname, const Pos& pos, float x, bool nobor
alphabeta->SetHotSpot(static_cast<float> (alphabeta->mWidth / 2), static_cast<float> (alphabeta->mHeight / 2));
float myscale = pos.actZ * 254 / alphabeta->mHeight;
alphabeta->SetColor(ARGB((int)pos.actA,255,255,255));
renderer->RenderQuad(alphabeta.get(), x, pos.actY, pos.actT, myscale, myscale);
renderer->RenderQuad(alphabeta.get(), x, pos.actY+0.2f, pos.actT, myscale, myscale);
}
}
}
+8
View File
@@ -2518,6 +2518,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
{
MTGAbility * a = NEW AACopier(observer, id, card, target);
a->oneShot = 1;
a->canBeInterrupted = false;
//andability
if(storedAndAbility.size())
{
string stored = storedAndAbility;
storedAndAbility.clear();
((AACopier*)a)->andAbility = parseMagicLine(stored, id, spell, card);
}
return a;
}