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

@@ -15,6 +15,9 @@
# Dies, Evergreen
#AUTO_DEFINE _DIES_ @movedTo(this|graveyard) from(battlefield):
# Training
#AUTO_DEFINE _TRAINING_ @combat(attacking) source(this) restriction{trainer}:name(Training) dotrain
# Goad
#AUTO_DEFINE _GOAD_ transforms((,newability[counter(0/0.1.Goaded)],newability[this(counter{0/0.1.Goaded}>0) mustattack],newability[phaseaction[endofturn next once sourceinplay] removeallcounters(0/0.-1.Goaded)])) forever

View File

@@ -1506,7 +1506,7 @@ name=Amphin Mutineer
auto=if type(creature[-salamander]|opponentbattlefield)~morethan~0 then choice name(Exile opponent's creature) name(Exile opponent's creature) moveto(exile) target(creature[-salamander]|opponentbattlefield) && token(Salamander Warrior,Creature Salamander Warrior,4/3,blue) opponent
auto=if type(creature[-salamander]|myBattlefield)~morethan~0 then choice name(Exile your creature) name(Exile your creature) moveto(exile) target(creature[-salamander]|mybattlefield) && token(Salamander Warrior,Creature Salamander Warrior,4/3,blue)
auto=choice name(Don't exile any creature) name(Don't exile any creature) donothing
autograveyard={4}{U}{U}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(unearth,haste,mustattack))! asSorcery
autograveyard={4}{U}{U}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(treason,haste,mustattack))! asSorcery
text=When Amphin Mutineer enters the battlefield, exile up to one target non-Salamander creature. That creature's controller creates a 4/3 blue Salamander Warrior creature token. -- Encore {4}{U}{U} ({4}{U}{U}, Exile this card from your graveyard: For each opponent, create a token copy that attacks that opponent this turn if able. They gain haste. Sacrifice them at the beginning of the next end step. Activate only as a sorcery.)
mana={3}{U}
type=Creature
@@ -8283,7 +8283,7 @@ toughness=3
[card]
name=Briarblade Adept
auto=_ATTACKING_target(creature|opponentbattlefield) -1/-1 ueot
autograveyard={3}{B}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(unearth,haste,mustattack))! asSorcery
autograveyard={3}{B}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(treason,haste,mustattack))! asSorcery
text=Whenever Briarblade Adept attacks, target creature an opponent controls gets -1/-1 until end of turn. -- Encore {3}{B} ({3}{B}, Exile this card from your graveyard: For each opponent, create a token copy that attacks that opponent this turn if able. They gain haste. Sacrifice them at the beginning of the next end step. Activate only as a sorcery.)
mana={4}{B}
type=Creature
@@ -12165,7 +12165,7 @@ toughness=5
name=Coastline Marauders
abilities=trample
auto=_ATTACKING_type:land:opponentbattlefield/0 ueot
autograveyard={4}{R}{R}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(unearth,haste,mustattack))! asSorcery
autograveyard={4}{R}{R}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(treason,haste,mustattack))! asSorcery
text=Trample -- Whenever Coastline Marauders attacks, it gets +1/+0 until end of turn for each land defending player controls. -- Encore {4}{R}{R} ({4}{R}{R}, Exile this card from your graveyard: For each opponent, create a token copy that attacks that opponent this turn if able. They gain haste. Sacrifice them at the beginning of the next end step. Activate only as a sorcery.)
mana={2}{R}
type=Creature
@@ -20560,7 +20560,7 @@ toughness=1
name=Elvish Dreadlord
abilities=deathtouch
auto=@movedto(this|ownergraveyard) from(battlefield):all(creature[-elf]|battlefield) -3/-3 ueot
autograveyard={5}{B}{B}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(unearth,haste,mustattack))! asSorcery
autograveyard={5}{B}{B}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(treason,haste,mustattack))! asSorcery
text=Deathtouch -- When Elvish Dreadlord dies, non-Elf creatures get -3/-3 until end of turn. -- Encore {5}{B}{B} ({5}{B}{B}, Exile this card from your graveyard: For each opponent, create a token copy that attacks that opponent this turn if able. They gain haste. Sacrifice them at the beginning of the next end step. Activate only as a sorcery.)
mana={3}{B}{B}
type=Creature
@@ -22268,7 +22268,7 @@ type=Sorcery
[card]
name=Exquisite Huntmaster
auto=_DIES_token(Elf Warrior,Creature Elf Warrior,1/1,green)
autograveyard={4}{B}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(unearth,haste,mustattack))! asSorcery
autograveyard={4}{B}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(treason,haste,mustattack))! asSorcery
text=When Exquisite Huntmaster dies, create a 1/1 green Elf Warrior creature token. -- Encore {4}{B} ({4}{B}, Exile this card from your graveyard: For each opponent, create a token copy that attacks that opponent this turn if able. They gain haste. Sacrifice them at the beginning of the next end step. Activate only as a sorcery.)
mana={3}{B}
type=Creature
@@ -23055,7 +23055,7 @@ toughness=2
[card]
name=Fathom Fleet Swordjack
auto=_ATTACKING_target(planeswalker,player) damage:type:artifact:mybattlefield
autograveyard={5}{R}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(unearth,haste,mustattack))! asSorcery
autograveyard={5}{R}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(treason,haste,mustattack))! asSorcery
text=Whenever Fathom Fleet Swordjack attacks, it deals damage to the player or planeswalker it's attacking equal to the number of artifacts you control. -- Encore {5}{R} ({5}{R}, Exile this card from your graveyard: For each opponent, create a token copy that attacks that opponent this turn if able. They gain haste. Sacrifice them at the beginning of the next end step. Activate only as a sorcery.)
mana={3}{R}
type=Creature
@@ -23840,7 +23840,7 @@ toughness=3
[card]
name=Fin-Clade Fugitives
auto=cantbeblockedby(creature[power<=2])
autograveyard={4}{G}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(unearth,haste,mustattack))! asSorcery
autograveyard={4}{G}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(treason,haste,mustattack))! asSorcery
text=Fin-Clade Fugitives can't be blocked by creatures with power 2 or less. -- Encore {4}{G} ({4}{G}, Exile this card from your graveyard: For each opponent, create a token copy that attacks that opponent this turn if able. They gain haste. Sacrifice them at the beginning of the next end step. Activate only as a sorcery.)
mana={5}{G}
type=Creature
@@ -34075,7 +34075,7 @@ type=Sorcery
[card]
name=Impulsive Pilferer
auto=_DIES_token(Treasure Sur)
autograveyard={3}{R}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(unearth,haste,mustattack))! asSorcery
autograveyard={3}{R}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(treason,haste,mustattack))! asSorcery
text=When Impulsive Pilferer dies, create a Treasure token. (It's an artifact with " {T}, Sacrifice this artifact: Add one mana of any color.") -- Encore {3}{R} ({3}{R}, Exile this card from your graveyard: For each opponent, create a token copy that attacks that opponent this turn if able. They gain haste. Sacrifice them at the beginning of the next end step. Activate only as a sorcery.)
mana={R}
type=Creature
@@ -36589,7 +36589,7 @@ toughness=5
name=Kangee's Lieutenant
abilities=flying
auto=_ATTACKING_all(creature[attacking;flying]) 1/1 ueot
autograveyard={5}{W}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(unearth,haste,mustattack))! asSorcery
autograveyard={5}{W}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(treason,haste,mustattack))! asSorcery
text=Flying -- Whenever Kangee's Lieutenant attacks, attacking creatures with flying get +1/+1 until end of turn. -- Encore {5}{W} ({5}{W}, Exile this card from your graveyard: For each opponent, create a token copy that attacks that opponent this turn if able. They gain haste. Sacrifice them at the beginning of the next end step. Activate only as a sorcery.)
mana={2}{W}
type=Creature
@@ -37577,7 +37577,7 @@ toughness=2
[card]
name=Kinsbaile Courier
auto=counter(1/1) target(creature)
autograveyard={2}{W}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(unearth,haste,mustattack))! asSorcery
autograveyard={2}{W}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(treason,haste,mustattack))! asSorcery
text=When Kinsbaile Courier enters the battlefield, put a +1/+1 counter on target creature. -- Encore {2}{W} ({2}{W}, Exile this card from your graveyard: For each opponent, create a token copy that attacks that opponent this turn if able. They gain haste. Sacrifice them at the beginning of the next end step. Activate only as a sorcery.)
mana={2}{W}
type=Creature
@@ -37695,7 +37695,7 @@ toughness=2
name=Kitesail Skirmisher
abilities=flying
auto=_ATTACKING_name(Other creature gains flying) target(other creature|myBattlefield) transforms((,newability[flying])) ueot
autograveyard={4}{U}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(unearth,haste,mustattack))! asSorcery
autograveyard={4}{U}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(treason,haste,mustattack))! asSorcery
text=Flying -- Whenever Kitesail Skirmisher attacks, another target creature attacking the same player or planeswalker gains flying until end of turn. -- Encore {4}{U} ({4}{U}, Exile this card from your graveyard: For each opponent, create a token copy that attacks that opponent this turn if able. They gain haste. Sacrifice them at the beginning of the next end step. Activate only as a sorcery.)
mana={3}{U}
type=Creature
@@ -49932,7 +49932,7 @@ type=Artifact
[card]
name=Phyrexian Triniform
auto=_DIES_token(Golem,Creature Artifact Golem,3/3)*3
autograveyard={12}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(unearth,haste,mustattack))! asSorcery
autograveyard={12}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(treason,haste,mustattack))! asSorcery
text=When Phyrexian Triniform dies, create three 3/3 colorless Golem artifact creature tokens. -- Encore {12} ({12}, Exile this card from your graveyard: For each opponent, create a token copy that attacks that opponent this turn if able. They gain haste. Sacrifice them at the beginning of the next end step. Activate only as a sorcery.)
mana={9}
type=Artifact Creature
@@ -53148,7 +53148,7 @@ type=Instant
[card]
name=Rakshasa Debaser
auto=_ATTACKING_moveTo(myBattlefield) target(creature|opponentgraveyard)
autograveyard={6}{B}{B}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(unearth,haste,mustattack))! asSorcery
autograveyard={6}{B}{B}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(treason,haste,mustattack))! asSorcery
text=Whenever Rakshasa Debaser attacks, put target creature card from defending player's graveyard onto the battlefield under your control. -- Encore {6}{B}{B} ({6}{B}{B}, Exile this card from your graveyard: For each opponent, create a token copy that attacks that opponent this turn if able. They gain haste. Sacrifice them at the beginning of the next end step. Activate only as a sorcery.)
mana={4}{B}{B}
type=Creature
@@ -63856,7 +63856,7 @@ type=Sorcery
[card]
name=Soul of Eternity
anyzone=lifetotal/lifetotal cdaactive
autograveyard={7}{W}{W}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(unearth,haste,mustattack))! asSorcery
autograveyard={7}{W}{W}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(treason,haste,mustattack))! asSorcery
text=Soul of Eternity's power and toughness are each equal to your life total. -- Encore {7}{W}{W} ({7}{W}{W}, Exile this card from your graveyard: For each opponent, create a token copy that attacks that opponent this turn if able. They gain haste. Sacrifice them at the beginning of the next end step. Activate only as a sorcery.)
mana={5}{W}{W}
type=Creature
@@ -66739,9 +66739,8 @@ toughness=2
[/card]
[card]
name=Strangling Grasp
target=creature,planeswalker|opponentbattlefield
target=*[creature;planeswalker]|opponentbattlefield
backside=Vengeful Strangler
auto=@each my upkeep:ability$!name(Sacrifice a non-land permanent) name(Sacrifice a non-land permanent) target(*[-land]|mybattlefield) sacrifice and!( life:-1 controller )! !$ opponent
text=Enchant creature or planeswalker an opponent controls -- At the beginning of your upkeep, enchanted permanent's controller sacrifices a nonland permanent and loses 1 life. // Vengeful Strangler
type=Enchantment
subtype=Aura
@@ -72668,7 +72667,7 @@ toughness=4
[card]
name=Trove Tracker
auto=_DIES_draw:1 controller
autograveyard={5}{U}{U}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(unearth,haste,mustattack))! asSorcery
autograveyard={5}{U}{U}:name(Activate Encore) name(Activate Encore) moveto(exile) and!(clone with(treason,haste,mustattack))! asSorcery
text=When Trove Tracker dies, draw a card. -- Encore {5}{U}{U} ({5}{U}{U}, Exile this card from your graveyard: For each opponent, create a token copy that attacks that opponent this turn if able. They gain haste. Sacrifice them at the beginning of the next end step. Activate only as a sorcery.)
mana={2}{U}
type=Creature
@@ -75070,7 +75069,7 @@ abilities=cantblock
backside=Strangling Grasp
restriction=compare(isflipped)~equalto~0
anyzone={0}:doubleside(backside)
auto=_DIES_name(Return transformed) name(Return transformed) activate castcard(copied noevent named!:Strangling Grasp:!)
auto=_DIES_name(Return transformed) name(Return transformed) flip(backside) forcetype(Enchantment Aura) and!( transforms((,newability[name(Attach to creature or planeswalker) retargetfromplay target(*[creature;planeswalker]|opponentbattlefield)],newability[@each opponent upkeep:ability$!name(Sacrifice a non-land permanent) name(Sacrifice a non-land permanent) target(*[-land;-Strangling Grasp]|mybattlefield) sacrifice and!( life:-1 controller )! !$ controller])) forever )!
text=Vengeful Strangler can't block. -- When Vengeful Strangler dies, return it to the battlefield transformed under your control attached to target creature or planeswalker an opponent controls. // Strangling Grasp
mana={1}{B}
type=Creature
@@ -75080,7 +75079,7 @@ toughness=1
[/card]
[card]
name=Vengeful Warchief
auto=@lifelostof(player) restriction{compare(thatmuch)~equalto~compare(lifelost)} turnlimited:1/1
auto=@lifelostof(player) restriction{compare(thatmuch)~equalto~compare(lifelost)} turnlimited:name(Put 1/1 counter) counter(1/1)
text=Whenever you lose life for the first time each turn, put a +1/+1 counter on Vengeful Warchief. (Damage causes loss of life.)
mana={4}{B}
type=Creature

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);

