From 3bd3933c66f766d75cda1def4cfe7da81d3f3ab9 Mon Sep 17 00:00:00 2001 From: Vittorio Alfieri Date: Thu, 18 May 2023 23:04:22 +0200 Subject: [PATCH] Added new prmitives from MOM set, fixed primitives, improved flipacoin ability, imporved battle cards defeated trigger, added new filters for event to check permanents on graveyard. --- .../bin/Res/sets/primitives/borderline.txt | 181 +++++++++++++++--- projects/mtg/include/AllAbilities.h | 33 +++- projects/mtg/include/MTGCardInstance.h | 1 + projects/mtg/include/WEvent.h | 6 + projects/mtg/src/AllAbilities.cpp | 28 ++- projects/mtg/src/MTGAbility.cpp | 63 +++++- projects/mtg/src/MTGCardInstance.cpp | 1 + projects/mtg/src/MTGGameZones.cpp | 26 ++- projects/mtg/src/MTGRules.cpp | 10 + projects/mtg/src/WEvent.cpp | 11 ++ 10 files changed, 316 insertions(+), 44 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/borderline.txt b/projects/mtg/bin/Res/sets/primitives/borderline.txt index 8911b5a73..b0ca91a69 100644 --- a/projects/mtg/bin/Res/sets/primitives/borderline.txt +++ b/projects/mtg/bin/Res/sets/primitives/borderline.txt @@ -4328,6 +4328,17 @@ mana={1}{W} type=Enchantment [/card] [card] +name=Ashen Reaper +abilities=menace +auto=@each my end restriction{deadpermanent}:name(Put 1/1 counter) name(Put 1/1 counter) counter(1/1) +text=Menace -- At the beginning of your end step, put a +1/+1 counter on Ashen Reaper if a permanent was put into a graveyard from the battlefield this turn. +color=black,red +type=Creature +subtype=Zombie Elemental +power=2 +toughness=1 +[/card] +[card] name=Ashiok's Erasure abilities=flash auto=name(Exile spell) target(*|stack) spellmover(exileimp) @@ -5255,6 +5266,15 @@ mana={3}{B}{B} type=Sorcery [/card] [card] +name=Awaken the Maelstrom +abilities=doublefacedeath +auto=choice name(Controller draws) transforms((,newability[draw:2 controller],newability[ability$!may name(Put artifact in play) target(artifact|myhand) moveto(mybattlefield)!$ controller],newability[ability$!name(Copy permanent) target(*|mybattlefield) clone!$ controller],newability[thisforeach(variable{3}) ability$!name(Put 1/1 counter) target(creature|mybattlefield) counter(1/1)!$ controller],newability[ability$!name(Destroy permanent) target(*|opponentbattlefield) destroy!$ controller])) forever +auto=choice name(Opponent draws) transforms((,newability[draw:2 opponent],newability[ability$!may name(Put artifact in play) target(artifact|myhand) moveto(mybattlefield)!$ controller],newability[ability$!name(Copy permanent) target(*|mybattlefield) clone!$ controller],newability[thisforeach(variable{3}) ability$!name(Put 1/1 counter) target(creature|mybattlefield) counter(1/1)!$ controller],newability[ability$!name(Destroy permanent) target(*|opponentbattlefield) destroy!$ controller])) forever +text=Awaken the Maelstrom is all colors. -- Target player draws two cards. You may put an artifact card from your hand onto the battlefield. Create a token that's a copy of a permanent you control. Distribute three +1/+1 counters among one, two, or three creatures you control. Destroy target permanent an opponent controls. +color=white,blue,black,red,green +type=Sorcery +[/card] +[card] name=Awaken the Sky Tyrant auto=@damageof(player) from(*|opponentstack,opponentbattlefield,opponentgraveyard,opponenthand,opponentexile,opponentsideboard):may sacrifice && _DRAGONTOKEN_ controller text=When a source an opponent controls deals damage to you, sacrifice Awaken the Sky Tyrant. If you do, create a 5/5 red Dragon creature token with flying. @@ -10827,7 +10847,6 @@ name=Brimaz, Blight of Oreskos auto=@movedTo(creature[artifact]|mystack):name(Incubate X) name(Incubate X) all(trigger[to]) transforms((,newability[name(Incubate X) name(Incubate X) activate castcard(noevent costx!:manacost:! named!:Incubator:!)])) oneshot auto=@movedTo(creature[-artifact&phyrexian]|mystack):name(Incubate X) name(Incubate X) all(trigger[to]) transforms((,newability[name(Incubate X) name(Incubate X) activate castcard(noevent costx!:manacost:! named!:Incubator:!)])) oneshot auto=@movedTo(phyrexian|graveyard) from(mybattlefield):name(Proliferate) _PROLIFERATE_ -auto=@movedTo(*[counter{0/0.1.Phyrexian}]|graveyard) from(mybattlefield):name(Proliferate) _PROLIFERATE_ text=Whenever you cast a Phyrexian creature or artifact creature spell, incubate X, where X is that spell's mana value. (Create an Incubator token with X +1/+1 counters on it and "{2}: Transform this artifact." It transforms into a 0/0 Phyrexian artifact creature.) -- At the beginning of each end step, if a Phyrexian died under your control this turn, proliferate. mana={2}{W}{B} type=Legendary Creature @@ -34043,7 +34062,6 @@ name=Gift of Compleation auto=name(Incubate 3) name(Incubate 3) activate castcard(noevent costx!:3:! named!:Incubator:!) aicode=activate transforms((,newability[surveil],newability[all(*[zpos<=psurveiloffsetplus1plusend]|mylibrary) transforms((,newability[if compare(genrand2)~equalto~1 then moveto(mygraveyard)])) oneshot])) oneshot auto=@movedTo(phyrexian|graveyard) from(mybattlefield):name(Surveil 1) reveal:psurveiloffsetplus1plusend optionone name(put in graveyard) target(*|reveal) moveto(ownergraveyard) optiononeend optiontwo name(put in library) target(*|reveal) moveto(ownerlibrary) optiontwoend afterrevealed surveil afterrevealedend revealend -auto=@movedTo(*[counter{0/0.1.Phyrexian}]|graveyard) from(mybattlefield):name(Surveil 1) reveal:psurveiloffsetplus1plusend optionone name(put in graveyard) target(*|reveal) moveto(ownergraveyard) optiononeend optiontwo name(put in library) target(*|reveal) moveto(ownerlibrary) optiontwoend afterrevealed surveil afterrevealedend revealend text=When Gift of Compleation enters the battlefield, incubate 3. (Create an Incubator token with three +1/+1 counters on it and "{2}: Transform this artifact." It transforms into a 0/0 Phyrexian artifact creature.) -- Whenever a Phyrexian you control dies, surveil 1. (Look at the top card of your library. You may put that card into your graveyard.) mana={1}{B} type=Enchantment @@ -36477,7 +36495,7 @@ toughness=4 [card] name=Grandmother Ravi Sengir abilities=flying -auto=@movedTo(creature|graveyard) from(opponentbattlefield):name(Put 1/1 counter) name(Put 1/1 counter) target(*[creature&legendary&human&wizard&isflipped]|mybattlefield) counter(1/1) +auto=@movedTo(creature|graveyard) from(opponentbattlefield):name(Put 1/1 counter) name(Put 1/1 counter) counter(1/1) auto=@movedTo(creature|graveyard) from(opponentbattlefield):name(Gain 1 life) life:1 controller text=Flying -- Whenever a creature an opponent controls dies, put a +1/+1 counter on Grandmother Ravi Sengir and you gain 1 life. color=black @@ -41851,8 +41869,7 @@ type=Artifact [/card] [card] name=Ichor Shade -auto=@each my end restriction{morbid}:name(Put 1/1 counter) name(Put 1/1 counter) counter(1/1) -auto=@each my end restriction{type(artifact[-creature&fresh]|mygraveyard)~morethan~0}:name(Put 1/1 counter) name(Put 1/1 counter) counter(1/1) +auto=@each my end restriction{deadcreart}:name(Put 1/1 counter) name(Put 1/1 counter) counter(1/1) text=At the beginning of your end step, if an artifact or creature was put into a graveyard from the battlefield this turn, put a +1/+1 counter on Ichor Shade. mana={2}{B} type=Creature @@ -43318,6 +43335,17 @@ mana={B}{G} type=Instant [/card] [card] +name=Inga and Esika +auto=lord(creature|mybattlefield) transforms((,newability[vigilance],newability[this(variable{type:creature:myrestrictedcastingzone}>0) {T}:add{W}],newability[this(variable{type:creature:myrestrictedcastingzone}>0) {T}:add{U}],newability[this(variable{type:creature:myrestrictedcastingzone}>0) {T}:add{B}],newability[this(variable{type:creature:myrestrictedcastingzone}>0) {T}:add{R}],newability[this(variable{type:creature:myrestrictedcastingzone}>0) {T}:add{G}])) +auto=@movedTo(creature[manacost>=3]|mystack):may name(Draw a card) draw:1 controller +text=Creatures you control have vigilance and "{T}: Add one mana of any color. Spend this mana only to cast a creature spell." -- Whenever you cast a creature spell, if three or more mana from creatures was spent to cast it, draw a card. +mana={2}{G}{U} +type=Legendary Creature +subtype=Human God +power=4 +toughness=4 +[/card] +[card] name=Inga Rune-Eyes aicode=activate transforms((,newability[all(*[zpos<=3]|mylibrary) transforms((,newability[may name(Put on bottom of library) moveto(myreveal) and!( bottomoflibrary )!])) oneshot])) oneshot auto=_SCRY3_ @@ -43433,6 +43461,17 @@ power=3 toughness=1 [/card] [card] +name=Injector Crocodile +autohand={2}{cycle}:name(search swamp) target(swamp|myLibrary) moveTo(myHand) and!( shuffle )! +auto=_DIES_name(Incubate 3) name(Incubate 3) activate castcard(noevent costx!:3:! named!:Incubator:!) +text=When Injector Crocodile dies, incubate 3. (Create an Incubator token with three +1/+1 counters on it and "{2}: Transform this artifact." It transforms into a 0/0 Phyrexian artifact creature.) -- Swampcycling {2} ({2}, Discard this card: Search your library for a Swamp card, reveal it, put it into your hand, then shuffle.) +mana={4}{B}{B} +type=Creature +subtype=Phyrexian Crocodile +power=5 +toughness=5 +[/card] +[card] name=Inkling Summoning auto=token(Inkling,Creature Inkling,2/1,white,black,flying) text=Create a 2/1 white and black Inkling creature token with flying. @@ -44079,6 +44118,38 @@ power=4 toughness=5 [/card] [card] +name=Invasion of Alara +backside=Awaken the Maelstrom +restriction=compare(isflipped)~equalto~0 +anyzone={0}:doubleside(backside) +auto=counter(0/0.7.Defense) +auto=if type(*[-land;manacost<=4]|mylibrary)~morethan~1 then ability$!name(Put card in hand) name(Put card in hand) name(Put card in hand) target(*[-land;manacost<=4]|mylibrary) moveto(myhand) and!( transforms((,newability[may name(Cast another card) target(*[-land;manacost<=4]|mylibrary) activate castcard(normal)])) oneshot )! !$ controller +auto=if type(*[-land;manacost<=4]|mylibrary)~equalto~1 then ability$!name(Choose card) name(Choose card) name(Choose card) target(*[-land;manacost<=4]|mylibrary) moveto(myhand) and!( transforms((,newability[may name(Cast card) activate castcard(normal)])) oneshot )! !$ controller +auto=moveto(opponentbattlefield) +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( moveto(ownergraveyard) and!( transforms((,newability[activate castcard(copied named!:awaken the maelstrom:!)])) oneshot )! )! +text=When Invasion of Alara enters the battlefield, exile cards from the top of your library until you exile two nonland cards with mana value 4 or less. You may cast one of those two cards without paying its mana cost. Put one of them into your hand. Then put the other cards exiled this way on the bottom of your library in a random order. +mana={W}{U}{B}{R}{G} +type=Battle +subtype=Siege +[/card] +[card] +name=Invasion of Amonkhet +backside=Lazotep Convert +restriction=compare(isflipped)~equalto~0 +anyzone={0}:doubleside(backside) +auto=counter(0/0.4.Defense) +auto=ability$!name(Mill 3 cards) deplete:3!$ opponent +auto=ability$!name(Mill 3 cards) deplete:3!$ controller +auto=ability$!name(Discard a card) target(*|myhand) reject!$ opponent +auto=ability$!name(Draw a card) draw:1!$ controller +auto=moveto(opponentbattlefield) +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Creature Zombie) )! +text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Amonkhet enters the battlefield, each player mills three cards, then each opponent discards a card and you draw a card. (To mill three cards, a player puts the top three cards of their library into their graveyard.) +mana={1}{U}{B} +type=Battle +subtype=Siege +[/card] +[card] name=Invasion of Arcavios backside=Invocation of the Founders restriction=compare(isflipped)~equalto~0 @@ -44086,13 +44157,27 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.7.Defense) auto=ability$!name(Search card) name(Search card) target(*[instant;sorcery]|mylibrary,mygraveyard,mysideboard) moveto(myhand)!$ controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Arcavios enters the battlefield, search your library, graveyard, and/or outside the game for an instant or sorcery card you own, reveal it, and put it into your hand. If you search your library this way, shuffle. mana={3}{U}{U} type=Battle subtype=Siege [/card] [card] +name=Invasion of Azgol +backside=Ashen Reaper +restriction=compare(isflipped)~equalto~0 +anyzone={0}:doubleside(backside) +auto=counter(0/0.4.Defense) +auto=choice name name(Target opponent) transforms((,newability[life:-1 opponent],newability[ability$!name(Sacrifice creature or planeswalker) notatarget(*[creature;planeswalker]|mybattlefield) sacrifice!$ opponent],newability[moveto(opponentbattlefield)])) oneshot +auto=choice name name(Target controller) transforms((,newability[life:-1 controller],newability[ability$!name(Sacrifice creature or planeswalker) notatarget(*[creature;planeswalker]|mybattlefield) sacrifice!$ controller],newability[moveto(opponentbattlefield)])) oneshot +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Creature Zombie Elemental) )! +text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Azgol enters the battlefield, target player sacrifices a creature or planeswalker and loses 1 life. +mana={B}{R} +type=Battle +subtype=Siege +[/card] +[card] name=Invasion of Belenon backside=Belenon War Anthem restriction=compare(isflipped)~equalto~0 @@ -44100,7 +44185,7 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.3.Defense) auto=name(Create knight) token(Knight,Creature Knight,2/2,white,blue,vigilance) auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Belenon enters the battlefield, create a 2/2 white and blue Knight creature token with vigilance. mana={2}{W} type=Battle @@ -44115,7 +44200,7 @@ auto=counter(0/0.5.Defense) auto=name(Gain 4 life) life:4 controller auto=name(Draw a card) draw:1 controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Creature Angel) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Creature Angel) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Dominaria enters the battlefield, you gain 4 life and draw a card. mana={2}{W} type=Battle @@ -44129,13 +44214,28 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.4.Defense) auto=ability$!name(Discard 2 cards) name(Discard 2 cards) notatarget(<2>*|myhand) reject!$ opponent auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Eldraine enters the battlefield, target opponent discards two cards. mana={3}{B} type=Battle subtype=Siege [/card] [card] +name=Invasion of Ergamon +backside=Truga Cliffcharger +restriction=compare(isflipped)~equalto~0 +anyzone={0}:doubleside(backside) +auto=counter(0/0.4.Defense) +auto=ability$!name(Create treasure) token(Treasure Sur)!$ controller +auto=ability$!may name(Discard and draw) target(*|myhand) reject and!( transforms((,newability[draw:1 controller])) oneshot )!!$ controller +auto=moveto(opponentbattlefield) +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Creature Rhino) )! +text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Ergamon enters the battlefield, create a Treasure token. Then you may discard a card. If you do, draw a card. +mana={R}{G} +type=Battle +subtype=Siege +[/card] +[card] name=Invasion of Fiora backside=Marchesa, Resolute Monarch restriction=compare(isflipped)~equalto~0 @@ -44143,7 +44243,7 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.4.Defense) auto=ability$!name(Choose one) choice name(Destroy all legendary creatures) all(creature[legendary]|battlefield) destroy _ choice name(Destroy all non-legendary creatures) all(creature[-legendary]|battlefield) destroy _ choice name(Destroy all creatures) all(creature|battlefield) destroy!$ controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Fiora enters the battlefield, choose one or both -- Destroy all legendary creatures. -- Destroy all nonlegendary creatures. mana={4}{B}{B} type=Battle @@ -44158,7 +44258,7 @@ auto=counter(0/0.3.Defense) auto=if type(*[-land]|opponenthand)~morethan~0 then ability$!name(Look opponent's hand) name(Look opponent's hand) target(*[-land]|opponenthand) moveto(myreveal) and!( transforms((,newability[choice name(Exile card) moveto(opponentexile) and!( transforms((,newability[canplayfromexile],newability[changecost(colorless:2) forcedalive])) forever )!],newability[choice name(Don't exile card) moveto(opponenthand)])) forever )! !$ controller auto=if type(*[-land]|opponenthand)~equalto~0 then ability$!name(Look opponent's hand) name(Look opponent's hand) target(*|opponenthand) moveto(opponentreveal) and!( moveto(opponenthand) )! !$ controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Gobakhan enters the battlefield, look at target opponent's hand. You may exile a nonland card from it. For as long as that card remains exiled, its owner may play it. A spell cast this way costs {2} more to cast. mana={1}{W} type=Battle @@ -44173,7 +44273,7 @@ aicode=activate transforms((,newability[if type(*[-instant;-sorcery;zpos<=5]|myL auto=counter(0/0.4.Defense) auto=ability$!name(Look top 5 cards) name(Look top 5 cards) reveal:5 optionone name(Get a permanent) target(*[-instant;-sorcery]|reveal) moveto(myhand) optiononeend optiontwo name(Put on bottom) target(*|reveal) bottomoflibrary and!( all(*|reveal) bottomoflibrary )! optiontwoend revealend!$ controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Creature Dinosaur) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Creature Dinosaur) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Ixalan enters the battlefield, look at the top five cards of your library. You may reveal a permanent card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. mana={1}{G} type=Battle @@ -44227,7 +44327,7 @@ auto=if compare(fullpaid)~equalto~19 then if type(creature[-human&manacost<=19]| auto=if compare(fullpaid)~equalto~19 then if type(creature[-human&manacost<=19]|mygravelibrary)~equalto~0 then moveto(opponentbattlefield) auto=if compare(fullpaid)~morethan~19 then if type(creature[-human&manacost<=20]|mygravelibrary)~morethan~0 then name(Search creature) name(Search creature) name(Search creature) target(creature[-human&manacost<=20]|mygravelibrary) moveto(mybattlefield) and!( all(this) moveto(opponentbattlefield) )! auto=if compare(fullpaid)~morethan~19 then if type(creature[-human&manacost<=20]|mygravelibrary)~equalto~0 then moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Legendary Creature Dinosaur) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Legendary Creature Dinosaur) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Ikoria enters the battlefield, search your library and/or graveyard for a non-Human creature card with mana value X or less and put it onto the battlefield. If you search your library this way, shuffle. mana={X}{G}{G} type=Battle @@ -44242,7 +44342,7 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.5.Defense) auto=ability$!name(Creature gets -13/-13) name(Creature gets -13/-13) target(creature|opponentBattlefield) -13/-13 ueot!$ controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- Flash -- When Invasion of Innistrad enters the battlefield, target creature an opponent controls gets -13/-13 until end of turn. mana={2}{B}{B} type=Battle @@ -44256,7 +44356,7 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.4.Defense) auto=ability$!name(Tap creature or artifact) name(Tap creature or artifact) target(*[creature;artifact]|opponentbattlefield) transforms((,newability[tap],newability[counter(0/0.1.Stun)])) oneshot!$ controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Creature Moonfolk Ninja) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Creature Moonfolk Ninja) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Kamigawa enters the battlefield, tap target artifact or creature an opponent controls and put a stun counter on it. (If a permanent with a stun counter would become untapped, remove one from it instead.) mana={3}{U} type=Battle @@ -44270,7 +44370,7 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.4.Defense) auto=ability$!name(Damage creatures and planeswalkers) name(Damage creatures and planeswalkers) all(*[creature;planeswalker]|battlefield) damage:3!$ controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Karsus enters the battlefield, it deals 3 damage to each creature and each planeswalker. mana={2}{R}{R} type=Battle @@ -44284,7 +44384,7 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.4.Defense) auto=name(Exile cards) name(Exile cards) all(*|myhand) moveto(myexile) and!( transforms((,newability[draw:1 controller],newability[counter(0/0.1.InvasionExiled) notrg],newability[this(counter{0/0.1.InvasionExiled}>0) canplayfromexile],newability[@each untap restriction{compare(hascntinvasionexiled)~morethan~0}:transforms((,newability[canplayfromexile])) ueot],newability[@each my upkeep restriction{compare(hascntinvasionexiled)~morethan~0}:removeallcounters(0/0.1.InvasionExiled)])) forever )! auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Kaldheim enters the battlefield, exile all cards from your hand, then draw that many cards. Until the end of your next turn, you may play cards exiled this way. mana={3}{R} type=Battle @@ -44298,7 +44398,7 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.4.Defense) auto=ability$!may name(Discard and draw) target(*|myhand) reject and!( draw:2 controller )!!$ controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Mercadia enters the battlefield, you may discard a card. If you do, draw two cards. mana={1}{R} type=Battle @@ -44312,7 +44412,7 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.6.Defense) auto=ability$!name(Put counter and fight) name(Put counter and fight) target(creature|mybattlefield) transforms((,newability[counter(1/1)],newability[may name(Fights another creature) target(creature|opponentbattlefield) dynamicability])) ueot!$ controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Creature Ooze) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Creature Ooze) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Muraganda enters the battlefield, put a +1/+1 counter on target creature you control. Then that creature fights up to one target creature you don't control. mana={4}{G} type=Battle @@ -44326,7 +44426,7 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.4.Defense) auto=ability$!name(Exile opponent permanent) target(*[multicolor]|opponentbattlefield) moveto(exile)!$ controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Artifact Creature Construct) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Artifact Creature Construct) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Ravnica enters the battlefield, exile target nonland permanent an opponent controls that isn't exactly two colors. mana={5} type=Battle @@ -44340,7 +44440,7 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.5.Defense) auto=ability$!may name(Damage creature) name(Damage creatures) target(creature|battlefield) damage:1!$ controller auto=transforms((,newability[choice name(Damage opponent) damage:4 opponent && all(this) moveto(opponentbattlefield)],newability[choice name(Damage other battle) target(other *[battle]|battlefield) damage:4 && all(this) moveto(opponentbattlefield)])) oneshot -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Regatha enters the battlefield, it deals 4 damage to another target battle or opponent and 1 damage to up to one target creature. mana={2}{R} type=Battle @@ -44354,7 +44454,7 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.4.Defense) auto=name(Create 2 Kraken) token(Kraken,Creature Kraken,1/1,blue,trample)*2 auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Legendary Creature Serpent) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Legendary Creature Serpent) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Segovia enters the battlefield, create two 1/1 blue Kraken creature tokens with trample. mana={2}{U} type=Battle @@ -44368,7 +44468,7 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.6.Defense) auto=ability$!may name(Return 3 permanents) target(*[-instant;-sorcery]|mygraveyard) moveto(ownerhand)!$ controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Shandalar enters the battlefield, return up to three target permanent cards from your graveyard to your hand. mana={3}{G}{G} type=Battle @@ -44381,7 +44481,7 @@ restriction=compare(isflipped)~equalto~0 anyzone={0}:doubleside(backside) auto=counter(0/0.5.Defense) auto=transforms((,newability[choice name(Damage player) damage:type:dragon:myhandplus2plusend target(player) && all(this) moveto(opponentbattlefield)],newability[choice name(Damage permanent) target(other *|battlefield) damage:type:dragon:myhandplus2plusend && all(this) moveto(opponentbattlefield)])) oneshot -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! asSorcery +auto=@@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Enchantment) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Tarkir enters the battlefield, reveal any number of Dragon cards from your hand. When you do, Invasion of Tarkir deals X plus 2 damage to any other target, where X is the number of cards revealed this way. (X can be 0.) mana={1}{R} type=Battle @@ -44409,7 +44509,7 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.4.Defense) auto=ability$!name(Search library) name(Search library) target(*[aura;god;demigod]|mylibrary) moveto(myhand) and!( shuffle )! !$ controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Legendary Enchantment Creature) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Legendary Enchantment Creature) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Theros enters the battlefield, search your library for an Aura, God, or Demigod card, reveal it, put it into your hand, then shuffle. mana={2}{W} type=Battle @@ -44424,7 +44524,7 @@ auto=counter(0/0.5.Defense) auto=ability$!name(Deals 3 damage) name(Deals 3 damage) target(player,creature,planeswalker) damage:3!$ controller auto=name(Gain 3 life) life:3 controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Legendary Creature Human Wizard) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Legendary Creature Human Wizard) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Ulgrotha enters the battlefield, it deals 3 damage to any other target and you gain 3 life. mana={4}{B} type=Battle @@ -44438,7 +44538,7 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.4.Defense) auto=draw:3 controller && ability$!name(Discard a card) name(Discard a card) reject notatarget(*|myhand)!$ controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Artifact) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Artifact) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Vryn enters the battlefield, draw three cards, then discard a card. mana={3}{U} type=Battle @@ -44452,7 +44552,7 @@ anyzone={0}:doubleside(backside) auto=counter(0/0.6.Defense) auto=ability$!may name(Search 2 basic lands) target(land[basic]|mylibrary) moveto(mybattlefield) and!( transforms((,newability[tap(noevent)],newability[shuffle])) oneshot )!!$ controller auto=moveto(opponentbattlefield) -auto=@counterremoved(0/0,1,Defense) from(this) restriction{compare(hascntdefense)~equalto~0}:name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Creature Elemental) )! asSorcery +auto=@defeated(this):name(Exile and transforms) name(Exile and transforms) moveto(ownerexile) and!( flip(backside) forcetype(Creature Elemental) )! text=(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) -- When Invasion of Zendikar enters the battlefield, search your library for up to two basic land cards, put them onto the battlefield tapped, then shuffle. mana={3}{G} type=Battle @@ -48338,7 +48438,8 @@ toughness=6 [card] name=Krark, the Thumbless abilities=partner -auto=@movedTo(instant,sorcery|mystack):name(flip a coin) all(trigger[to]) flipacoin winability activate castcard(copied noevent) winabilityend loseability fizzleto(hand) loseabilityend flipend +auto=@movedTo(*[instant;sorcery]|mystack):name(Flip a coin) all(trigger[to]) flipacoin winability activate castcard(copied noevent) winabilityend loseability counter(0/0.1.KrarkEffect) loseabilityend flipend +auto=@counteradded(0/0.1.KrarkEffect) from(*[instant;sorcery]|mystack):name(Return spell to hand) target(*[counter{0/0.1.KrarkEffect}]|mystack) spellmover(hand) text=Whenever you cast an instant or sorcery spell, flip a coin. If you lose the flip, return that spell to its owner's hand. If you win the flip, copy that spell, and you may choose new targets for the copy. -- Partner (You can have two commanders if both have partner.) mana={1}{R} type=Legendary Creature @@ -49459,6 +49560,16 @@ power=1 toughness=3 [/card] [card] +name=Lazotep Convert +auto=may name(Enter as copy) target(creature|graveyard) copy and!( transforms((Zombie,setpower=4,settoughness=4,newcolors[black])) forever )! +text=You may have Lazotep Convert enter the battlefield as a copy of any creature card in a graveyard, except it's a 4/4 black Zombie in addition to its other colors and types. +mana=blue,black +type=Creature +subtype=Zombie +power=4 +toughness=4 +[/card] +[card] name=Lazotep Plating auto=_AMASS_(1) auto=all(*|myBattlefield) transforms((,newability[opponentshroud],newability[controllershroud])) ueot @@ -62959,7 +63070,6 @@ toughness=5 [card] name=Phyrexian backside=Incubator -auto=counter(0/0.1.Phyrexian) notrg type=Artifact Creature subtype=Phyrexian power=0 @@ -91271,6 +91381,17 @@ power=2 toughness=2 [/card] [card] +name=Truga Cliffcharger +abilities=trample +auto=may name(Discard a card) target(*|myhand) reject and!( transforms((,newability[name(Search land or battle) target(*[land;battle]|mylibrary) moveto(myhand) and!( shuffle )!])) oneshot )! +text=Trample -- When Truga Cliffcharger enters the battlefield, you may discard a card. If you do, search your library for a land or battle card, reveal it, put it into your hand, then shuffle. +color=red,green +type=Creature +subtype=Rhino +power=3 +toughness=4 +[/card] +[card] name=Trumpeting Gnarr abilities=mutate otherrestriction=type(creature[-human]|mybattlefield)~morethan~0 diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 4b44c8539..6e453a6c0 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -784,6 +784,34 @@ public: } }; +class TrCardDefeated: public Trigger +{ +public: + bool limitOnceATurn; + int triggeredTurn; + TrCardDefeated(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false, bool limitOnceATurn = false) : + Trigger(observer, id, source, once, tc), limitOnceATurn(limitOnceATurn) + { + triggeredTurn = -1; + } + + int triggerOnEventImpl(WEvent * event) + { + WEventCardDefeated * e = dynamic_cast (event); + if (!e) return 0; + if (limitOnceATurn && triggeredTurn == game->turn) + return 0; + if (!tc->canTarget(e->card)) return 0; + triggeredTurn = game->turn; + return 1; + } + + TrCardDefeated * clone() const + { + return NEW TrCardDefeated(*this); + } +}; + class TrCardSurveiled: public Trigger { public: @@ -6906,7 +6934,7 @@ public: string abilityWin; string abilityLose; MTGAbility * abilityAltered; - AASetCoin(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int side = -1,string toAdd = ""); + AASetCoin(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int side = -1, string toAdd = ""); int resolve(); const string getMenuText(); AASetCoin * clone() const; @@ -6917,7 +6945,8 @@ class GenericFlipACoin: public ActivatedAbility public: string baseAbility; AASetCoin * setCoin; - GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "", ManaCost * cost = NULL); + int userchoice; + GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "", ManaCost * cost = NULL, int userchoice = 0); int resolve(); const string getMenuText(); GenericFlipACoin * clone() const; diff --git a/projects/mtg/include/MTGCardInstance.h b/projects/mtg/include/MTGCardInstance.h index 21355bb04..2b2af584e 100644 --- a/projects/mtg/include/MTGCardInstance.h +++ b/projects/mtg/include/MTGCardInstance.h @@ -97,6 +97,7 @@ public: bool turningOver; bool isMorphed; int isFlipped; + bool isDefeated; string MeldedFrom; bool isPhased; bool isCascaded; diff --git a/projects/mtg/include/WEvent.h b/projects/mtg/include/WEvent.h index 236a2fba0..b123fc93d 100644 --- a/projects/mtg/include/WEvent.h +++ b/projects/mtg/include/WEvent.h @@ -407,6 +407,12 @@ struct WEventCardBoasted : public WEventCardUpdate { virtual Targetable * getTarget(int target); }; +//defeated event +struct WEventCardDefeated : public WEventCardUpdate { + WEventCardDefeated(MTGCardInstance * card); + virtual Targetable * getTarget(int target); +}; + //surveil event struct WEventCardSurveiled : public WEventCardUpdate { WEventCardSurveiled(MTGCardInstance * card); diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index efa36b2a1..0f6705f6e 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -2613,7 +2613,7 @@ AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, M if(_target->getCurrentZone() != _target->controller()->game->battlefield || _target->getCurrentZone() != _target->controller()->opponent()->game->battlefield) { - if(power||toughness) + if(!_target->isFlipped && (power||toughness)) // Skipped control for flipped card to solve a bug on double faces cards (e.g. "Ashen Reaper"). { if(_target->previousZone == _target->controller()->game->battlefield || _target->previousZone == _target->controller()->opponent()->game->battlefield) @@ -3416,8 +3416,8 @@ AASetNameChosen::~AASetNameChosen() // //choosing flip coin -GenericFlipACoin::GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable *,string _toAdd, ManaCost * cost) : -ActivatedAbility(observer, id, source, cost, 0), baseAbility(_toAdd) +GenericFlipACoin::GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable *,string _toAdd, ManaCost * cost, int userchoice) : +ActivatedAbility(observer, id, source, cost, 0), baseAbility(_toAdd), userchoice(userchoice) { this->GetId(); setCoin = NULL; @@ -3428,15 +3428,23 @@ int GenericFlipACoin::resolve() if (!target) return 0; vectorselection; - for (int i = 0; i <2; ++i) - { - setCoin = NEW AASetCoin(game, game->mLayers->actionLayer()->getMaxId(), source,(MTGCardInstance*)target, i, baseAbility); + if(userchoice > 0 && userchoice <= 2){ + setCoin = NEW AASetCoin(game, game->mLayers->actionLayer()->getMaxId(), source,(MTGCardInstance*)target, userchoice, baseAbility); MTGAbility * set = setCoin->clone(); set->oneShot = true; - selection.push_back(set); + game->mLayers->actionLayer()->currentActionCard = (MTGCardInstance *)target; + set->resolve(); SAFE_DELETE(setCoin); + } else{ + for (int i = 1; i <=2; ++i) + { + setCoin = NEW AASetCoin(game, game->mLayers->actionLayer()->getMaxId(), source,(MTGCardInstance*)target, i, baseAbility); + MTGAbility * set = setCoin->clone(); + set->oneShot = true; + selection.push_back(set); + SAFE_DELETE(setCoin); + } } - if(selection.size()) { MTGAbility * a1 = NEW MenuAbility(game, this->GetId(), target, source,false,selection); @@ -3463,7 +3471,7 @@ GenericFlipACoin::~GenericFlipACoin() } //set coin result - AASetCoin::AASetCoin(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * _target,int _side , string toAlter): + AASetCoin::AASetCoin(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * _target, int _side, string toAlter): InstantAbility(observer, id, source),side(_side), abilityToAlter(toAlter) { this->target = _target; @@ -3475,7 +3483,7 @@ int AASetCoin::resolve() MTGCardInstance * _target = (MTGCardInstance *)target; _target->coinSide = side; - int flip = game->getRandomGenerator()->random() % 2; + int flip = 1 + game->getRandomGenerator()->random() % 2; _target->lastFlipResult = flip; WEvent * e = NEW WEventCardFlipCoin(_target, source->controller()->getDisplayName()); game->receiveEvent(e); diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index d9435e818..3c4bc376c 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -461,6 +461,58 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe if(!isMorbid) return 0; } + check = restriction[i].find("deadpermanent"); + if(check != string::npos) + { + bool isMorbid = false; + for(int cp = 0;cp < 2;cp++) + { + Player * checkCurrent = observer->players[cp]; + MTGGameZone * grave = checkCurrent->game->graveyard; + for(unsigned int gy = 0;gy < grave->cardsSeenThisTurn.size();gy++) + { + MTGCardInstance * checkCard = grave->cardsSeenThisTurn[gy]; + if(checkCard->isPermanent() && + ((checkCard->previousZone == checkCurrent->game->battlefield)|| + (checkCard->previousZone == checkCurrent->opponent()->game->battlefield))//died from battlefield + ) + { + isMorbid = true; + break; + } + } + if(isMorbid) + break; + } + if(!isMorbid) + return 0; + } + check = restriction[i].find("deadcreart"); + if(check != string::npos) + { + bool isMorbid = false; + for(int cp = 0;cp < 2;cp++) + { + Player * checkCurrent = observer->players[cp]; + MTGGameZone * grave = checkCurrent->game->graveyard; + for(unsigned int gy = 0;gy < grave->cardsSeenThisTurn.size();gy++) + { + MTGCardInstance * checkCard = grave->cardsSeenThisTurn[gy]; + if((checkCard->isCreature() || checkCard->hasType(Subtypes::TYPE_ARTIFACT)) && + ((checkCard->previousZone == checkCurrent->game->battlefield)|| + (checkCard->previousZone == checkCurrent->opponent()->game->battlefield))//died from battlefield + ) + { + isMorbid = true; + break; + } + } + if(isMorbid) + break; + } + if(!isMorbid) + return 0; + } check = restriction[i].find("zerodead"); if(check != string::npos)//returns true if zero { @@ -1358,6 +1410,10 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell if (TargetChooser * tc = parseSimpleTC(s, "boasted", card)) return NEW TrCardBoasted(observer, id, card, tc, once, limitOnceATurn); + //a battle card has been defeated + if (TargetChooser * tc = parseSimpleTC(s, "defeated", card)) + return NEW TrCardDefeated(observer, id, card, tc, once, limitOnceATurn); + //Surveil has been performed from a card if (TargetChooser * tc = parseSimpleTC(s, "surveiled", card)) return NEW TrCardSurveiled(observer, id, card, tc, once, limitOnceATurn); @@ -2871,7 +2927,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG if (splitFlipCoin.size()) { string a1 = splitFlipCoin[1]; - MTGAbility * a = NEW GenericFlipACoin(observer, id, card, target, a1); + int userchoice = 0; + if(a1[0] >= 48 && a1[0] <= 57){ + userchoice = (a1[0] - 48); + a1 = a1.substr(2); + } + MTGAbility * a = NEW GenericFlipACoin(observer, id, card, target, a1, NULL, userchoice); a->oneShot = 1; a->canBeInterrupted = false; return a; diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index b1876e9a4..5ccdbfe8a 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -233,6 +233,7 @@ void MTGCardInstance::initMTGCI() isMorphed = false; MeldedFrom = ""; isFlipped = 0; + isDefeated = false; isPhased = false; isCascaded = false; phasedTurn = -1; diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index e002c52ea..f3ec3254b 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -557,9 +557,23 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone copy->getManaCost()->getManaUsedToCast()->copy(card->getManaCost()->getManaUsedToCast()); } - if(!card->hasType(Subtypes::TYPE_LEGENDARY) && copy->hasType(Subtypes::TYPE_LEGENDARY)) // This fix issue when cloning a card with nolegend option (e.g. Double Major) + if(card->name == copy->name && !card->hasType(Subtypes::TYPE_LEGENDARY) && copy->hasType(Subtypes::TYPE_LEGENDARY)) // This fix issue when cloning a card with nolegend option (e.g. Double Major) copy->removeType(Subtypes::TYPE_LEGENDARY); + std::vector realTypes; + if(card->name == copy->backSide){ // This fix issue types problem when card dies as its backside (e.g. "Incubator" and "Phyrexian"). + for (int i = ((int)copy->types.size())-1; i >= 0; --i){ + realTypes.push_back(copy->types[i]); + copy->removeType(copy->types[i]); + } + for (int i = 0; i < ((int)card->types.size()); i++) + copy->addType(card->types[i]); + if(copy->types[0] == 1 && copy->types[1] == 7){ // Fix order for Legendary Creatures + copy->types[0] = 7; + copy->types[1] = 1; + } + } + // Copy all the counters of the original card... (solving the bug on comparison cards with counter before zone changing events) if(card->counters && doCopy && !asCopy && !inplaytoinplay){ for (unsigned int i = 0; i < card->counters->counters.size(); i++){ @@ -757,6 +771,16 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone if(doCopy && !inplaytoinplay && copy->has(Constants::ISPREY)) copy->basicAbilities[Constants::ISPREY] = 0; + if(realTypes.size() && card->name == copy->backSide){ // Reset original types when card dies as its backside (e.g. "Incubator" and "Phyrexian"). + copy->types.clear(); + for (int i = 0; i < ((int)realTypes.size()); i++) + copy->addType(realTypes[i]); + if(copy->types[0] == 1 && copy->types[1] == 7){ // Fix order for Legendary Creatures + copy->types[0] = 7; + copy->types[1] = 1; + } + } + // Erasing counters from copy after the event has been triggered (no counter can survive to a zone changing except the perpetual ones) if(doCopy && !inplaytoinplay && copy->counters && copy->counters->mCount > 0){ for (unsigned int i = 0; i < copy->counters->counters.size(); i++){ diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index 63bc8d2d1..e27feb348 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -3992,6 +3992,16 @@ int MTGPlaneswalkerDamage::receiveEvent(WEvent * event) removel->targetCard->toGrave(true); return 1; } + if(removel->removed && removel->targetCard && removel->targetCard->hasType(Subtypes::TYPE_BATTLE)) + if(!removel->targetCard->counters->hasCounter("defense", 0, 0)) + { + if(!removel->targetCard->isDefeated){ + removel->targetCard->isDefeated = true; + WEvent * e = NEW WEventCardDefeated(removel->targetCard); + game->receiveEvent(e); + } + return 1; + } } return 0; } diff --git a/projects/mtg/src/WEvent.cpp b/projects/mtg/src/WEvent.cpp index 3ee93ffd6..c50f1e3e0 100644 --- a/projects/mtg/src/WEvent.cpp +++ b/projects/mtg/src/WEvent.cpp @@ -322,6 +322,11 @@ WEventCardBoasted::WEventCardBoasted(MTGCardInstance * card) : { } +WEventCardDefeated::WEventCardDefeated(MTGCardInstance * card) : + WEventCardUpdate(card) +{ +} + WEventCardSurveiled::WEventCardSurveiled(MTGCardInstance * card) : WEventCardUpdate(card) { @@ -590,6 +595,12 @@ Targetable * WEventCardBoasted::getTarget(int target) return NULL; } +Targetable * WEventCardDefeated::getTarget(int target) +{ + if (target) return card; + return NULL; +} + Targetable * WEventCardSurveiled::getTarget(int target) { if (target) return card;