Merge pull request #916 from kevlahnota/master

refactor Legend Rule and other Bug fixes
This commit is contained in:
Anthony Calosa
2017-02-01 10:40:02 +08:00
committed by GitHub
16 changed files with 255 additions and 151 deletions

View File

@@ -136,12 +136,6 @@ power=2
toughness=3 toughness=3
[/card] [/card]
[card] [card]
name=Harnessed Lightning
text=Choose target creature. You get {E}{E}{E} (three energy counters), then you may pay any amount of {E}. Harnessed Lightning deals that much damage to that creature.
mana={1}{R}
type=Instant
[/card]
[card]
name=Insidious Will name=Insidious Will
text=Choose one — -- • Counter target spell. -- • You may choose new targets for target spell. -- • Copy target instant or sorcery spell. You may choose new targets for the copy. text=Choose one — -- • Counter target spell. -- • You may choose new targets for target spell. -- • Copy target instant or sorcery spell. You may choose new targets for the copy.
mana={2}{U}{U} mana={2}{U}{U}

View File

@@ -92,16 +92,6 @@ power=3
toughness=3 toughness=3
[/card] [/card]
[card] [card]
name=Cemetery Puca
text=Whenever a creature is put into a graveyard from the battlefield, you may pay {1}. If you do, Cemetery Puca becomes a copy of that creature and gains this ability.
auto=@movedto(creature|graveyard) from(battlefield):all(trigger[from]) pay[[{1}]] copy
mana={1}{UB}{UB}
type=Creature
subtype=Shapeshifter
power=1
toughness=2
[/card]
[card]
name=Conflux name=Conflux
auto=ability$!name(white card) moveto(myhand) notatarget(*[white]|mylibrary)!$ controller auto=ability$!name(white card) moveto(myhand) notatarget(*[white]|mylibrary)!$ controller
auto=ability$!name(blue card) moveto(myhand) notatarget(*[blue]|mylibrary)!$ controller auto=ability$!name(blue card) moveto(myhand) notatarget(*[blue]|mylibrary)!$ controller
@@ -123,16 +113,6 @@ mana={1}{B}{G}
type=Instant type=Instant
[/card] [/card]
[card] [card]
name=Cryptoplasm
auto=@each my upkeep:may copy target(other creature|battlefield)
text=At the beginning of your upkeep, you may have Cryptoplasm become a copy of another target creature. If you do, Cryptoplasm gains this ability.
mana={1}{U}{U}
type=Creature
subtype=Shapeshifter
power=2
toughness=2
[/card]
[card]
name=Demon of Wailing Agonies name=Demon of Wailing Agonies
abilities=flying abilities=flying
#wagic doesnt have commander zone #wagic doesnt have commander zone
@@ -157,16 +137,6 @@ power=2
toughness=3 toughness=3
[/card] [/card]
[card] [card]
name=Dimir Doppelganger
auto={1}{U}{B}:target(creature|graveyard) moveto(exile) and!(copy)!
text={1}{U}{B}: Exile target creature card from a graveyard. Dimir Doppelganger becomes a copy of that card and gains this ability.
mana={1}{U}{B}
type=Creature
subtype=Shapeshifter
power=0
toughness=2
[/card]
[card]
name=Eureka name=Eureka
auto=ability$! moveto(ownerbattlefield) notatarget(<anyamount>artifact,creature,enchantment,land,planeswalker|myhand) !$ controller auto=ability$! moveto(ownerbattlefield) notatarget(<anyamount>artifact,creature,enchantment,land,planeswalker|myhand) !$ controller
auto=ability$! moveto(ownerbattlefield) notatarget(<anyamount>artifact,creature,enchantment,land,planeswalker|myhand) !$ opponent auto=ability$! moveto(ownerbattlefield) notatarget(<anyamount>artifact,creature,enchantment,land,planeswalker|myhand) !$ opponent
@@ -762,13 +732,6 @@ power=3
toughness=4 toughness=4
[/card] [/card]
[card] [card]
name=Thespian's Stage
auto={T}:Add{1}
auto={2}{T}:copy target(land|battlefield)
text={T}: Add {1} to your mana pool. -- {2}, {T}: Thespian's Stage becomes a copy of target land and gains this ability.
type=Land
[/card]
[card]
name=Thunderfoot Baloth name=Thunderfoot Baloth
abilities=trample abilities=trample
#wagic doesnt have commander zone #wagic doesnt have commander zone
@@ -814,16 +777,6 @@ mana={2}{G}{U}
type=Sorcery type=Sorcery
[/card] [/card]
[card] [card]
name=Unstable Shapeshifter
auto=@movedto(other creature|battlefield):all(trigger[from]) copy
text=Whenever another creature enters the battlefield, Unstable Shapeshifter becomes a copy of that creature and gains this ability.
mana={3}{U}
type=Creature
subtype=Shapeshifter
power=0
toughness=1
[/card]
[card]
name=Venser's Diffusion name=Venser's Diffusion
target=*[-land] target=*[-land]
auto=moveTo(ownerhand) auto=moveTo(ownerhand)

View File

