Persist and Undying goes to the stack
This commit is contained in:
@@ -1772,7 +1772,9 @@ public:
|
||||
string destination;
|
||||
MTGAbility * andAbility;
|
||||
string named;
|
||||
AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string _name, ManaCost * _cost = NULL);
|
||||
bool undying;
|
||||
bool persist;
|
||||
AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string _name, ManaCost * _cost = NULL, bool undying = false, bool persist = false);
|
||||
MTGGameZone * destinationZone(Targetable * target = NULL);
|
||||
int resolve();
|
||||
const string getMenuText();
|
||||
|
||||
@@ -2734,8 +2734,8 @@ AInstantCastRestrictionUEOT::~AInstantCastRestrictionUEOT()
|
||||
|
||||
|
||||
//AAMover
|
||||
AAMover::AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string newName, ManaCost * _cost) :
|
||||
ActivatedAbility(observer, _id, _source, _cost, 0), destination(dest),named(newName)
|
||||
AAMover::AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string newName, ManaCost * _cost, bool undying, bool persist) :
|
||||
ActivatedAbility(observer, _id, _source, _cost, 0), destination(dest),named(newName),undying(undying),persist(persist)
|
||||
{
|
||||
if (_target)
|
||||
target = _target;
|
||||
@@ -2782,6 +2782,10 @@ int AAMover::resolve()
|
||||
andAbilityClone->addToGame();
|
||||
}
|
||||
}
|
||||
if(persist)
|
||||
spell->source->counters->addCounter(-1,-1);
|
||||
if(undying)
|
||||
spell->source->counters->addCounter(1,1);
|
||||
delete spell;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2289,19 +2289,28 @@ int MTGPersistRule::receiveEvent(WEvent * event)
|
||||
Player * p = game->players[i];
|
||||
if (e->to == p->game->graveyard)
|
||||
{
|
||||
MTGCardInstance * copy = p->game->putInZone(e->card, p->game->graveyard, e->card->owner->game->temp);
|
||||
MTGCardInstance * copy = e->card;
|
||||
if (!copy)
|
||||
{
|
||||
DebugTrace("MTGRULES: couldn't move card for persist/undying");
|
||||
return 0;
|
||||
}
|
||||
Spell * spell = NEW Spell(game, copy);
|
||||
spell->resolve();
|
||||
string code = "";
|
||||
bool persist = false;
|
||||
bool undying = false;
|
||||
if(card->basicAbilities[(int)Constants::PERSIST])
|
||||
spell->source->counters->addCounter(-1, -1);
|
||||
{
|
||||
code = "Persist";
|
||||
persist = true;
|
||||
}
|
||||
else
|
||||
spell->source->counters->addCounter(1,1);
|
||||
delete spell;
|
||||
{
|
||||
code = "Undying";
|
||||
undying = true;
|
||||
}
|
||||
AAMover *putinplay = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), copy, copy,"ownerbattlefield",code,NULL,undying,persist);
|
||||
putinplay->oneShot = true;
|
||||
putinplay->fireAbility();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user