Fixed primitives, added new macro "_TRAINING_" for new ability "Training", added new trigger "trained", added "trainer" restriction to check if player controls an attacking creature with greater power than the current one, improved "ninjutsu" ability when the targeted card is already in play (e.g. "Olivia, Crimson Bride"), improved "flip" ability in order to add the "andability" option and in ordeer to prevent flipped auras go to graveyard, improved "andability" option for "imprint", "haunt" and "conjure" ability, improved "retarget" and "newtarget" keywords with "fromplay" option (to use with flipped auras e.g. "Vengeful Strangler"), replaced old "praidcount" and "oraidcount" with new keywords "pattackedcount" and "oattackedcount".

This commit is contained in:
Vittorio Alfieri
2021-10-31 21:40:37 +01:00
parent 051f498e54
commit 3baa6acaaf
11 changed files with 262 additions and 57 deletions

View File

@@ -772,6 +772,33 @@ public:
}
};
class TrCardTrained: public Trigger
{
public:
bool limitOnceATurn;
int triggeredTurn;
TrCardTrained(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false, bool limitOnceATurn = false) :
Trigger(observer, id, source,once, tc),limitOnceATurn(limitOnceATurn)
{
}
int triggerOnEventImpl(WEvent * event)
{
WEventCardTrained * e = dynamic_cast<WEventCardTrained *> (event);
if (!e) return 0;
if (limitOnceATurn && triggeredTurn == game->turn)
return 0;
if (!tc->canTarget(e->card)) return 0;
triggeredTurn = game->turn;
return 1;
}
TrCardTrained * clone() const
{
return NEW TrCardTrained(*this);
}
};
class TrCardScryed: public Trigger
{
public:
@@ -1582,6 +1609,17 @@ public:
AAHaunt * clone() const;
~AAHaunt();
};
//AATrain
class AATrain: public ActivatedAbility
{
public:
MTGAbility * andAbility;
AATrain(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
int resolve();
const string getMenuText();
AATrain * clone() const;
~AATrain();
};
//AAConjure
class AAConjure: public ActivatedAbility
{
@@ -1750,18 +1788,21 @@ public:
int resolve()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if(!_target)
return 0;
MTGCardInstance * copy = _target->controller()->game->putInZone(_target,_target->currentZone,
source->controller()->game->temp);
Spell * spell = NEW Spell(game, copy);
spell->resolve();
MTGCardInstance * newcard = spell->source;
MTGCardInstance * _target = (MTGCardInstance *) target;
if(!_target)
return 0;
MTGCardInstance * newcard = _target;
Spell * spell = NULL;
if(_target->currentZone != _target->controller()->game->battlefield){ // If the card is already in play no need to recast a spell (e.g. "Olivia, Crimson Bride").
MTGCardInstance * copy = _target->controller()->game->putInZone(_target,_target->currentZone, source->controller()->game->temp);
spell = NEW Spell(game, copy);
spell->resolve();
newcard = spell->source;
}
newcard->summoningSickness = 0;
newcard->tap();
newcard->setAttacker(1);
delete spell;
SAFE_DELETE(spell);
return 1;
}
@@ -4359,11 +4400,12 @@ public:
class AANewTarget: public ActivatedAbility
{
public:
bool retarget;
bool reequip;
bool newhook;
int mutation;
AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, bool retarget = false, ManaCost * _cost = NULL, bool reequip = false, bool newhook = false, int mutation = 0);
bool retarget;
bool reequip;
bool newhook;
int mutation;
bool fromplay;
AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL, bool retarget = false, bool reequip = false, bool newhook = false, int mutation = 0, bool fromplay = false);
int resolve();
const string getMenuText();
AANewTarget * clone() const;
@@ -4419,6 +4461,7 @@ public:
class AAFlip: public InstantAbility
{
public:
MTGAbility * andAbility;
vector<MTGAbility *> currentAbilities;
string flipStats;
bool isflipcard;
@@ -4430,6 +4473,7 @@ public:
int testDestroy();
const string getMenuText();
AAFlip * clone() const;
~AAFlip();
};
/* dynamic ability build*/
class AADynamic: public ActivatedAbility

View File

@@ -332,7 +332,8 @@ class Constants
HASAFTERMATH = 205,
NOENTERTRG = 206,
NODIETRG = 207,
NB_BASIC_ABILITIES = 208,
TRAINING = 208,
NB_BASIC_ABILITIES = 209,
RARITY_S = 'S', //Special Rarity
RARITY_M = 'M', //Mythics

View File

@@ -395,6 +395,12 @@ struct WEventCardForetold : public WEventCardUpdate {
virtual Targetable * getTarget(int target);
};
//training event
struct WEventCardTrained : public WEventCardUpdate {
WEventCardTrained(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//scry event
struct WEventCardScryed : public WEventCardUpdate {
WEventCardScryed(MTGCardInstance * card);