@@ -291,7 +291,7 @@ subtype=Aura
[/card] [/card]
[card] [card]
name=Abundant Maw name=Abundant Maw
autostack=if casted(this) then target(opponent) life:-3 && life:3 controller autostack=if casted(this) then choice target(opponent) life:-3 && life:3 controller
text=Emerge {6}{B} (You may cast this spell by sacrificing a creature and paying the emerge cost reduced by that creature's converted mana cost.) -- When you cast Abundant Maw, target opponent loses 3 life and you gain 3 life. text=Emerge {6}{B} (You may cast this spell by sacrificing a creature and paying the emerge cost reduced by that creature's converted mana cost.) -- When you cast Abundant Maw, target opponent loses 3 life and you gain 3 life.
mana={8} mana={8}
other={emerge}{6}{B} name(Emerge) other={emerge}{6}{B} name(Emerge)
@@ -17634,6 +17634,16 @@ power=0
toughness=5 toughness=5
[/card] [/card]
[card] [card]
name=Cemetery Puca
auto=@movedto(creature|graveyard) from(battlefield):all(trigger[from]) pay[[{1}]] copy
text=Whenever a creature is put into a graveyard from the battlefield, you may pay {1}. If you do, Cemetery Puca becomes a copy of that creature and gains this ability.
mana={1}{UB}{UB}
type=Creature
subtype=Shapeshifter
power=1
toughness=2
[/card]
[card]
name=Cemetery Reaper name=Cemetery Reaper
auto=lord(other zombie|myBattlefield) 1/1 auto=lord(other zombie|myBattlefield) 1/1
auto={2}{B}{T}:moveTo(Exile) target(creature|graveyard) && token(Zombie,Creature Zombie,2/2,black) auto={2}{B}{T}:moveTo(Exile) target(creature|graveyard) && token(Zombie,Creature Zombie,2/2,black)
@@ -24048,6 +24058,16 @@ mana={1}{G}
type=Enchantment type=Enchantment
[/card] [/card]
[card] [card]
name=Cryptoplasm
auto=@each my upkeep:may target(other creature|battlefield) copy and!( transforms((,newability[@each my upkeep:may copy target(other creature|battlefield)])) forever )!
text=At the beginning of your upkeep, you may have Cryptoplasm become a copy of another target creature. If you do, Cryptoplasm gains this ability.
mana={1}{U}{U}
type=Creature
subtype=Shapeshifter
power=2
toughness=2
[/card]
[card]
name=Cryptwailing name=Cryptwailing
auto={1}{E(creature|mygraveyard)}{E(creature|mygraveyard)}:target(player) ability$!name(discard) target(*|myhand) reject!$ targetedplayer asSorcery auto={1}{E(creature|mygraveyard)}{E(creature|mygraveyard)}:target(player) ability$!name(discard) target(*|myhand) reject!$ targetedplayer asSorcery
text={1}, Exile two creature cards from your graveyard: Target player discards a card. Activate this ability only any time you could cast a sorcery. text={1}, Exile two creature cards from your graveyard: Target player discards a card. Activate this ability only any time you could cast a sorcery.
@@ -28850,6 +28870,16 @@ power=2
toughness=2 toughness=2
[/card] [/card]
[card] [card]
name=Dimir Doppelganger
auto={1}{U}{B}:name(exile) target(creature|graveyard) copy and!( {1}{U}{B}:name(exile) target(creature|graveyard) copy && moveto(exile) )! && moveto(exile)
text={1}{U}{B}: Exile target creature card from a graveyard. Dimir Doppelganger becomes a copy of that card and gains this ability.
mana={1}{U}{B}
type=Creature
subtype=Shapeshifter
power=0
toughness=2
[/card]
[card]
name=Dimir Guildgate name=Dimir Guildgate
auto=tap(noevent) auto=tap(noevent)
auto={T}:add{U} auto={T}:add{U}
@@ -29366,7 +29396,7 @@ type=Instant
[/card] [/card]
[card] [card]
name=Dismiss into Dream name=Dismiss into Dream
auto=lord(creature|opponentbattlefield) transforms((Illusion,newability[@targeted(this):sacrifice])) auto=lord(creature|opponentbattlefield) transforms((Illusion,newability[while(restriction{cardistargeted}) sacrifice]))
text=Enchantment. -- Each creature your opponents control is an Illusion in addition to its other types and has "When this creature becomes the target of a spell or ability, sacrifice it." text=Enchantment. -- Each creature your opponents control is an Illusion in addition to its other types and has "When this creature becomes the target of a spell or ability, sacrifice it."
mana={6}{U} mana={6}{U}
type=Enchantment type=Enchantment
@@ -32091,7 +32121,7 @@ toughness=1
[/card] [/card]
[card] [card]
name=Due Respect name=Due Respect
auto=emblem transforms((,newability[@movedTo(*|Battlefield):all(trigger) tap(noevent)])) ueot auto=emblem transforms((,newability[lord(*[recent]|battlefield) tap(noevent)])) ueot
auto=draw:1 controller auto=draw:1 controller
mana={1}{W} mana={1}{W}
type=Instant type=Instant
@@ -42861,7 +42891,7 @@ toughness=2
[/card] [/card]
[card] [card]
name=Frost Walker name=Frost Walker
auto=@targeted(this):sacrifice auto=while(restriction{cardistargeted}) sacrifice
text=When Frost Walker becomes the target of a spell or ability, sacrifice it. text=When Frost Walker becomes the target of a spell or ability, sacrifice it.
mana={1}{U} mana={1}{U}
type=Creature type=Creature
@@ -48197,7 +48227,7 @@ toughness=2
[card] [card]
name=Gossamer Phantasm name=Gossamer Phantasm
abilities=flying abilities=flying
auto=@targeted(this):sacrifice auto=while(restriction{cardistargeted}) sacrifice
text=Flying -- When Gossamer Phantasm becomes the target of a spell or ability, sacrifice it. text=Flying -- When Gossamer Phantasm becomes the target of a spell or ability, sacrifice it.
mana={1}{U} mana={1}{U}
type=Creature type=Creature
@@ -51372,6 +51402,35 @@ mana={2}{G}
type=Sorcery type=Sorcery
[/card] [/card]
[card] [card]
name=Harnessed Lightning
#AUTO_DEFINE _HARNESSED_LIGHTNING_($c) this(variable{penergy}>=$c) choice damage:$c && alterenergy:-$c controller
target=creature
auto=alterenergy:3 controller
auto=_HARNESSED_LIGHTNING_(1)
auto=_HARNESSED_LIGHTNING_(2)
auto=_HARNESSED_LIGHTNING_(3)
auto=_HARNESSED_LIGHTNING_(4)
auto=_HARNESSED_LIGHTNING_(5)
auto=_HARNESSED_LIGHTNING_(6)
auto=_HARNESSED_LIGHTNING_(7)
auto=_HARNESSED_LIGHTNING_(8)
auto=_HARNESSED_LIGHTNING_(9)
auto=_HARNESSED_LIGHTNING_(10)
auto=_HARNESSED_LIGHTNING_(11)
auto=_HARNESSED_LIGHTNING_(12)
auto=_HARNESSED_LIGHTNING_(13)
auto=_HARNESSED_LIGHTNING_(14)
auto=_HARNESSED_LIGHTNING_(15)
auto=_HARNESSED_LIGHTNING_(16)
auto=_HARNESSED_LIGHTNING_(17)
auto=_HARNESSED_LIGHTNING_(18)
auto=_HARNESSED_LIGHTNING_(19)
auto=_HARNESSED_LIGHTNING_(20)
text=Choose target creature. You get {E}{E}{E} (three energy counters), then you may pay any amount of {E}. Harnessed Lightning deals that much damage to that creature.
mana={1}{R}
type=Instant
[/card]
[card]
name=Harpoon Sniper name=Harpoon Sniper
auto={W}{T}:damage:type:merfolk:mybattlefield target(creature[attacking;blocking]) auto={W}{T}:damage:type:merfolk:mybattlefield target(creature[attacking;blocking])
text={W}, {T}: Harpoon Sniper deals X damage to target attacking or blocking creature, where X is the number of Merfolk you control. text={W}, {T}: Harpoon Sniper deals X damage to target attacking or blocking creature, where X is the number of Merfolk you control.
@@ -55931,7 +55990,7 @@ toughness=4
[card] [card]
name=Illusionary Servant name=Illusionary Servant
abilities=flying abilities=flying
auto=@targeted(this):sacrifice auto=while(restriction{cardistargeted}) sacrifice
text=Flying -- When Illusionary Servant becomes the target of a spell or ability, sacrifice it. text=Flying -- When Illusionary Servant becomes the target of a spell or ability, sacrifice it.
mana={1}{U}{U} mana={1}{U}{U}
type=Creature type=Creature
@@ -76392,8 +76451,8 @@ type=Sorcery
[card] [card]
name=Nahiri, the Harbinger name=Nahiri, the Harbinger
auto=counter(0/0,4,loyalty) auto=counter(0/0,4,loyalty)
auto={C(0/0,1,Loyalty)}:name(+1: Reveal) reveal:1 optionone name(Choose to put in Graveyard) target(*|reveal) moveto(mygraveyard) optiononeend optiontwo name(put Back and draw) target(<1>*|reveal) moveto(mylibrary) optiontwoend afterrevealed choice draw:1 controller afterrevealedend revealend auto={C(0/0,2,Loyalty)}:name(+2: Discard to draw) notatarget(*|myhand) transforms((,newability[reject and!(draw:1)!])) forever
auto={C(0/0,-2,Loyalty)}:name(-2: Exile tapped Artifact or Creature) target(creature,artifact[tapped]) moveto(exile) auto={C(0/0,-2,Loyalty)}:name(-2: Exile tapped Artifact or Creature) target(*[artifact;creature;tapped]) moveto(exile)
auto={C(0/0,-2,Loyalty)}:name(-2: Exile target Enchantment) target(enchantment) moveto(exile) auto={C(0/0,-2,Loyalty)}:name(-2: Exile target Enchantment) target(enchantment) moveto(exile)
auto={C(0/0,-8,Loyalty)}:name(-8: Fetch) moveto(mybattlefield) notatarget(artifact,creature|mylibrary) and!( transforms((,newability[haste],newability[phaseaction[endofturn sourceinplay] moveTo(ownerhand)])) forever )! auto={C(0/0,-8,Loyalty)}:name(-8: Fetch) moveto(mybattlefield) notatarget(artifact,creature|mylibrary) and!( transforms((,newability[haste],newability[phaseaction[endofturn sourceinplay] moveTo(ownerhand)])) forever )!
text=+2: You may discard a card. If you do, draw a card. -- -2: Exile target enchantment, tapped artifact, or tapped creature. -- -8: Search your library for an artifact or creature card, put it onto the battlefield, then shuffle your library. It gains haste. Return it to your hand at the beginning of the next end step. text=+2: You may discard a card. If you do, draw a card. -- -2: Exile target enchantment, tapped artifact, or tapped creature. -- -8: Search your library for an artifact or creature card, put it onto the battlefield, then shuffle your library. It gains haste. Return it to your hand at the beginning of the next end step.
@@ -83909,7 +83968,7 @@ toughness=1
[card] [card]
name=Phantasmal Abomination name=Phantasmal Abomination
abilities=defender abilities=defender
auto=@targeted(this):sacrifice auto=while(restriction{cardistargeted}) sacrifice
text=Defender -- When Phantasmal Abomination becomes the target of a spell or ability, sacrifice it. text=Defender -- When Phantasmal Abomination becomes the target of a spell or ability, sacrifice it.
mana={1}{U}{U} mana={1}{U}{U}
type=Creature type=Creature
@@ -83919,7 +83978,7 @@ toughness=5
[/card] [/card]
[card] [card]
name=Phantasmal Bear name=Phantasmal Bear
auto=@targeted(this):sacrifice auto=while(restriction{cardistargeted}) sacrifice
text=When Phantasmal Bear becomes the target of a spell or ability, sacrifice it. text=When Phantasmal Bear becomes the target of a spell or ability, sacrifice it.
mana={U} mana={U}
type=Creature type=Creature
@@ -83930,7 +83989,7 @@ toughness=2
[card] [card]
name=Phantasmal Dragon name=Phantasmal Dragon
abilities=flying abilities=flying
auto=@targeted(this):sacrifice auto=while(restriction{cardistargeted}) sacrifice
text=Flying -- When Phantasmal Dragon becomes the target of a spell or ability, sacrifice it. text=Flying -- When Phantasmal Dragon becomes the target of a spell or ability, sacrifice it.
mana={2}{U}{U} mana={2}{U}{U}
type=Creature type=Creature
@@ -83963,7 +84022,7 @@ toughness=1
[card] [card]
name=Phantasmal Image name=Phantasmal Image
auto=may copy NotATarget(creature) auto=may copy NotATarget(creature)
auto=while(restriction{copiedacard}) transforms((Illusion,newability[@targeted(this):sacrifice])) forever auto=while(restriction{copiedacard}) transforms((Illusion,newability[while(restriction{cardistargeted}) sacrifice])) forever
text=You may have Phantasmal Image enter the battlefield as a copy of any creature on the battlefield, except it's an Illusion in addition to its other types and it gains "When this creature becomes the target of a spell or ability, sacrifice it." text=You may have Phantasmal Image enter the battlefield as a copy of any creature on the battlefield, except it's an Illusion in addition to its other types and it gains "When this creature becomes the target of a spell or ability, sacrifice it."
mana={1}{U} mana={1}{U}
type=Creature type=Creature
@@ -84034,7 +84093,7 @@ toughness=2
[/card] [/card]
[card] [card]
name=Phantom Beast name=Phantom Beast
auto=@targeted(this):sacrifice auto=while(restriction{cardistargeted}) sacrifice
text=When Phantom Beast becomes the target of a spell or ability, sacrifice it. text=When Phantom Beast becomes the target of a spell or ability, sacrifice it.
mana={3}{U} mana={3}{U}
type=Creature type=Creature
@@ -104562,7 +104621,7 @@ type=Instant
[/card] [/card]
[card] [card]
name=Skulking Fugitive name=Skulking Fugitive
auto=@targeted(this):sacrifice auto=while(restriction{cardistargeted}) sacrifice
text=When Skulking Fugitive becomes the target of a spell or ability, sacrifice it. text=When Skulking Fugitive becomes the target of a spell or ability, sacrifice it.
mana={2}{B} mana={2}{B}
type=Creature type=Creature
@@ -104573,7 +104632,7 @@ toughness=4
[card] [card]
name=Skulking Ghost name=Skulking Ghost
abilities=flying abilities=flying
auto=@targeted(this):sacrifice auto=while(restriction{cardistargeted}) sacrifice
text=Flying -- When Skulking Ghost becomes the target of a spell or ability, sacrifice it. text=Flying -- When Skulking Ghost becomes the target of a spell or ability, sacrifice it.
mana={1}{B} mana={1}{B}
type=Creature type=Creature
@@ -104584,7 +104643,7 @@ toughness=1
[card] [card]
name=Skulking Knight name=Skulking Knight
abilities=flanking abilities=flanking
auto=@targeted(this):sacrifice auto=while(restriction{cardistargeted}) sacrifice
text=Flanking (Whenever a creature without flanking blocks this creature, the blocking creature gets -1/-1 until end of turn.) -- When Skulking Knight becomes the target of a spell or ability, sacrifice it. text=Flanking (Whenever a creature without flanking blocks this creature, the blocking creature gets -1/-1 until end of turn.) -- When Skulking Knight becomes the target of a spell or ability, sacrifice it.
mana={2}{B} mana={2}{B}
type=Creature type=Creature
@@ -115445,7 +115504,7 @@ type=Artifact
[/card] [/card]
[card] [card]
name=Tar Pit Warrior name=Tar Pit Warrior
auto=@targeted(this):sacrifice auto=while(restriction{cardistargeted}) sacrifice
text=When Tar Pit Warrior becomes the target of a spell or ability, sacrifice it. text=When Tar Pit Warrior becomes the target of a spell or ability, sacrifice it.
mana={2}{B} mana={2}{B}
type=Creature type=Creature
@@ -117089,8 +117148,8 @@ toughness=1
[card] [card]
name=Thalia, Heretic Cathar name=Thalia, Heretic Cathar
abilities=first strike abilities=first strike
auto=@movedTo(*[recent;land;-basic]|opponentBattlefield):all(trigger) tap(noevent) auto=lord(*[recent;land;-basic]|opponentbattlefield) transforms((,newability[tap(noevent)]))
auto=@movedTo(*[recent;creature]|opponentBattlefield):all(trigger) tap(noevent) auto=lord(*[recent;creature]|opponentbattlefield) transforms((,newability[tap(noevent)]))
text=First strike -- Creatures and nonbasic lands your opponents control enter the battlefield tapped. text=First strike -- Creatures and nonbasic lands your opponents control enter the battlefield tapped.
mana={2}{W} mana={2}{W}
type=Legendary Creature type=Legendary Creature
@@ -117494,6 +117553,13 @@ power=4
toughness=3 toughness=3
[/card] [/card]
[card] [card]
name=Thespian's Stage
auto={T}:Add{1}
auto={2}{T}:copy target(other land|battlefield) and!( {2}{T}:copy target(other land|battlefield) )!
text={T}: Add {1} to your mana pool. -- {2}, {T}: Thespian's Stage becomes a copy of target land and gains this ability.
type=Land
[/card]
[card]
name=Thicket Basilisk name=Thicket Basilisk
auto=@combat(blocking,blocked) source(this) from(creature[-wall]):all(trigger[from]) phaseaction[combatends once] destroy auto=@combat(blocking,blocked) source(this) from(creature[-wall]):all(trigger[from]) phaseaction[combatends once] destroy
text=Whenever Thicket Basilisk blocks or becomes blocked by a non-Wall creature, destroy that creature at end of combat. text=Whenever Thicket Basilisk blocks or becomes blocked by a non-Wall creature, destroy that creature at end of combat.
@@ -123721,6 +123787,16 @@ mana={3}
type=Artifact type=Artifact
[/card] [/card]
[card] [card]
name=Unstable Shapeshifter
auto=@movedto(other creature|battlefield):all(trigger[from]) copy and!( transforms((,newability[@movedto(other creature|battlefield):all(trigger[from]) copy])) forever )!
text=Whenever another creature enters the battlefield, Unstable Shapeshifter becomes a copy of that creature and gains this ability.
mana={3}{U}
type=Creature
subtype=Shapeshifter
power=0
toughness=1
[/card]
[card]
name=Unstoppable Ash name=Unstoppable Ash
abilities=trample abilities=trample
auto=aslongas(other treefolk|mybattlefield) choice notatarget(other treefolk|mybattlefield) (blink)forsrc oneshot auto=aslongas(other treefolk|mybattlefield) choice notatarget(other treefolk|mybattlefield) (blink)forsrc oneshot

