Coded the initiative ability from CLB set, added some condition to test if a card has been casted from exile or sideboard or commandzone.

This commit is contained in:
Vittorio Alfieri
2023-05-04 14:56:04 +02:00
parent 509e25d4cc
commit 0efc61fda7
9 changed files with 170 additions and 0 deletions

View File

@@ -607,6 +607,35 @@ public:
}
};
class TrplayerInitiative: public Trigger
{
public:
bool thiscontroller, thisopponent;
TrplayerInitiative(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false, bool thiscontroller = false, bool thisopponent = false) :
Trigger(observer, id, source, once, tc), thiscontroller(thiscontroller), thisopponent(thisopponent)
{
}
int triggerOnEventImpl(WEvent * event)
{
WEventplayerInitiative * e = dynamic_cast<WEventplayerInitiative *> (event);
if (!e) return 0;
if (!tc->canTarget(e->player)) return 0;
if(thiscontroller)
if(e->player != source->controller())
return 0;
if(thisopponent)
if(e->player == source->controller())
return 0;
return 1;
}
TrplayerInitiative * clone() const
{
return NEW TrplayerInitiative(*this);
}
};
class TrplayerShuffled: public Trigger
{
public:
@@ -4367,6 +4396,18 @@ public:
AAAlterMonarch * clone() const;
~AAAlterMonarch();
};
//Initiative
class AAAlterInitiative: public ActivatedAbilityTP
{
public:
AAAlterInitiative(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET);
int resolve();
const string getMenuText();
AAAlterInitiative * clone() const;
~AAAlterInitiative();
};
//Surveil Offset
class AAAlterSurveilOffset: public ActivatedAbilityTP
{

View File

@@ -48,6 +48,7 @@ public:
int dungeonCompleted;
int numOfCommandCast;
int monarch;
int initiative;
int surveilOffset;
int devotionOffset;
int lastShuffleTurn;

View File

@@ -385,6 +385,14 @@ struct WEventplayerMonarch : public WEvent {
virtual Targetable * getTarget(Player * player);
};
//initiative event
struct WEventplayerInitiative : public WEvent {
WEventplayerInitiative(Player * player);
Player * player;
using WEvent::getTarget;
virtual Targetable * getTarget(Player * player);
};
//shuffle event
struct WEventplayerShuffled : public WEvent {
WEventplayerShuffled(Player * player);