Added/fixed primitives, improved "@draw" trigger, added a "@scryed" trigger for scry ability, added a new keyword "placefromthetop" to put a card in a specifc position of owners library from the top.
This commit is contained in:
@@ -457,8 +457,14 @@ type=Artifact
|
||||
name=Aether Storm
|
||||
auto=maxCast(creature)0 opponent
|
||||
auto=maxCast(creature)0 controller
|
||||
auto={L:4}:bury(this) opponent
|
||||
auto={L:4}:bury(this) controller
|
||||
auto={L:4}:bury all(this)
|
||||
auto=@each opponent upkeep:ability$!name(Pay 4 life) pay[[{L:4}]] name(Pay 4 life) bury notatarget(Aether Storm|opponentBattlefield)?donothing!$ opponent
|
||||
auto=@each opponent untap:ability$!name(Pay 4 life) pay[[{L:4}]] name(Pay 4 life) bury notatarget(Aether Storm|opponentBattlefield)?donothing!$ opponent
|
||||
auto=@each opponent draw:ability$!name(Pay 4 life) pay[[{L:4}]] name(Pay 4 life) bury notatarget(Aether Storm|opponentBattlefield)?donothing!$ opponent
|
||||
auto=@each opponent combatbegins:ability$!name(Pay 4 life) pay[[{L:4}]] name(Pay 4 life) bury notatarget(Aether Storm|opponentBattlefield)?donothing!$ opponent
|
||||
auto=@each opponent blockers:ability$!name(Pay 4 life) pay[[{L:4}]] name(Pay 4 life) bury notatarget(Aether Storm|opponentBattlefield)?donothing!$ opponent
|
||||
auto=@each opponent firstmain:ability$!name(Pay 4 life) pay[[{L:4}]] name(Pay 4 life) bury notatarget(Aether Storm|opponentBattlefield)?donothing!$ opponent
|
||||
auto=@each opponent endofturn:ability$!name(Pay 4 life) pay[[{L:4}]] name(Pay 4 life) bury notatarget(Aether Storm|opponentBattlefield)?donothing!$ opponent
|
||||
text=Creature spells can’t be cast. -- Pay 4 life: Destroy Aether Storm. It can’t be regenerated. Any player may activate this ability.
|
||||
mana={3}{U}
|
||||
type=Enchantment
|
||||
@@ -1849,8 +1855,7 @@ type=Instant
|
||||
[/card]
|
||||
[card]
|
||||
name=Approach of the Second Sun
|
||||
auto=if compare(oyidarocount)~morethan~0 then winGame else alteryidarocount:1 opponent && life:7 controller
|
||||
auto=@movedto(this|mygraveyard):ability$!name(Put back in your library) moveto(mylibrary) and!(shuffle)! target(Approach of the Second Sun|mygraveyard)!$ controller
|
||||
auto=if compare(oyidarocount)~morethan~0 then winGame else alteryidarocount:1 opponent && life:7 controller && all(this) placefromthetop(7)
|
||||
text=If this spell was cast from your hand and you've cast another spell named Approach of the Second Sun this game, you win the game. Otherwise, put Approach of the Second Sun into its owner's library seventh from the top and you gain 7 life.
|
||||
mana={6}{W}
|
||||
type=Sorcery
|
||||
@@ -8169,7 +8174,7 @@ toughness=7
|
||||
[card]
|
||||
name=Chronostutter
|
||||
target=creature
|
||||
auto=moveto(ownerlibrary) && ability$!moverandom(*) from(mylibrary) to(mylibrary)!$ controller
|
||||
auto=placefromthetop(2)
|
||||
text=Put target creature into its owner's library second from the top.
|
||||
mana={5}{U}
|
||||
type=Instant
|
||||
@@ -9061,7 +9066,7 @@ type=Instant
|
||||
[card]
|
||||
name=Commit // Memory
|
||||
target=*[-land]
|
||||
auto=moveto(ownerlibrary) && ability$!moverandom(*) from(mylibrary) to(mylibrary)!$ controller
|
||||
auto=placefromthetop(2)
|
||||
autograveyard={4}{U}{U}{E}:moveto(opponentgraveyard) all(*|opponenthand) && moveto(opponentlibrary) all(*|opponentgraveyard) && shuffle && draw:7 opponent && moveto(mygraveyard) all(*|myhand) && moveto(mylibrary) all(*|mygraveyard) && shuffle && draw:7 controller asSorcery
|
||||
text=Put target spell or nonland permanent into its owner's library second from the top. -- Aftermath (Cast this spell only from your graveyard. Then exile it.) each player shuffles their hand and graveyard into their library and draws seven cards
|
||||
mana={3}{U}
|
||||
@@ -16959,6 +16964,16 @@ mana={3}{R}
|
||||
type=Sorcery
|
||||
[/card]
|
||||
[card]
|
||||
name=Flamespeaker Adept
|
||||
auto=@scryed(*|mybattlefield,mystack):all(this) transforms((,newability[2/0],newability[first strike])) ueot
|
||||
text=Whenever you scry, Flamespeaker Adept gets +2/+0 and gains first strike until end of turn.
|
||||
mana={2}{R}
|
||||
type=Creature
|
||||
subtype=Human Shaman
|
||||
power=2
|
||||
toughness=3
|
||||
[/card]
|
||||
[card]
|
||||
name=Flash Foliage
|
||||
restriction=blockersonly
|
||||
auto=token(Saproling,Creature Saproling,1/1,green) and!(transforms((,newability[mustblock])) ueot)!
|
||||
@@ -19758,7 +19773,9 @@ type=Sorcery
|
||||
[card]
|
||||
name=God-Eternal Bontu
|
||||
abilities=menace
|
||||
auto=may notatarget(<anyamount>other *|mybattlefield) sacrifice && draw:1
|
||||
auto=may name(Sacrifice permanents) target(<anyamount>other *|mybattlefield) sacrifice && draw:1 controller
|
||||
auto=@movedto(this|graveyard) from(myBattlefield):may name(Move back to hand) target(God-Eternal Bontu[fresh]|graveyard) placefromthetop(3)
|
||||
auto=@movedto(this|exile) from(myBattlefield):may name(Move back to hand) target(God-Eternal Bontu[fresh]|exile) placefromthetop(3)
|
||||
text=Menace -- When God-Eternal Bontu enters the battlefield, sacrifice any number of other permanents, then draw that many cards. -- When God-Eternal Bontu dies or is put into exile from the battlefield, you may put it into its owner's library third from the top.
|
||||
mana={3}{B}{B}
|
||||
type=Legendary Creature
|
||||
@@ -19769,9 +19786,9 @@ toughness=6
|
||||
[card]
|
||||
name=God-Eternal Kefnet
|
||||
abilities=flying
|
||||
auto=@movedTo(this|graveyard) from(battlefield):all(trigger[to]) moveTo(mylibrary) and!( moverandom(*) from(mylibrary) to(mylibrary) and!(moverandom(*) from(mylibrary) to(mylibrary))! )!
|
||||
auto=@movedTo(this|exile) from(battlefield):all(trigger[to]) moveTo(mylibrary) and!( moverandom(*) from(mylibrary) to(mylibrary) and!(moverandom(*) from(mylibrary) to(mylibrary))! )!
|
||||
auto=@drawof(player):may activate castcard(copied noevent) target(*[sorcery;instant]|myhand) limit:1
|
||||
auto=@movedto(this|graveyard) from(myBattlefield):may name(Move back to hand) target(God-Eternal Kefnet[fresh]|graveyard) placefromthetop(3)
|
||||
auto=@movedto(this|exile) from(myBattlefield):may name(Move back to hand) target(God-Eternal Kefnet[fresh]|exile) placefromthetop(3)
|
||||
auto=@drawof(player) turnlimited:may activate castcard(copied noevent) target(*[sorcery;instant;fresh]|myhand) limit:1
|
||||
text=Flying -- You may reveal the first card you draw each turn as you draw it. Whenever you reveal an instant or sorcery card this way, copy that card and you may cast the copy. That copy costs {2} less to cast. -- When God-Eternal Kefnet dies or is put into exile from the battlefield, you may put it into its owner's library third from the top.
|
||||
mana={2}{U}{U}
|
||||
type=Legendary Creature
|
||||
@@ -19783,6 +19800,8 @@ toughness=5
|
||||
name=God-Eternal Oketra
|
||||
abilities=double strike
|
||||
auto=@movedTo(creature|mystack):create(zombie warrior:creature zombie warrior:4/4:black:vigilance)
|
||||
auto=@movedto(this|graveyard) from(myBattlefield):may name(Move back to hand) target(God-Eternal Oketra[fresh]|graveyard) placefromthetop(3)
|
||||
auto=@movedto(this|exile) from(myBattlefield):may name(Move back to hand) target(God-Eternal Oketra[fresh]|exile) placefromthetop(3)
|
||||
text=Double strike -- Whenever you cast a creature spell, create a 4/4 black Zombie Warrior creature token with vigilance. -- When God-Eternal Oketra dies or is put into exile from the battlefield, you may put it into its owner's library third from the top.
|
||||
mana={3}{W}{W}
|
||||
type=Legendary Creature
|
||||
@@ -19795,6 +19814,8 @@ name=God-Eternal Rhonas
|
||||
abilities=deathtouch
|
||||
auto=all(other creature|myBattlefield) dynamicability<!mytgt powerpumppow!> ueot
|
||||
auto=all(other creature|myBattlefield) vigilance ueot
|
||||
auto=@movedto(this|graveyard) from(myBattlefield):may name(Move back to hand) target(God-Eternal Rhonas[fresh]|graveyard) placefromthetop(3)
|
||||
auto=@movedto(this|exile) from(myBattlefield):may name(Move back to hand) target(God-Eternal Rhonas[fresh]|exile) placefromthetop(3)
|
||||
text=Deathtouch -- When God-Eternal Rhonas enters the battlefield, double the power of each other creature you control until end of turn. Those creatures gain vigilance until end of turn. -- When God-Eternal Rhonas dies or is put into exile from the battlefield, you may put it into its owner's library third from the top.
|
||||
mana={3}{G}{G}
|
||||
type=Legendary Creature
|
||||
@@ -23421,6 +23442,8 @@ toughness=7
|
||||
name=Ilharg, the Raze-Boar
|
||||
abilities=trample
|
||||
auto=@combat(attacking) source(this):target(creature|myhand) transforms((,newability[phaseaction[endofturn once] moveTo(hand)],newability[ninjutsu])) forever
|
||||
auto=@movedto(this|graveyard) from(myBattlefield):may name(Move back to hand) target(Ilharg^ the Raze-Boar[fresh]|graveyard) placefromthetop(3)
|
||||
auto=@movedto(this|exile) from(myBattlefield):may name(Move back to hand) target(Ilharg^ the Raze-Boar[fresh]|exile) placefromthetop(3)
|
||||
text=Trample -- Whenever Ilharg, the Raze-Boar attacks, you may put a creature card from your hand onto the battlefield tapped and attacking. Return that creature to your hand at the beginning of the next end step. -- When Ilharg, the Raze-Boar dies or is put into exile from the battlefield, you may put it into its owner's library third from the top.
|
||||
mana={3}{R}{R}
|
||||
type=Legendary Creature
|
||||
@@ -26842,6 +26865,13 @@ mana={1}{W}{B}
|
||||
type=Enchantment
|
||||
[/card]
|
||||
[card]
|
||||
name=Knowledge and Power
|
||||
auto=@scryed(*|mybattlefield,mystack):name(Pay 2) pay({2}) name(Deal 2 damages) target(creature,player) damage:2
|
||||
text=Whenever you scry, you may pay {2}. If you do, Knowledge and Power deals 2 damage to target creature or player.
|
||||
mana={4}{R}
|
||||
type=Enchantment
|
||||
[/card]
|
||||
[card]
|
||||
name=Kodama of the Center Tree
|
||||
anyzone=type:spirit:myBattlefield/type:spirit:myBattlefield cdaactive
|
||||
auto=@movedto(this|mygraveyard):moveto(mybattlefield) target(spirit[manacost<=type:spirit:myBattlefield]|mygraveyard)
|
||||
@@ -28069,6 +28099,21 @@ mana={2}{B}
|
||||
type=Sorcery
|
||||
[/card]
|
||||
[card]
|
||||
name=Lethal Vapors
|
||||
auto=@movedto(creature|battlefield):all(trigger[to]) destroy
|
||||
auto={0}:destroy && turns:-1 controller
|
||||
auto=@each opponent upkeep:ability$!name(Pay 0) pay[[{0}]] name(Pay 0) destroy notatarget(Lethal Vapors|opponentBattlefield) && turns:-1 controller?donothing!$ opponent
|
||||
auto=@each opponent untap:ability$!name(Pay 0) pay[[{0}]] name(Pay 0) destroy notatarget(Lethal Vapors|opponentBattlefield) && turns:-1 controller?donothing!$ opponent
|
||||
auto=@each opponent draw:ability$!name(Pay 0) pay[[{0}]] name(Pay 0) destroy notatarget(Lethal Vapors|opponentBattlefield) && turns:-1 controller?donothing!$ opponent
|
||||
auto=@each opponent combatbegins:ability$!name(Pay 0) pay[[{0}]] name(Pay 0) destroy notatarget(Lethal Vapors|opponentBattlefield) && turns:-1 controller?donothing!$ opponent
|
||||
auto=@each opponent blockers:ability$!name(Pay 0) pay[[{0}]] name(Pay 0) destroy notatarget(Lethal Vapors|opponentBattlefield) && turns:-1 controller?donothing!$ opponent
|
||||
auto=@each opponent firstmain:ability$!name(Pay 0) pay[[{0}]] name(Pay 0) destroy notatarget(Lethal Vapors|opponentBattlefield) && turns:-1 controller?donothing!$ opponent
|
||||
auto=@each opponent endofturn:ability$!name(Pay 0) pay[[{0}]] name(Pay 0) destroy notatarget(Lethal Vapors|opponentBattlefield) && turns:-1 controller?donothing!$ opponent
|
||||
text=Whenever a creature enters the battlefield, destroy it. -- {0}: Destroy Lethal Vapors. You skip your next turn. Any player may activate this ability.
|
||||
mana={2}{B}{B}
|
||||
type=Enchantment
|
||||
[/card]
|
||||
[card]
|
||||
name=Ley Weaver
|
||||
abilities=partner
|
||||
auto=may moveto(myhand) notatarget(lore weaver|mylibrary)
|
||||
@@ -28903,7 +28948,7 @@ toughness=3
|
||||
[/card]
|
||||
[card]
|
||||
name=Long-Term Plans
|
||||
auto=name(search card) reveal:plibrarycount optionone name(choose card) target(*|reveal) moveto(ownerlibrary) and!( becomes(tobecast) ueot )! optiononeend optiontwo name(put back) target(<1>*|reveal) moveto(ownerlibrary) and!( all(*|reveal) moveto(ownerlibrary) and!(shuffle)! )! optiontwoend afterrevealed all(tobecast|mylibrary) moveto(mylibrary) and!( moverandom(*) from(mylibrary) to(mylibrary) and!(moverandom(*) from(mylibrary) to(mylibrary))! )! afterrevealedend revealend
|
||||
auto=name(search card) reveal:plibrarycount optionone name(choose card) target(*|reveal) moveto(ownerlibrary) and!( becomes(tobecast) ueot )! optiononeend optiontwo name(put back) target(<1>*|reveal) moveto(ownerlibrary) and!( all(*|reveal) moveto(ownerlibrary) and!(shuffle)! )! optiontwoend afterrevealed all(tobecast|mylibrary) placefromthetop(3) afterrevealedend revealend
|
||||
text=Search your library for a card, shuffle your library, then put that card third from the top.
|
||||
mana={2}{U}
|
||||
type=Instant
|
||||
@@ -28982,8 +29027,8 @@ toughness=2
|
||||
[card]
|
||||
name=Lost Hours
|
||||
target=player
|
||||
aicode=activate moveto(library) notatarget(*[-land]|targetedpersonshand)
|
||||
auto=reveal:type:*:targetedpersonshand revealzone(targetedpersonshand) optionone target(*[-land]|reveal) moveto(ownerlibrary) optiononeend optiontwo name(put back) target(<1>*|reveal) moveto(ownerhand) and!( all(*|reveal) moveto(ownerhand) )! optiontwoend afterrevealed moverandom(*) from(mylibrary) to(mylibrary) and!( moverandom(*) from(mylibrary) to(mylibrary) )! afterrevealedend revealend
|
||||
aicode=activate placefromthetop(3) notatarget(*[-land]|targetedpersonshand)
|
||||
auto=reveal:type:*:targetedpersonshand revealzone(targetedpersonshand) optionone target(*[-land]|reveal) placefromthetop(3) optiononeend optiontwo name(put back) target(<1>*|reveal) moveto(ownerhand) and!( all(*|reveal) moveto(ownerhand) )! optiontwoend revealend
|
||||
text=Target player reveals his or her hand. You choose a nonland card from it. That player puts that card into his or her library third from the top.
|
||||
mana={1}{B}
|
||||
type=Sorcery
|
||||
@@ -34639,7 +34684,7 @@ toughness=6
|
||||
[card]
|
||||
name=Oust
|
||||
target=creature
|
||||
auto=moveto(ownerlibrary) && ability$!moverandom(*) from(mylibrary) to(mylibrary)!$ controller
|
||||
auto=placefromthetop(2)
|
||||
auto=life:3 targetController
|
||||
text=Put target creature into its owner's library second from the top. Its controller gains 3 life.
|
||||
mana={W}
|
||||
|
||||
@@ -2337,7 +2337,7 @@ subtype=Tamiyo
|
||||
name=Teferi, Hero of Dominaria
|
||||
auto=counter(0/0,4,loyalty)
|
||||
auto={C(0/0,1,Loyalty)}:name(+1: Draw a card and untap two lands) draw:1 controller && phaseaction[endofturn once] untap target(<2>land)
|
||||
auto={C(0/0,-3,Loyalty)}:name(-3: Return target nonland to library) moveTo(ownerlibrary) target(*[-land])
|
||||
auto={C(0/0,-3,Loyalty)}:name(-3: Return target nonland to library) target(*[-land]) placefromthetop(3)
|
||||
auto={C(0/0,-8,Loyalty)}:name(-8: Emblem: "Whenever draw, exile permanent") emblem transforms((,newability[@drawof(player):moveTo(exile) target(*|opponentBattlefield)])) forever dontremove
|
||||
text=+1: Draw a card. At the beginning of the next end step, untap up to two lands. -- −3: Put target nonland permanent into its owner’s library third from the top. -- −8: You get an emblem with “Whenever you draw a card, exile target permanent an opponent controls.”
|
||||
mana={3}{W}{U}
|
||||
|
||||
@@ -4133,15 +4133,6 @@ mana={2}{R}
|
||||
type=Instant
|
||||
[/card]
|
||||
[card]
|
||||
name=Flamespeaker Adept
|
||||
text=Whenever you scry, Flamespeaker Adept gets +2/+0 and gains first strike until end of turn.
|
||||
mana={2}{R}
|
||||
type=Creature
|
||||
subtype=Human Shaman
|
||||
power=2
|
||||
toughness=3
|
||||
[/card]
|
||||
[card]
|
||||
name=Flaming Gambit
|
||||
text=Flaming Gambit deals X damage to target player. That player may choose a creature he or she controls and have Flaming Gambit deal that damage to it instead. -- Flashback {X}{R}{R} (You may cast this card from your graveyard for its flashback cost. Then exile it.)
|
||||
mana={X}{R}
|
||||
@@ -6648,12 +6639,6 @@ mana={4}
|
||||
type=Artifact
|
||||
[/card]
|
||||
[card]
|
||||
name=Knowledge and Power
|
||||
text=Whenever you scry, you may pay {2}. If you do, Knowledge and Power deals 2 damage to target creature or player.
|
||||
mana={4}{R}
|
||||
type=Enchantment
|
||||
[/card]
|
||||
[card]
|
||||
name=Kodama's Might
|
||||
text=Target creature gets +2/+2 until end of turn. -- Splice onto Arcane {G} (As you cast an Arcane spell, you may reveal this card from your hand and pay its splice cost. If you do, add this card's effects to that spell.)
|
||||
mana={G}
|
||||
@@ -6905,12 +6890,6 @@ power=2
|
||||
toughness=4
|
||||
[/card]
|
||||
[card]
|
||||
name=Lethal Vapors
|
||||
text=Whenever a creature enters the battlefield, destroy it. -- {0}: Destroy Lethal Vapors. You skip your next turn. Any player may activate this ability.
|
||||
mana={2}{B}{B}
|
||||
type=Enchantment
|
||||
[/card]
|
||||
[card]
|
||||
name=Lethe Lake
|
||||
text=At the beginning of your upkeep, put the top ten cards of your library into your graveyard. -- Whenever you roll {C}, target player puts the top ten cards of his or her library into his or her graveyard.
|
||||
type=Plane
|
||||
|
||||
@@ -1654,15 +1654,20 @@ class TrcardDrawn: public Trigger
|
||||
{
|
||||
public:
|
||||
bool thiscontroller, thisopponent;
|
||||
TrcardDrawn(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)
|
||||
bool limitOnceATurn;
|
||||
int triggeredTurn;
|
||||
TrcardDrawn(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc,bool once = false, bool thiscontroller = false, bool thisopponent = false, bool limitOnceATurn = false) :
|
||||
Trigger(observer, id, source,once, tc),thiscontroller(thiscontroller),thisopponent(thisopponent),limitOnceATurn(limitOnceATurn)
|
||||
{
|
||||
triggeredTurn = -1;
|
||||
}
|
||||
|
||||
int triggerOnEventImpl(WEvent * event)
|
||||
{
|
||||
WEventcardDraw * e = dynamic_cast<WEventcardDraw *> (event);
|
||||
if (!e) return 0;
|
||||
if (limitOnceATurn && triggeredTurn == game->turn)
|
||||
return 0;
|
||||
if (!tc->canTarget(e->player)) return 0;
|
||||
if(thiscontroller)
|
||||
if(e->player != source->controller())
|
||||
@@ -1670,6 +1675,7 @@ public:
|
||||
if(thisopponent)
|
||||
if(e->player == source->controller())
|
||||
return 0;
|
||||
triggeredTurn = game->turn;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1761,6 +1767,33 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class TrCardScryed: public Trigger
|
||||
{
|
||||
public:
|
||||
bool limitOnceATurn;
|
||||
int triggeredTurn;
|
||||
TrCardScryed(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)
|
||||
{
|
||||
WEventCardScryed * e = dynamic_cast<WEventCardScryed *> (event);
|
||||
if (!e) return 0;
|
||||
if (limitOnceATurn && triggeredTurn == game->turn)
|
||||
return 0;
|
||||
if (!tc->canTarget(e->card)) return 0;
|
||||
triggeredTurn = game->turn;
|
||||
return 1;
|
||||
}
|
||||
|
||||
TrCardScryed * clone() const
|
||||
{
|
||||
return NEW TrCardScryed(*this);
|
||||
}
|
||||
};
|
||||
|
||||
class TrCardRolledDie: public Trigger
|
||||
{
|
||||
public:
|
||||
@@ -2409,6 +2442,19 @@ public:
|
||||
|
||||
};
|
||||
|
||||
//place a card in a specifc position of owners library from the top
|
||||
class AALibraryPosition: public ActivatedAbility
|
||||
{
|
||||
public:
|
||||
AALibraryPosition(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL, unsigned int _position = 1);
|
||||
MTGAbility * andAbility;
|
||||
int resolve();
|
||||
unsigned int position;
|
||||
const string getMenuText();
|
||||
AALibraryPosition * clone() const;
|
||||
~AALibraryPosition();
|
||||
};
|
||||
|
||||
//place a card on the bottom of owners library
|
||||
class AALibraryBottom: public ActivatedAbility
|
||||
{
|
||||
|
||||
@@ -366,6 +366,12 @@ struct WEventCardSurveiled : public WEventCardUpdate {
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//scry event
|
||||
struct WEventCardScryed : public WEventCardUpdate {
|
||||
WEventCardScryed(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//explores event
|
||||
struct WEventCardExplored : public WEventCardUpdate {
|
||||
WEventCardExplored(MTGCardInstance * card);
|
||||
|
||||
@@ -892,6 +892,8 @@ int GenericScryAbility::resolve()
|
||||
{
|
||||
MTGAbility * ability = NEW MTGScryCards(game, this->GetId(), source, howMany);
|
||||
ability->addToGame();
|
||||
WEvent * e = NEW WEventCardScryed(source);
|
||||
game->receiveEvent(e);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1718,6 +1720,77 @@ AAModTurn * AAModTurn::clone() const
|
||||
return NEW AAModTurn(*this);
|
||||
}
|
||||
|
||||
//move target to specifc position of owners library from the top
|
||||
AALibraryPosition::AALibraryPosition(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost, unsigned int _position) :
|
||||
ActivatedAbility(observer, _id, _source, _cost, 0)
|
||||
{
|
||||
target = _target;
|
||||
andAbility = NULL;
|
||||
position = _position;
|
||||
}
|
||||
|
||||
int AALibraryPosition::resolve()
|
||||
{
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
_target = _target->owner->game->putInLibrary(_target);
|
||||
if (_target)
|
||||
{
|
||||
MTGLibrary * library = _target->owner->game->library;
|
||||
vector<MTGCardInstance *>oldOrder = library->cards;
|
||||
vector<MTGCardInstance *>newOrder;
|
||||
if(position > oldOrder.size())
|
||||
position = oldOrder.size(); //Avoid to exceed the library dimension.
|
||||
for(unsigned int k = 0; k < oldOrder.size() - position; ++k)
|
||||
{
|
||||
MTGCardInstance * rearranged = oldOrder[k];
|
||||
if(rearranged != _target)
|
||||
newOrder.push_back(rearranged);
|
||||
}
|
||||
newOrder.push_back(_target);
|
||||
for(unsigned int k = oldOrder.size() - position ; k < oldOrder.size(); ++k)
|
||||
{
|
||||
MTGCardInstance * rearranged = oldOrder[k];
|
||||
if(rearranged != _target)
|
||||
newOrder.push_back(rearranged);
|
||||
}
|
||||
library->cards = newOrder;
|
||||
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 AALibraryPosition::getMenuText()
|
||||
{
|
||||
return "Put in Library in a specific position from the top";
|
||||
}
|
||||
|
||||
AALibraryPosition * AALibraryPosition::clone() const
|
||||
{
|
||||
AALibraryPosition * a = NEW AALibraryPosition(*this);
|
||||
if(andAbility)
|
||||
a->andAbility = andAbility->clone();
|
||||
return a;
|
||||
}
|
||||
|
||||
AALibraryPosition::~AALibraryPosition()
|
||||
{
|
||||
SAFE_DELETE(andAbility);
|
||||
}
|
||||
|
||||
//move target to bottom of owners library
|
||||
AALibraryBottom::AALibraryBottom(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost) :
|
||||
ActivatedAbility(observer, _id, _source, _cost, 0)
|
||||
|
||||
@@ -1210,11 +1210,11 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
|
||||
|
||||
//drawn player - controller of card - dynamic version drawof(player) -> returns current controller even with exchange of card controller
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "drawof", card))
|
||||
return NEW TrcardDrawn(observer, id, card, tc,once,true,false);
|
||||
return NEW TrcardDrawn(observer, id, card, tc,once,true,false,limitOnceATurn);
|
||||
|
||||
//drawn player - opponent of card controller - dynamic version drawfoeof(player) -> returns current opponent even with exchange of card controller
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "drawfoeof", card))
|
||||
return NEW TrcardDrawn(observer, id, card, tc,once,false,true);
|
||||
return NEW TrcardDrawn(observer, id, card, tc,once,false,true,limitOnceATurn);
|
||||
|
||||
//Card card is drawn - static version - drawn(player) - any player; drawn(controller) - owner forever; drawn(opponent) - opponent forever
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "drawn", card))
|
||||
@@ -1224,11 +1224,15 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "mutated", card))
|
||||
return NEW TrCardMutated(observer, id, card, tc, once, limitOnceATurn);
|
||||
|
||||
//Surveil has been performed from controller
|
||||
//Surveil has been performed from a card
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "surveiled", card))
|
||||
return NEW TrCardSurveiled(observer, id, card, tc, once, limitOnceATurn);
|
||||
|
||||
//Esplores has been performed from controller
|
||||
//Scry has been performed from a card
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "scryed", card))
|
||||
return NEW TrCardScryed(observer, id, card, tc, once, limitOnceATurn);
|
||||
|
||||
//Esplores has been performed from a cardr
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "explored", card))
|
||||
return NEW TrCardExplored(observer, id, card, tc, once, limitOnceATurn);
|
||||
|
||||
@@ -3097,6 +3101,24 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return a;
|
||||
}
|
||||
|
||||
//put a card in a specifc position of owners library from the top
|
||||
vector<string> splitPlaceFromTop = parseBetween(s, "placefromthetop(", ")");
|
||||
if (splitPlaceFromTop.size())
|
||||
{
|
||||
WParsedInt* parser = NEW WParsedInt(splitPlaceFromTop[1], card);
|
||||
int position = parser->intValue;
|
||||
MTGAbility * a = NEW AALibraryPosition(observer, id, card, target, NULL, position);
|
||||
a->oneShot = 1;
|
||||
//andability
|
||||
if(storedAndAbility.size())
|
||||
{
|
||||
string stored = storedAndAbility;
|
||||
storedAndAbility.clear();
|
||||
((AALibraryBottom*)a)->andAbility = parseMagicLine(stored, id, spell, card);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
//put a card on bottom of library
|
||||
found = s.find("bottomoflibrary");
|
||||
if (found != string::npos)
|
||||
|
||||
@@ -297,6 +297,11 @@ WEventCardSurveiled::WEventCardSurveiled(MTGCardInstance * card) :
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardScryed::WEventCardScryed(MTGCardInstance * card) :
|
||||
WEventCardUpdate(card)
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardExplored::WEventCardExplored(MTGCardInstance * card) :
|
||||
WEventCardUpdate(card)
|
||||
{
|
||||
@@ -531,6 +536,12 @@ Targetable * WEventCardSurveiled::getTarget(int target)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardScryed::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardExplored::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
|
||||
Reference in New Issue
Block a user