View File

@@ -10,6 +10,7 @@ inplay:22897
[DO] [DO]
106525 106525
choice 0 choice 0
106525
[ASSERT] [ASSERT]
FIRSTMAIN FIRSTMAIN
[PLAYER1] [PLAYER1]

View File

@@ -2055,6 +2055,7 @@ public:
class AACopier: public ActivatedAbility class AACopier: public ActivatedAbility
{ {
public: public:
bool isactivated;
vector<MTGAbility *> currentAbilities; vector<MTGAbility *> currentAbilities;
MTGAbility * andAbility; MTGAbility * andAbility;
AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL); AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);

View File

@@ -123,6 +123,7 @@ public:
MTGCardInstance * previous; MTGCardInstance * previous;
MTGCardInstance * next; MTGCardInstance * next;
MTGAbility * TokenAndAbility; MTGAbility * TokenAndAbility;
MTGAbility * GrantedAndAbility;
int doDamageTest; int doDamageTest;
bool skipDamageTestOnce; bool skipDamageTestOnce;
int summoningSickness; int summoningSickness;
@@ -249,6 +250,7 @@ public:
int getCurrentToughness(); int getCurrentToughness();
int LKIpower; int LKIpower;
int LKItoughness; int LKItoughness;
int countDuplicateCardNames();
void cdaPT(int p = 0, int t = 0); void cdaPT(int p = 0, int t = 0);
bool isCDA; bool isCDA;
void switchPT(bool apply = false); void switchPT(bool apply = false);