View File

@@ -2262,7 +2262,6 @@ int AAImprint::resolve()
{
andAbilityClone->addToGame();
}
SAFE_DELETE(andAbility); //moved here because in destructor it can cause a crash.
}
return 1;
}
@@ -2276,11 +2275,15 @@ const string AAImprint::getMenuText()
AAImprint * AAImprint::clone() const
{
return NEW AAImprint(*this);
AAImprint * a = NEW AAImprint(*this);
if(andAbility)
a->andAbility = andAbility->clone();
return a;
}
AAImprint::~AAImprint()
{
SAFE_DELETE(andAbility);
}
//AAHaunt
@@ -2317,7 +2320,6 @@ int AAHaunt::resolve()
{
andAbilityClone->addToGame();
}
SAFE_DELETE(andAbility); //moved here because in destructor it can cause a crash.
}
return 1;
}
@@ -2331,11 +2333,76 @@ const string AAHaunt::getMenuText()
AAHaunt * AAHaunt::clone() const
{
return NEW AAHaunt(*this);
AAHaunt * a = NEW AAHaunt(*this);
if(andAbility)
a->andAbility = andAbility->clone();
return a;
}
AAHaunt::~AAHaunt()
{
SAFE_DELETE(andAbility);
}
//AATrain
AATrain::AATrain(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost) :
ActivatedAbility(observer, _id, _source, _cost, 0)
{
target = _target;
andAbility = NULL;
}
int AATrain::resolve()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target && _target->hasType(Subtypes::TYPE_CREATURE) && _target->isAttacker())
{
if(_target->mutation && _target->parentCards.size() > 0) return 0; // Mutated down cards cannot be trained, they will follow the fate of top-card
while(_target->next)
_target = _target->next;
if(_target->counters)
_target->counters->addCounter(1,1);
WEvent * e = NEW WEventCardTrained(_target);
game->receiveEvent(e);
if(andAbility)
{
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = _target;
if(andAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
}
return 1;
}
return 0;
}
const string AATrain::getMenuText()
{
return "Training";
}
AATrain * AATrain::clone() const
{
AATrain * a = NEW AATrain(*this);
if(andAbility)
a->andAbility = andAbility->clone();
return a;
}
AATrain::~AATrain()
{
SAFE_DELETE(andAbility);
}
//AAConjure
@@ -2401,7 +2468,10 @@ const string AAConjure::getMenuText()
AAConjure * AAConjure::clone() const
{
return NEW AAConjure(*this);
AAConjure * a = NEW AAConjure(*this);
if(andAbility)
a->andAbility = andAbility->clone();
return a;
}
AAConjure::~AAConjure()
@@ -4271,8 +4341,8 @@ AAFrozen * AAFrozen::clone() const
}
// chose a new target for an aura or enchantment and equip it note: VERY basic right now.
AANewTarget::AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget, ManaCost * _cost, bool reequip, bool newhook, int mutation) :
ActivatedAbility(observer, id, card, _cost, 0),retarget(retarget),reequip(reequip),newhook(newhook),mutation(mutation)
AANewTarget::AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost, bool retarget, bool reequip, bool newhook, int mutation, bool fromplay) :
ActivatedAbility(observer, id, card, _cost, 0),retarget(retarget),reequip(reequip),newhook(newhook),mutation(mutation),fromplay(fromplay)
{
target = _target;
}
@@ -4288,17 +4358,18 @@ int AANewTarget::resolve()
if (_target && !reequip && !mutation)
{
while (_target->next)
_target = _target->next;
_target->controller()->game->putInZone(_target, _target->currentZone,
_target->owner->game->exile);
_target = _target->next;
MTGCardInstance * refreshed = source->controller()->game->putInZone(_target,_target->currentZone,source->controller()->game->battlefield);
_target = _target->next;
if(!fromplay){
_target->controller()->game->putInZone(_target, _target->currentZone, _target->owner->game->exile);
_target = _target->next;
}
MTGCardInstance * refreshed = source->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->battlefield);
Spell * reUp = NEW Spell(game, refreshed);
if(reUp->source->hasSubtype(Subtypes::TYPE_AURA))
{
reUp->source->target = source;
reUp->resolve();
if(reUp->source->spellTargetType == "") reUp->source->spellTargetType = "creature"; // Fix to prevent flipped auras go to graveyard.
}
if(_target->hasSubtype(Subtypes::TYPE_EQUIPMENT))
{
@@ -4706,6 +4777,7 @@ AAFlip::AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardIn
InstantAbility(observer, id, card, _target),flipStats(flipStats),isflipcard(isflipcard),forcedcopy(forcedcopy),forcetype(forcetype),backfromcopy(backfromcopy)
{
target = _target;
andAbility = NULL;
}
int AAFlip::resolve()
@@ -4773,6 +4845,7 @@ int AAFlip::resolve()
if(myFlip->getManaCost())
_target->getManaCost()->copy(myFlip->getManaCost());
}
_target->spellTargetType = myFlip->spellTargetType; // Fix to prevent flipped auras go to graveyard.
_target->colors = myFlip->colors;
_target->types = myFlip->types;
_target->text = myFlip->text;
@@ -4931,7 +5004,20 @@ int AAFlip::resolve()
}
}
}
if(andAbility)
{
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = _target;
if(andAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
}
currentAbilities.clear();
testDestroy();
}
@@ -4966,9 +5052,17 @@ const string AAFlip::getMenuText()
AAFlip * AAFlip::clone() const
{
AAFlip * a = NEW AAFlip(*this);
if(andAbility)
a->andAbility = andAbility->clone();
a->forceDestroy = 1;
return a;
}
AAFlip::~AAFlip()
{
SAFE_DELETE(andAbility);
}
// AADYNAMIC: dynamic ability builder
AADynamic::AADynamic(GameObserver* observer, int id, MTGCardInstance * card, Damageable * _target,int type,int effect,int who,int amountsource,MTGAbility * storedAbility, ManaCost * _cost) :
ActivatedAbility(observer, id, card, _cost, 0),type(type),effect(effect),who(who),amountsource(amountsource),storedAbility(storedAbility)

