Fixed primitives, added new ability "exploits" to sacrifice a creature, added new trigger "exploited" and improved all primitives with Exploit ability, improved "tokencreated" and "sacrificed" triggers to allow "turnlimited" option, improved "flip" ability in order to keep track of current zone before flip.
This commit is contained in:
@@ -937,7 +937,9 @@ class TrTokenCreated: public Trigger
|
||||
{
|
||||
public:
|
||||
bool thiscontroller, thisopponent;
|
||||
TrTokenCreated(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false) :
|
||||
bool limitOnceATurn;
|
||||
int triggeredTurn;
|
||||
TrTokenCreated(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false, bool limitOnceATurn = false) :
|
||||
Trigger(observer, id, source,once, tc)
|
||||
{
|
||||
}
|
||||
@@ -946,7 +948,10 @@ public:
|
||||
{
|
||||
WEventTokenCreated * e = dynamic_cast<WEventTokenCreated *> (event);
|
||||
if (!e) return 0;
|
||||
if (limitOnceATurn && triggeredTurn == game->turn)
|
||||
return 0;
|
||||
if (!tc->canTarget(e->card)) return 0;
|
||||
triggeredTurn = game->turn;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -959,7 +964,9 @@ public:
|
||||
class TrCardSacrificed: public Trigger
|
||||
{
|
||||
public:
|
||||
TrCardSacrificed(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false) :
|
||||
bool limitOnceATurn;
|
||||
int triggeredTurn;
|
||||
TrCardSacrificed(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false, bool limitOnceATurn = false) :
|
||||
Trigger(observer, id, source, once, tc)
|
||||
{
|
||||
}
|
||||
@@ -968,6 +975,8 @@ public:
|
||||
{
|
||||
WEventCardSacrifice * e = dynamic_cast<WEventCardSacrifice *> (event);
|
||||
if (!e) return 0;
|
||||
if (limitOnceATurn && triggeredTurn == game->turn)
|
||||
return 0;
|
||||
MTGCardInstance * check = e->cardAfter;
|
||||
MTGGameZone * oldZone = e->cardAfter->currentZone;
|
||||
check->currentZone = check->previousZone;
|
||||
@@ -983,6 +992,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
check->currentZone = oldZone;
|
||||
triggeredTurn = game->turn;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -992,6 +1002,47 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class TrCardExploited: public Trigger
|
||||
{
|
||||
public:
|
||||
bool limitOnceATurn;
|
||||
int triggeredTurn;
|
||||
TrCardExploited(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false, bool limitOnceATurn = false) :
|
||||
Trigger(observer, id, source, once, tc)
|
||||
{
|
||||
}
|
||||
|
||||
int triggerOnEventImpl(WEvent * event)
|
||||
{
|
||||
WEventCardExploited * e = dynamic_cast<WEventCardExploited *> (event);
|
||||
if (!e) return 0;
|
||||
if (limitOnceATurn && triggeredTurn == game->turn)
|
||||
return 0;
|
||||
MTGCardInstance * check = e->cardAfter;
|
||||
MTGGameZone * oldZone = e->cardAfter->currentZone;
|
||||
check->currentZone = check->previousZone;
|
||||
if (check->next && (check->next->currentZone|| check->isToken))
|
||||
{
|
||||
check = e->cardAfter->next;
|
||||
oldZone = e->cardAfter->next->currentZone;
|
||||
check->currentZone = e->cardAfter->next->previousZone;
|
||||
}
|
||||
if (!tc->canTarget(check,true))
|
||||
{
|
||||
check->currentZone = oldZone;
|
||||
return 0;
|
||||
}
|
||||
check->currentZone = oldZone;
|
||||
triggeredTurn = game->turn;
|
||||
return 1;
|
||||
}
|
||||
|
||||
TrCardExploited * clone() const
|
||||
{
|
||||
return NEW TrCardExploited(*this);
|
||||
}
|
||||
};
|
||||
|
||||
class TrCardDiscarded: public Trigger
|
||||
{
|
||||
public:
|
||||
@@ -1732,6 +1783,7 @@ class AASacrificeCard: public ActivatedAbility
|
||||
{
|
||||
public:
|
||||
MTGAbility * andAbility;
|
||||
bool isExploited;
|
||||
AASacrificeCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
|
||||
int resolve();
|
||||
const string getMenuText();
|
||||
|
||||
@@ -195,6 +195,13 @@ struct WEventCardSacrifice : public WEventCardUpdate {
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card is exploited.
|
||||
struct WEventCardExploited : public WEventCardUpdate {
|
||||
MTGCardInstance * cardAfter;
|
||||
WEventCardExploited(MTGCardInstance * card,MTGCardInstance * afterCard);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card is discarded.
|
||||
struct WEventCardDiscard : public WEventCardUpdate {
|
||||
WEventCardDiscard(MTGCardInstance * card);
|
||||
|
||||
Reference in New Issue
Block a user