View File

@@ -423,19 +423,19 @@ public:
}; };
/* /*
* Rule 420.5e (Legend Rule) * 704.5k If a player controls two or more legendary permanents with the same name,
* If two or more legendary permanents with the same name are in play, all are put into their * that player chooses one of them, and the rest are put into their owners graveyards.
* owners' graveyards. This is called the "legend rule." If only one of those permanents is * This is called the legend rule.
* legendary, this rule doesn't apply.
*/ */
class MTGLegendRule: public ListMaintainerAbility class MTGLegendRule: public PermanentAbility
{ {
public: public:
TargetChooser * tcL;
MTGAbility * Legendrule;
MTGAbility * LegendruleAbility;
MTGAbility * LegendruleGeneric;
MTGLegendRule(GameObserver* observer, int _id); MTGLegendRule(GameObserver* observer, int _id);
int canBeInList(MTGCardInstance * card); int receiveEvent(WEvent * event);
int added(MTGCardInstance * card);
int removed(MTGCardInstance * card);
int testDestroy();
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
virtual MTGLegendRule * clone() const; virtual MTGLegendRule * clone() const;
}; };

View File

@@ -79,6 +79,11 @@ struct WEventDamageStackResolved : public WEvent {
WEventDamageStackResolved(); WEventDamageStackResolved();
}; };
struct WEventGameStateBasedChecked : public WEvent {
WEventGameStateBasedChecked();
};
struct WEventPhasePreChange : public WEvent { struct WEventPhasePreChange : public WEvent {
Phase * from; Phase * from;
Phase * to; Phase * to;

View File

@@ -2768,7 +2768,7 @@ int AIPlayerBaka::chooseAttackers()
opponentCreatures = getCreaturesInfo(opponent(), INFO_NBCREATURES, -1); opponentCreatures = getCreaturesInfo(opponent(), INFO_NBCREATURES, -1);
opponentForce = getCreaturesInfo(opponent(), INFO_CREATURESPOWER, -1); opponentForce = getCreaturesInfo(opponent(), INFO_CREATURESPOWER, -1);
attack = (myCreatures >= opponentCreatures && myForce > opponentForce) attack = (myCreatures >= opponentCreatures && myForce > opponentForce)
|| (myForce > opponentForce) || (myForce > opponent()->life); || (myForce > opponentForce) || (myForce > opponent()->life) || ((life - opponentForce) > 30) ;
} }
printf("Choose attackers : %i %i %i %i -> %i\n", opponentForce, opponentCreatures, myForce, myCreatures, attack); printf("Choose attackers : %i %i %i %i -> %i\n", opponentForce, opponentCreatures, myForce, myCreatures, attack);

