rebounded trigger

for use with rebound cards only
This commit is contained in:
Anthony Calosa
2016-08-25 22:25:34 +08:00
parent 5b49530df9
commit f3dd1be125
2 changed files with 44 additions and 0 deletions

View File

@@ -1112,6 +1112,13 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
}
}
//rebound trigger controller upkeep...
found = s.find("rebounded");
if (found != string::npos)
{
return NEW TriggerRebound(observer, id, card, target, 2, 1,sourceUntapped,once);
}
return NULL;
}
@@ -6046,6 +6053,30 @@ TriggerNextPhase* TriggerNextPhase::clone() const
return NEW TriggerNextPhase(*this);
}
TriggerRebound::TriggerRebound(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, int _phaseId, int who,bool sourceUntapped, bool sourceTap,bool once) :
TriggerAtPhase(observer, id, source, target, _phaseId, who, sourceUntapped, sourceTap, once)
{
destroyActivated = 0;
activeTrigger = true;
}
int TriggerRebound::testDestroy()
{
if(newPhase <= phaseId && !destroyActivated && game->currentPlayer == source->controller())
destroyActivated=1;
if(destroyActivated > 1||(newPhase > phaseId && destroyActivated))
{
destroyActivated++;
return 1;
}
return 0;
}
TriggerRebound* TriggerRebound::clone() const
{
return NEW TriggerRebound(*this);
}
GenericTriggeredAbility::GenericTriggeredAbility(GameObserver* observer, int id, MTGCardInstance * _source, TriggeredAbility * _t, MTGAbility * a,
MTGAbility * dc, Targetable * _target) :
TriggeredAbility(observer, id, _source, _target), NestedAbility(a)