Phase out Event & Trigger

This commit is contained in:
Anthony Calosa
2017-02-17 14:25:33 +08:00
parent 95b81b6425
commit ba40253a46
6 changed files with 50 additions and 1 deletions

View File

@@ -1332,6 +1332,28 @@ public:
}
};
class TrCardPhasesOut: public Trigger
{
public:
TrCardPhasesOut(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false) :
Trigger(observer, id, source, once, tc)
{
}
int triggerOnEventImpl(WEvent * event)
{
WEventCardPhasesOut * e = dynamic_cast<WEventCardPhasesOut *> (event);
if (!e) return 0;
if (!tc->canTarget(e->card)) return 0;
return 1;
}
TrCardPhasesOut * clone() const
{
return NEW TrCardPhasesOut(*this);
}
};
class TrCardPhasesIn: public Trigger
{
public:

View File

@@ -305,7 +305,13 @@ struct WEventCardControllerChange : public WEventCardUpdate {
virtual Targetable * getTarget(int target);
};
//event when card with phases in
//event when card phases out
struct WEventCardPhasesOut : public WEventCardUpdate {
WEventCardPhasesOut(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//event when card phases in
struct WEventCardPhasesIn : public WEventCardUpdate {
WEventCardPhasesIn(MTGCardInstance * card);
virtual Targetable * getTarget(int target);