View File

@@ -1539,6 +1539,7 @@ AACopier::AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, M
{ {
target = _target; target = _target;
andAbility = NULL; andAbility = NULL;
isactivated = false;
} }
int AACopier::resolve() int AACopier::resolve()
@@ -1546,6 +1547,8 @@ int AACopier::resolve()
MTGCardInstance * _target = (MTGCardInstance *) target; MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target) if (_target)
{ {
if(isactivated)
source->isPhased = true;
bool tokencopied = false; bool tokencopied = false;
if(_target->isToken || (_target->isACopier && _target->hasCopiedToken)) if(_target->isToken || (_target->isACopier && _target->hasCopiedToken))
tokencopied = true; tokencopied = true;
@@ -1606,6 +1609,57 @@ int AACopier::resolve()
TokenandAbilityClone->addToGame(); TokenandAbilityClone->addToGame();
} }
} }
if(isactivated)
{//activated version grant
source->GrantedAndAbility = andAbility;
AbilityFactory af(game);
for(unsigned int i = 0;i < source->cardsAbilities.size();i++)
{
MTGAbility * a = dynamic_cast<MTGAbility *>(source->cardsAbilities[i]);
if(a) game->removeObserver(a);
}
source->cardsAbilities.clear();
source->magicText = _target->magicText;
af.getAbilities(&currentAbilities, NULL, source);
for (size_t i = 0; i < currentAbilities.size(); ++i)
{
MTGAbility * a = currentAbilities[i];
a->source = (MTGCardInstance *) source;
if (a)
{
if (a->oneShot)
{
SAFE_DELETE(a);
}
else
{
a->addToGame();
MayAbility * dontAdd = dynamic_cast<MayAbility*>(a);
if(!dontAdd)
{
source->cardsAbilities.push_back(a);
}
}
}
}
if(source->GrantedAndAbility)
{
MTGAbility * andAbilityClone = source->GrantedAndAbility->clone();
andAbilityClone->target = source;
if(andAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
}
source->isPhased = false;
}
return 1; return 1;
} }
return 0; return 0;
@@ -7953,7 +8007,7 @@ int AACastCard::resolveSpell()
if (putinplay && (_target->hasType(Subtypes::TYPE_ARTIFACT)||_target->hasType(Subtypes::TYPE_CREATURE)||_target->hasType(Subtypes::TYPE_ENCHANTMENT)||_target->hasType(Subtypes::TYPE_PLANESWALKER))) if (putinplay && (_target->hasType(Subtypes::TYPE_ARTIFACT)||_target->hasType(Subtypes::TYPE_CREATURE)||_target->hasType(Subtypes::TYPE_ENCHANTMENT)||_target->hasType(Subtypes::TYPE_PLANESWALKER)))
copy =_target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->battlefield,noEvent); copy =_target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->battlefield,noEvent);
else else
copy =_target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->stack,noEvent); copy =_target->controller()->game->putInZone(_target, _target->currentZone, _target->controller()->game->stack,noEvent);
copy->changeController(source->controller(),true); copy->changeController(source->controller(),true);
if(asNormalMadness) if(asNormalMadness)
copy->MadnessPlay = true; copy->MadnessPlay = true;