View File

@@ -847,6 +847,20 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
if(!found)
return 0;
}
check = restriction[i].find("trainer"); //Player controls an attacking creature with greater power than the current one.
if(check != string::npos)
{
if(player != observer->currentPlayer || !card->isAttacker())
return 0;
bool found = false;
for(unsigned int i = 0; i < observer->currentPlayer->game->inPlay->cards.size() && !found; i++){
if(observer->currentPlayer->game->inPlay->cards[i]->hasType(Subtypes::TYPE_CREATURE) && observer->currentPlayer->game->inPlay->cards[i]->isAttacker() && observer->currentPlayer->game->inPlay->cards[i]->power > card->power){
found = true;
}
}
if(!found)
return 0;
}
check = restriction[i].find("can play");
if(check != string::npos)
{
@@ -1274,6 +1288,10 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
if (TargetChooser * tc = parseSimpleTC(s, "foretold", card))
return NEW TrCardForetold(observer, id, card, tc, once, limitOnceATurn);
//Train has been performed from a card
if (TargetChooser * tc = parseSimpleTC(s, "trained", card))
return NEW TrCardTrained(observer, id, card, tc, once, limitOnceATurn);
//Scry has been performed from a card
if (TargetChooser * tc = parseSimpleTC(s, "scryed", card))
return NEW TrCardScryed(observer, id, card, tc, once, limitOnceATurn);
@@ -3422,6 +3440,22 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
}
}
//train a creature
found = s.find("dotrain");
if (found != string::npos)
{
MTGAbility * a = NEW AATrain(observer, id, card, target);
a->oneShot = 1;
//andability
if(storedAndAbility.size())
{
string stored = storedAndAbility;
storedAndAbility.clear();
((AATrain*)a)->andAbility = parseMagicLine(stored, id, spell, card);
}
return a;
}
//Conjure a card
found = s.find("conjure");
if (found != string::npos)
@@ -4638,6 +4672,13 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
bool backfromcopy = (s.find("undocpy") != string::npos)?true:false; // Added to undo the copy effect at end of turn (es. Scion of the Ur-Dragon).
bool transmode = card->getdoubleFaced() == "kamiflip"?true:false;
MTGAbility * a = NEW AAFlip(observer, id, card, target, flipStats, transmode, false, forcetype, backfromcopy);
//andability
if(storedAndAbility.size())
{
string stored = storedAndAbility;
storedAndAbility.clear();
((AAFlip*)a)->andAbility = parseMagicLine(stored, id, spell, card);
}
return a;
}
@@ -4859,10 +4900,10 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return a;
}
//get a new target - retarget and newtarget makes the card refreshed - from exile to play...
//get a new target - retarget and newtarget makes the card refreshed - from exile to play (or from play to play)...
if ((s.find("retarget") != string::npos) || s.find("newtarget") != string::npos)
{
MTGAbility * a = NEW AANewTarget(observer, id, card,target, (s.find("retarget") != string::npos));
MTGAbility * a = NEW AANewTarget(observer, id, card, target, NULL, (s.find("retarget") != string::npos), false, false, 0, (s.find("fromplay") != string::npos));
a->oneShot = 1;
return a;
}
@@ -4870,15 +4911,15 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
//get a new target for puresteel paladin...etc for equipments inplay only.. newhook & rehook supports stone hewer basic... the card is reequipped
if ((s.find("rehook") != string::npos) || s.find("newhook") != string::npos)
{
MTGAbility * a = NEW AANewTarget(observer, id, card,target, false,NULL,true,(s.find("newhook") != string::npos));
MTGAbility * a = NEW AANewTarget(observer, id, card,target, NULL, false, true, (s.find("newhook") != string::npos));
a->oneShot = 1;
return a;
}
//get a new target for muatations
//get a new target for mutations
if ((s.find("mutateover") != string::npos) || s.find("mutateunder") != string::npos)
{
MTGAbility * a = NEW AANewTarget(observer, id, card,target, false,NULL,false,false,(s.find("mutateover") != string::npos)?1:2);
MTGAbility * a = NEW AANewTarget(observer, id, card, target, NULL, false, false, false, (s.find("mutateover") != string::npos)?1:2);
a->oneShot = 1;
return a;
}
@@ -5359,6 +5400,8 @@ int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode, Targ
return BAKA_EFFECT_GOOD;
if (dynamic_cast<AAHaunt *> (a))
return BAKA_EFFECT_GOOD;
if (dynamic_cast<AATrain *> (a))
return BAKA_EFFECT_GOOD;
if (dynamic_cast<ABestow *> (a))
return BAKA_EFFECT_GOOD;
if (dynamic_cast<AExert *> (a))

