Add support for Amonkhet Mechanics

and fix some cards.
Added exerted trigger, event and add removemc keyword inside transforms
ability so we can soft code Embalm and Eternalize...
This commit is contained in:
Anthony Calosa
2017-08-03 09:49:37 +08:00
parent 1f670b9919
commit 6bd09e42e0
11 changed files with 166 additions and 34 deletions

View File

@@ -1406,6 +1406,28 @@ public:
}
};
class TrCardExerted: public Trigger
{
public:
TrCardExerted(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false) :
Trigger(observer, id, source, once, tc)
{
}
int triggerOnEventImpl(WEvent * event)
{
WEventCardExerted * e = dynamic_cast<WEventCardExerted *> (event);
if (!e) return 0;
if (!tc->canTarget(e->card)) return 0;
return 1;
}
TrCardExerted * clone() const
{
return NEW TrCardExerted(*this);
}
};
class TrCombatTrigger: public Trigger
{
public:
@@ -5174,6 +5196,7 @@ public:
list<int> oldcolors;
list<int> oldtypes;
vector<int> dontremove;
bool removemc;
bool addNewColors;
bool remove;
bool removeCreatureSubtypes;
@@ -7290,6 +7313,57 @@ public:
return NEW AProvoke(*this);
}
};
//exert
class AExert: public InstantAbility
{
public:
MTGAbility * andAbility;
AExert(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target) :
InstantAbility(observer, _id, _source)
{
target = _target;
andAbility = NULL;
}
int resolve()
{
MTGCardInstance * card = (MTGCardInstance *) target;
if (card)
{
card->exerted = true;
WEvent * e = NEW WEventCardExerted(card);
game->receiveEvent(e);
if(andAbility)
{
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = card;
if(andAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
}
}
return 1;
}
const string getMenuText()
{
return "Exert";
}
virtual ostream& toString(ostream& out) const
{
out << "AAExert ::: (";
return InstantAbility::toString(out) << ")";
}
AExert * clone() const
{
return NEW AExert(*this);
}
};
//------------------
//trigger regen
class ATriggerRegen: public InstantAbility

View File

@@ -90,6 +90,7 @@ public:
bool blinked;
bool isExtraCostTarget;
bool morphed;
bool exerted;
bool turningOver;
bool isMorphed;
bool isFlipped;

View File

@@ -205,6 +205,12 @@ struct WEventCardCycle : public WEventCardUpdate {
virtual Targetable * getTarget(int target);
};
//event when card is exerted.
struct WEventCardExerted : public WEventCardUpdate {
WEventCardExerted(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//Event when a card's "defenser" status changes
//before : attacker that card was blocking previously
//after: attacker that card is blocking now