View File

@@ -129,8 +129,9 @@ int Counters::addCounter(const char * _name, int _power, int _toughness, bool _n
g->receiveEvent(w); g->receiveEvent(w);
} }
mCount++; mCount++;
this->target->doDamageTest = 1; /*the damage test should be handled on game state based effect i think*/
this->target->afterDamage(); //this->target->doDamageTest = 1;
//this->target->afterDamage();
} }
delete(e); delete(e);
return mCount; return mCount;

View File

@@ -1061,6 +1061,9 @@ void GameObserver::gameStateBasedEffects()
|| mCurrentGamePhase == MTG_PHASE_COMBATDAMAGE)) || mCurrentGamePhase == MTG_PHASE_COMBATDAMAGE))
userRequestNextGamePhase(); userRequestNextGamePhase();
} }
//WEventGameStateBasedChecked event checked
receiveEvent(NEW WEventGameStateBasedChecked());
} }
void GameObserver::enchantmentStatus() void GameObserver::enchantmentStatus()

View File

@@ -536,6 +536,14 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
if(!card->discarded) if(!card->discarded)
return 0; return 0;
} }
check = restriction[i].find("cardistargeted");
if(check != string::npos)
{
bool istarget = card->isTargetted();
if(!istarget)
return 0;
}
check = restriction[i].find("copiedacard"); check = restriction[i].find("copiedacard");
if(check != string::npos) if(check != string::npos)
@@ -2781,6 +2789,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
MTGAbility * a = NEW AACopier(observer, id, card, target); MTGAbility * a = NEW AACopier(observer, id, card, target);
a->oneShot = 1; a->oneShot = 1;
a->canBeInterrupted = false; a->canBeInterrupted = false;
((AACopier*)a)->isactivated = activated;
//andability //andability
if(storedAndAbility.size()) if(storedAndAbility.size())
{ {

View File

@@ -140,11 +140,15 @@ void MTGCardInstance::copy(MTGCardInstance * card)
int castMethodBackUP = this->castMethod; int castMethodBackUP = this->castMethod;
mtgid = source->getId(); mtgid = source->getId();
MTGCardInstance * oldStored = this->storedSourceCard; MTGCardInstance * oldStored = this->storedSourceCard;
Spell * spell = NEW Spell(observer, this); if(!isPhased)
observer = card->observer; {
AbilityFactory af(observer); Spell * spell = NEW Spell(observer, this);
af.addAbilities(observer->mLayers->actionLayer()->getMaxId(), spell); observer = card->observer;
delete spell; AbilityFactory af(observer);
af.addAbilities(observer->mLayers->actionLayer()->getMaxId(), spell);
delete spell;
}
if(observer->players[1]->playMode == Player::MODE_TEST_SUITE) if(observer->players[1]->playMode == Player::MODE_TEST_SUITE)
mtgid = backupid; // there must be a way to get the token id... mtgid = backupid; // there must be a way to get the token id...
else else
@@ -284,6 +288,7 @@ void MTGCardInstance::initMTGCI()
previous = NULL; previous = NULL;
next = NULL; next = NULL;
TokenAndAbility = NULL; TokenAndAbility = NULL;
GrantedAndAbility = NULL;
lastController = NULL; lastController = NULL;
regenerateTokens = 0; regenerateTokens = 0;
blocked = false; blocked = false;
@@ -823,6 +828,22 @@ int MTGCardInstance::getCurrentToughness()
return toughness; return toughness;
} }
int MTGCardInstance::countDuplicateCardNames()
{
int count = 0;
if(observer)
{
int nb_cards = controller()->game->battlefield->nb_cards;
for(int x = 0; x < nb_cards; x++)
{
if(controller()->game->battlefield->cards[x]->name == this->name)
count+=1;
}
}
return count;
}
//check stack //check stack
bool MTGCardInstance::StackIsEmptyandSorcerySpeed() bool MTGCardInstance::StackIsEmptyandSorcerySpeed()
{ {

View File

@@ -3205,76 +3205,55 @@ MTGTokensCleanup * MTGTokensCleanup::clone() const
/* Legend Rule */ /* Legend Rule */
MTGLegendRule::MTGLegendRule(GameObserver* observer, int _id) : MTGLegendRule::MTGLegendRule(GameObserver* observer, int _id) :
ListMaintainerAbility(observer, _id) PermanentAbility(observer, _id)
{ {
tcL = NULL;
Legendrule = NULL;
LegendruleAbility = NULL;
LegendruleGeneric = NULL;
} }
; ;
int MTGLegendRule::canBeInList(MTGCardInstance * card) int MTGLegendRule::receiveEvent(WEvent * event)
{ {
if(card->isPhased) WEventGameStateBasedChecked * e = dynamic_cast<WEventGameStateBasedChecked*> (event);
return 0; if (e)
if (card->hasType(Subtypes::TYPE_LEGENDARY) && card->controller()->game->inPlay->hasCard(card))
{ {
if(card->has(Constants::NOLEGEND)||card->controller()->opponent()->inPlay()->hasAbility(Constants::NOLEGENDRULE)||card->controller()->inPlay()->hasAbility(Constants::NOLEGENDRULE)) for (int i = 0; i < 2; i++)
return 0;
else
return 1;
}
return 0;
}
int MTGLegendRule::added(MTGCardInstance * card)
{
map<MTGCardInstance *, bool>::iterator it;
int destroy = 0;
vector<MTGCardInstance*>oldCards;
for (it = cards.begin(); it != cards.end(); it++)
{
MTGCardInstance * comparison = (*it).first;
if (comparison != card && comparison->controller() == card->controller() && !(comparison->getName().compare(card->getName())))
{ {
oldCards.push_back(comparison); MTGGameZone * zone = game->players[i]->game->inPlay;
destroy = 1; for (int k = zone->nb_cards - 1; k >= 0; k--)
{
MTGCardInstance * card = zone->cards[k];
if (card && card->hasType(Subtypes::TYPE_LEGENDARY) && !card->isPhased)
{
if(card->has(Constants::NOLEGEND)||card->controller()->opponent()->inPlay()->hasAbility(Constants::NOLEGENDRULE)||card->controller()->inPlay()->hasAbility(Constants::NOLEGENDRULE))
;
else
if(card->countDuplicateCardNames() > 1)
{
vector<MTGAbility*>selection;
TargetChooserFactory tfL(game);
tcL = tfL.createTargetChooser("*[share!name!]|mybattlefield",card->clone());
tcL->targetter = NULL;
tcL->maxtargets = card->countDuplicateCardNames()-1;
Legendrule = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), card, NULL,"ownergraveyard","Put in Graveyard");
Legendrule->oneShot = true;
Legendrule->canBeInterrupted = false;
LegendruleAbility = NEW GenericTargetAbility(game, "","",game->mLayers->actionLayer()->getMaxId(), card,tcL, Legendrule->clone());
LegendruleAbility->oneShot = true;
LegendruleAbility->canBeInterrupted = false;
LegendruleGeneric = NEW GenericAddToGame(game, game->mLayers->actionLayer()->getMaxId(), card,NULL,LegendruleAbility->clone());
LegendruleGeneric->oneShot = true;
selection.push_back(LegendruleGeneric->clone());
MTGAbility * menuChoice = NEW MenuAbility(game, game->mLayers->actionLayer()->getMaxId(), card, card,true,selection,card->controller(),"Legendary Rule");
menuChoice->addToGame();
return 1;
}
}
}
} }
} }
if (game->mLayers->stackLayer()->count(0, NOT_RESOLVED) != 0)
destroy = 0;
if (game->mLayers->actionLayer()->menuObject)
destroy = 0;
if (game->getCurrentTargetChooser() || game->mLayers->actionLayer()->isWaitingForAnswer())
destroy = 0;
if(destroy)
{
vector<MTGAbility*>selection;
MultiAbility * multi = NEW MultiAbility(game, game->mLayers->actionLayer()->getMaxId(), card, card, NULL);
for(unsigned int i = 0;i < oldCards.size();i++)
{
AAMover *a = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), card, oldCards[i],"ownergraveyard","Keep New");
a->oneShot = true;
multi->Add(a);
}
multi->oneShot = 1;
MTGAbility * a1 = multi;
selection.push_back(a1);
AAMover *b = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), card, card,"ownergraveyard","Keep Old");
b->oneShot = true;
MTGAbility * b1 = b;
selection.push_back(b1);
MTGAbility * menuChoice = NEW MenuAbility(game, game->mLayers->actionLayer()->getMaxId(), card, card,true,selection,card->controller(),"Legendary Rule");
menuChoice->addToGame();
}
return 1;
}
int MTGLegendRule::removed(MTGCardInstance *)
{
return 0;
}
int MTGLegendRule::testDestroy()
{
return 0; return 0;
} }

View File

@@ -31,6 +31,11 @@ WEventDamageStackResolved::WEventDamageStackResolved() :
{ {
} }
WEventGameStateBasedChecked::WEventGameStateBasedChecked() :
WEvent()
{
}
WEventCardUpdate::WEventCardUpdate(MTGCardInstance * card) : WEventCardUpdate::WEventCardUpdate(MTGCardInstance * card) :
WEvent(), card(card) WEvent(), card(card)
{ {