View File

@@ -238,7 +238,8 @@ const char* Constants::MTGBasicAbilities[] = {
"isconspiracy", //The card is a conspiracy (e.g. "Double Stroke")
"hasaftermath", //Flashback cost is an aftemath cost (e.g. "Claim // Fame")
"noentertrg", //Creatures entering the battlefield don't cause abilities to trigger (e.g. "Hushbringer").
"nodietrg" //Creatures dying don't cause abilities to trigger (e.g. "Hushbringer").
"nodietrg", //Creatures dying don't cause abilities to trigger (e.g. "Hushbringer").
"training" //Has training ability (e.g. "Gryff Rider")
};
map<string,int> Constants::MTGBasicAbilitiesMap;

View File

@@ -317,6 +317,11 @@ WEventCardForetold::WEventCardForetold(MTGCardInstance * card) :
{
}
WEventCardTrained::WEventCardTrained(MTGCardInstance * card) :
WEventCardUpdate(card)
{
}
WEventCardScryed::WEventCardScryed(MTGCardInstance * card) :
WEventCardUpdate(card)
{
@@ -573,6 +578,12 @@ Targetable * WEventCardForetold::getTarget(int target)
return NULL;
}
Targetable * WEventCardTrained::getTarget(int target)
{
if (target) return card;
return NULL;
}
Targetable * WEventCardScryed::getTarget(int target)
{
if (target) return card;

View File

@@ -475,9 +475,9 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
{
intValue = (s == "pdevotionoffset")?card->controller()->devotionOffset:card->controller()->opponent()->devotionOffset;
}
else if (s == "praidcount" || s == "oraidcount")
else if (s == "pattackedcount" || s == "oattackedcount")
{
intValue = (s == "praidcount")?card->controller()->raidcount:card->controller()->opponent()->raidcount;
intValue = (s == "pattackedcount")?card->controller()->raidcount:card->controller()->opponent()->raidcount;
}
else if (s == "pstormcount" || s == "ostormcount")
{