remove my changes in aacopier
since I introduce a weird crash bug with it.
This commit is contained in:
@@ -1462,103 +1462,19 @@ int AACopier::resolve()
|
|||||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||||
if (_target)
|
if (_target)
|
||||||
{
|
{
|
||||||
MTGCard* clone;
|
//MTGCard* clone;
|
||||||
AbilityFactory af(game);
|
//AbilityFactory af(game);
|
||||||
if(_target->isToken || (_target->isACopier && _target->hasCopiedToken))
|
if(_target->isToken || (_target->isACopier && _target->hasCopiedToken))
|
||||||
{//fix crash when copying token
|
{//fix crash when copying token
|
||||||
clone = _target;
|
//clone = _target;
|
||||||
tokencopied = true;
|
tokencopied = true;
|
||||||
}
|
}
|
||||||
else
|
//else
|
||||||
clone = MTGCollection()->getCardById(_target->copiedID);
|
//clone = MTGCollection()->getCardById(_target->copiedID);
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
MTGCardInstance * myClone = NEW MTGCardInstance(clone, source->controller()->game);
|
//MTGCardInstance * myClone = NEW MTGCardInstance(clone, source->controller()->game);
|
||||||
//source->copy(myClone);
|
source->copy(_target->clone());
|
||||||
if(source->controller()->playMode != Player::MODE_TEST_SUITE)
|
//SAFE_DELETE(myClone);
|
||||||
{
|
|
||||||
source->setMTGId(myClone->getMTGId());
|
|
||||||
source->setId = myClone->setId;
|
|
||||||
source->setRarity(myClone->getRarity());
|
|
||||||
}
|
|
||||||
source->name = myClone->name;
|
|
||||||
source->setName(myClone->name);
|
|
||||||
source->getManaCost()->resetCosts();
|
|
||||||
if(myClone->getManaCost())
|
|
||||||
source->getManaCost()->copy(myClone->getManaCost());
|
|
||||||
source->colors = myClone->colors;
|
|
||||||
source->types = myClone->types;
|
|
||||||
source->text = myClone->text;
|
|
||||||
source->formattedText = myClone->formattedText;
|
|
||||||
source->basicAbilities = myClone->model->data->basicAbilities;
|
|
||||||
source->modbasicAbilities = myClone->modbasicAbilities;
|
|
||||||
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 = myClone->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)
|
|
||||||
{
|
|
||||||
a->resolve();
|
|
||||||
SAFE_DELETE(a);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
a->addToGame();
|
|
||||||
MayAbility * dontAdd = dynamic_cast<MayAbility*>(a);
|
|
||||||
if(!dontAdd)
|
|
||||||
{
|
|
||||||
source->cardsAbilities.push_back(a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//power
|
|
||||||
int powerMod = 0;
|
|
||||||
int toughMod = 0;
|
|
||||||
bool powerlessThanOriginal = false;
|
|
||||||
bool toughLessThanOriginal = false;
|
|
||||||
if(source->power < source->origpower)
|
|
||||||
{
|
|
||||||
powerMod = source->origpower - source->power;
|
|
||||||
powerlessThanOriginal = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
powerMod =source->power - source->origpower;
|
|
||||||
}
|
|
||||||
//toughness
|
|
||||||
if(source->toughness <= source->origtoughness)
|
|
||||||
{
|
|
||||||
toughMod = source->origtoughness - source->toughness;
|
|
||||||
toughLessThanOriginal = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
toughMod =source->toughness - source->origtoughness;
|
|
||||||
}
|
|
||||||
if(!source->isCDA)
|
|
||||||
{
|
|
||||||
source->power = powerlessThanOriginal?myClone->power - powerMod:myClone->power + powerMod;
|
|
||||||
source->life = toughLessThanOriginal?myClone->toughness - toughMod:myClone->toughness + toughMod;
|
|
||||||
source->toughness = toughLessThanOriginal?myClone->toughness - toughMod:myClone->toughness + toughMod;
|
|
||||||
source->origpower = myClone->origpower;
|
|
||||||
source->origtoughness = myClone->origtoughness;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{//pbonus & tbonus are already computed except damage taken...
|
|
||||||
source->life -= source->damageCount;
|
|
||||||
}
|
|
||||||
SAFE_DELETE(myClone);
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
source->isACopier = true;
|
source->isACopier = true;
|
||||||
source->hasCopiedToken = tokencopied;
|
source->hasCopiedToken = tokencopied;
|
||||||
@@ -1604,7 +1520,7 @@ int AACopier::resolve()
|
|||||||
andAbilityClone->addToGame();
|
andAbilityClone->addToGame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
source->mPropertiesChangedSinceLastUpdate = true;
|
//source->mPropertiesChangedSinceLastUpdate = true;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user