added new legend & pw rule, trigger & event

added new pw & legend rule (i just leave the old rules behind and
disabled it), added phasesin, faceup, copiedacard event, added facedup &
phasedin trigger.
This commit is contained in:
Anthony Calosa
2017-02-16 21:26:03 +08:00
parent da874738d6
commit 5e46016c4d
12 changed files with 408 additions and 73 deletions

View File

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

View File

@@ -253,6 +253,7 @@ public:
int LKIpower;
int LKItoughness;
int countDuplicateCardNames();
int countDuplicateCardTypes();
void cdaPT(int p = 0, int t = 0);
bool isCDA;
void switchPT(bool apply = false);

View File

@@ -421,7 +421,36 @@ public:
int receiveEvent(WEvent * event);
virtual MTGTokensCleanup * clone() const;
};
//New Legend Rule
class MTGNewLegend: public PermanentAbility
{
public:
TargetChooser * tcL;
MTGAbility * Legendrule;
MTGAbility * LegendruleAbility;
MTGAbility * LegendruleGeneric;
//vector<MTGCardInstance *> list;
MTGNewLegend(GameObserver* observer, int _id);
int CheckLegend(MTGCardInstance * card);
void MoveLegend(MTGCardInstance * card);
int receiveEvent(WEvent * event);
virtual MTGNewLegend * clone() const;
};
//New Planeswalker Rule
class MTGNewPlaneswalker: public PermanentAbility
{
public:
TargetChooser * tcP;
MTGAbility * PWrule;
MTGAbility * PWruleAbility;
MTGAbility * PWruleGeneric;
//vector<MTGCardInstance *> list;
MTGNewPlaneswalker(GameObserver* observer, int _id);
int CheckPW(MTGCardInstance * card);
void MovePW(MTGCardInstance * card);
int receiveEvent(WEvent * event);
virtual MTGNewPlaneswalker * clone() const;
};
/*
* 704.5k If a player controls two or more legendary permanents with the same name,
* that player chooses one of them, and the rest are put into their owners graveyards.
@@ -430,10 +459,6 @@ public:
class MTGLegendRule: public ListMaintainerAbility
{
public:
TargetChooser * tcL;
MTGAbility * Legendrule;
MTGAbility * LegendruleAbility;
MTGAbility * LegendruleGeneric;
MTGLegendRule(GameObserver* observer, int _id);
int canBeInList(MTGCardInstance * card);
int added(MTGCardInstance * card);
@@ -445,10 +470,6 @@ public:
class MTGPlaneWalkerRule: public ListMaintainerAbility
{
public:
TargetChooser * tcP;
MTGAbility * PWrule;
MTGAbility * PWruleAbility;
MTGAbility * PWruleGeneric;
MTGPlaneWalkerRule(GameObserver* observer, int _id);
int canBeInList(MTGCardInstance * card);
int added(MTGCardInstance * card);

View File

@@ -305,12 +305,30 @@ struct WEventCardControllerChange : public WEventCardUpdate {
virtual Targetable * getTarget(int target);
};
//event when card with phases in
struct WEventCardPhasesIn : public WEventCardUpdate {
WEventCardPhasesIn(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//event when card with morph faces up
struct WEventCardFaceUp : public WEventCardUpdate {
WEventCardFaceUp(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//event when card transforms
struct WEventCardTransforms : public WEventCardUpdate {
WEventCardTransforms(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//event when card copies a card
struct WEventCardCopiedACard : public WEventCardUpdate {
WEventCardCopiedACard(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//alterenergy event
struct WEventplayerEnergized : public WEvent {
WEventplayerEnergized(Player * player,int nb_count);