Revert my Graphic changes

I think it's the one who cause those crashes
This commit is contained in:
Anthony Calosa
2016-08-13 16:45:46 +08:00
parent f1bc268f58
commit 8530292fef
32 changed files with 233 additions and 453 deletions
+25 -53
View File
@@ -401,8 +401,8 @@ void MTGRevealingCards::Render()
{
if (!revealDisplay)
return;
CheckUserInput(mEngine->ReadButton());
revealDisplay->CheckUserInput(mEngine->ReadButton());
CheckUserInput(mEngine->ReadButton());
revealDisplay->CheckUserInput(mEngine->ReadButton());
revealDisplay->Render();
return;
}
@@ -1459,23 +1459,28 @@ AACopier::AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, M
int AACopier::resolve()
{
bool tokencopied = false;
AbilityFactory af(game);
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target)
{
//MTGCard* clone;
//AbilityFactory af(game);
if(_target->isToken || (_target->isACopier && _target->hasCopiedToken))
{//fix crash when copying token
//clone = _target;
tokencopied = true;
}
//else
//clone = MTGCollection()->getCardById(_target->copiedID);
///////////////////////////////////////////////////////////////////////
//MTGCardInstance * myClone = NEW MTGCardInstance(clone, source->controller()->game);
if(tokencopied)
source->copy(_target->clone());
//SAFE_DELETE(myClone);
///////////////////////////////////////////////////////////////////////
else
{
if(!_target->isACopier)
source->copy(_target);
else
{
source->copy(_target);
source->power -= _target->pbonus;
source->toughness -= _target->tbonus;
source->life = source->toughness;
}
}
source->isACopier = true;
source->hasCopiedToken = tokencopied;
source->copiedID = _target->copiedID;
@@ -1643,10 +1648,8 @@ AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, M
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if(_target->isFlipped && _target->hasType(Subtypes::TYPE_PLANESWALKER))//is flipping pw
{
this->forceDestroy = 1;
return 0;
}
AbilityFactory af(game);
if(counterstring.size())
{
@@ -2763,12 +2766,10 @@ int AASacrificeCard::resolve()
{
Player * p = _target->controller();
MTGCardInstance * beforeCard = _target;
WEvent * e;
p->game->putInGraveyard(_target);
while(_target->next)
_target = _target->next;
bool cardIsToken = _target->isToken ? true : false;
e = NEW WEventCardSacrifice(beforeCard, _target, cardIsToken);
WEvent * e = NEW WEventCardSacrifice(beforeCard,_target);
game->receiveEvent(e);
if(andAbility)
{
@@ -3209,20 +3210,9 @@ int AAFlip::resolve()
game->removeObserver(this);
return 0;
}
//701.25a Only permanents represented by double-faced cards can transform.
//(See rule 711, “Double-Faced Cards.”) If a spell or ability instructs a player
//to transform any permanent that isnt represented by a double-faced card, nothing happens.
//***Copier and Tokens cannot transform but can be flip since flip cards are single sided***
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target)
{
if((_target->isACopier||_target->isToken||_target->has(Constants::CANTTRANSFORM)) && !isflipcard && !forcedcopy)
{
game->removeObserver(this);
return 0;
}
while (_target->next)
_target = _target->next;
@@ -3250,10 +3240,9 @@ int AAFlip::resolve()
_target->text = myFlip->text;
_target->formattedText = myFlip->formattedText;
_target->basicAbilities = myFlip->model->data->basicAbilities;
_target->modbasicAbilities = myFlip->modbasicAbilities;
cdaDamage = _target->damageCount;
_target->copiedID = myFlip->getMTGId();//for copier
if(forcedcopy && _target->owner->playMode != Player::MODE_TEST_SUITE)
if(_target->owner->playMode != Player::MODE_TEST_SUITE)
{
_target->setMTGId(myFlip->getMTGId());
_target->setId = myFlip->setId;
@@ -3980,10 +3969,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);
@@ -3992,11 +3981,6 @@ int AACloner::resolve()
{
spell->source->addType(*it);
}
for(int k = 0; k < Constants::NB_BASIC_ABILITIES; k++)
{
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();
@@ -7720,24 +7704,12 @@ int AACastCard::resolveSpell()
if (game->targetChooser)
{
game->targetChooser->Owner = source->controller();
if(putinplay)
{
spell = NEW Spell(game, 0,copy,game->targetChooser,NULL, 1);
spell->resolve();
}
else
spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, NULL, 1, 0);
spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, NULL, 1, 0);
game->targetChooser = NULL;
}
else
{
if(putinplay)
{
spell = NEW Spell(game, 0,copy,NULL,NULL, 1);
spell->resolve();
}
else
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, NULL, 1, 0);
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, NULL, 1, 0);
}
if (copy->has(Constants::STORM))