From 17d68605050995f0a7e14015ca52d03730909616 Mon Sep 17 00:00:00 2001 From: Vittorio Alfieri Date: Thu, 18 Feb 2021 12:48:59 +0100 Subject: [PATCH] Improved AI: now it can cast spells from graveyard using thier Flashback and Retrace costs, fixed a crash in Deck Editor stats loader when a card ability contains some "add" substrings (e.g. "counteradded" followed by "restriction{"), added/fixed primitives. --- .../bin/Res/sets/primitives/borderline.txt | 78 +++++++++++-------- projects/mtg/bin/Res/sets/primitives/mtg.txt | 12 +-- .../bin/Res/sets/primitives/planeswalkers.txt | 12 +-- .../bin/Res/sets/primitives/unsupported.txt | 15 ++-- projects/mtg/src/AIPlayerBaka.cpp | 50 +++++++++--- projects/mtg/src/DeckStats.cpp | 2 +- 6 files changed, 104 insertions(+), 65 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/borderline.txt b/projects/mtg/bin/Res/sets/primitives/borderline.txt index 1eba8a9ba..6a36e5d18 100644 --- a/projects/mtg/bin/Res/sets/primitives/borderline.txt +++ b/projects/mtg/bin/Res/sets/primitives/borderline.txt @@ -7056,7 +7056,7 @@ toughness=4 [/card] [card] name=Calciform Pools -auto={T}:add {1} +auto={T}:add{C} auto={1}{T}:counter(0/0,1,Storage) auto={1}{C(0/0,-1,Storage)}: ability$! _ choice add{U} _ choice add{W} !$ controller text={T}: Add {1} to your mana pool. -- {1}, {T}: Put a storage counter on Calciform Pools. -- {1}, Remove X storage counters from Calciform Pools: Add X mana in any combination of {W} and/or {U} to your mana pool. @@ -7883,7 +7883,7 @@ toughness=1 [/card] [card] name=Cave of Temptation -auto={T}:add {1} +auto={T}:add{C} auto={1}{T}:Add{W} auto={1}{T}:Add{U} auto={1}{T}:Add{B} @@ -11036,7 +11036,7 @@ toughness=4 [/card] [card] name=Cryptic Caves -auto={T}:add {1} +auto={T}:add{C} auto=aslongas(land|myBattlefield) {1}{T}{S}:draw:1 >4 text={T}: Add {1}. -- {1}, {T}, Sacrifice Cryptic Caves: Draw a card. Activate this ability only if you control five or more lands. type=Land @@ -14171,7 +14171,7 @@ toughness=1 [/card] [card] name=Dreadship Reef -auto={T}: Add {1} +auto={T}:add{C} auto={1}{T}:counter(0/0,1,Storage) auto={1}{C(0/0,-1,Storage)}: ability$! _ choice add{U} _ choice add{B} !$ controller text={T}: Add {C}. -- {1}, {T}: Put a storage counter on Dreadship Reef. -- {1}, Remove X storage counters from Dreadship Reef: Add X mana in any combination of {U} and/or {B}. @@ -17533,7 +17533,7 @@ type=Land [card] name=Field of the Dead auto=tap(noevent) -auto={T}:add {1} +auto={T}:add{C} auto=aslongas(land|myBattlefield) create(zombie:creature zombie:2/2:black) >7 auto=aslongas(land|myBattlefield) @movedTo(land|myBattlefield):create(zombie:creature zombie:2/2:black) >7 text=Field of the Dead enters the battlefield tapped. -- {T}: Add {1}. -- Whenever Field of the Dead or another land enters the battlefield under your control, if you control seven or more lands with different names, create a 2/2 black Zombie creature token. @@ -19274,7 +19274,7 @@ type=Enchantment [/card] [card] name=Fungal Reaches -auto={T}: Add {1} +auto={T}:add{C} auto={1}{T}:counter(0/0,1,Storage) auto={1}{C(0/0,-1,Storage)}: ability$! _ choice add{R} _ choice add{G} !$ controller text={T}: Add {C}. -- {1}, {T}: Put a storage counter on Fungal Reaches. -- {1}, Remove X storage counters from Fungal Reaches: Add X mana in any combination of {R} and/or {G}. @@ -22876,7 +22876,7 @@ toughness=3 [/card] [card] name=Hall of Heliod's Generosity -auto={T}:add {1} +auto={T}:add{C} auto={1}{W}{T}:moveTo(mylibrary) target(enchantment|mygraveyard) text={T}: Add {1}. -- {1}{W}, {T}: Put target enchantment card from your graveyard on top of your library. type=Legendary Land @@ -28286,7 +28286,7 @@ toughness=3 [card] name=Kess, Dissident Mage abilities=flying -auto={0}:target(instant,sorcery|mygraveyard) tempflashback ueot myTurnOnly limit:1 +auto={0}:ability$!name(Give flashback) name(Give flashback) target(*[instant;sorcery]|mygraveyard) tempflashback ueot!$ controller limit:1 myturnonly text=Flying -- During each of your turns, you may cast an instant or sorcery card from your graveyard. If a card cast this way would be put into your graveyard, exile it instead. mana={1}{U}{B}{R} type=Legendary Creature @@ -29480,7 +29480,7 @@ toughness=3 name=Kykar, Wind's Fury abilities=flying auto=@movedTo(*[-creature]|mystack):create(Spirit:creature Spirit:1/1:white:flying) -auto=[S(Spirit|myBattlefield)}:add {R} +auto=[S(Spirit|myBattlefield)}:add{R} text=Flying -- Whenever you cast a noncreature spell, create a 1/1 white Spirit creature token with flying. -- Sacrifice a Spirit: Add {R}. mana={1}{U}{R}{W} type=Legendary Creature @@ -30923,7 +30923,7 @@ toughness=3 [/card] [card] name=Llanowar Tribe -auto={T}:add {G}{G}{G} +auto={T}:add{G}{G}{G} text={T}: Add {G}{G}{G}. mana={G}{G}{G} type=Creature @@ -32576,7 +32576,7 @@ toughness=3 [card] name=Maze's End auto=tap(noevent) -auto={T}:Add {1} +auto={T}:add{C} aicode=activate auto={3}{T}{H(this|mybattlefield)}{3}{T}:name(search a gate) target(land[Gate]|myLibrary) moveTo(myBattlefield) and!( if compare(diffcardcounttypegate)~morethan~9 then wingame controller )! text=Mazes End enters the battlefield tapped. -- {T}:Add {C}. -- {3},{T},Return Mazes End to its owners hand: Search your library for a Gate card, put it onto the battlefield, then shuffle your library. If you control ten or more Gates with different names, you win the game. @@ -33638,7 +33638,7 @@ type=Instant [/card] [card] name=Molten Slagheap -auto={T}: Add {1} +auto={T}:add{C} auto={1}{T}:counter(0/0,1,Storage) auto={1}{C(0/0,-1,Storage)}: ability$! _ choice add{B} _ choice add{R} !$ controller text={T}: Add {C}. -- {1}, {T}: Put a storage counter on Molten Slagheap. -- {1}, Remove X storage counters from Molten Slagheap: Add X mana in any combination of {B} and/or {R}. @@ -40403,7 +40403,7 @@ auto=@movedTo(*[blue]|mystack):counter(1/1) auto=@movedTo(*[black]|mystack):counter(1/1) auto=@movedTo(*[red]|mystack):counter(1/1) auto=@movedTo(*[green]|mystack):counter(1/1) -auto={C(1/1,-5)}:Add {W}{W}{U}{U}{B}{B}{R}{R}{G}{G} limit:1 +auto={C(1/1,-5)}:add{W}{W}{U}{U}{B}{B}{R}{R}{G}{G} limit:1 text=Flying -- Whenever you cast a spell, put a +1/+1 counter on Ramos, Dragon Engine for each of that spell's colors. -- Remove five +1/+1 counters from Ramos: Add {W}{W}{U}{U}{B}{B}{R}{R}{G}{G}. Activate this ability only once each turn. mana={6} type=Legendary Artifact Creature @@ -43356,7 +43356,7 @@ type=Instant [card] name=Runaway Steam-Kin auto=@movedTo(*[red]|mystack) restriction{(counter(1/1))~lessthan~3}:counter(1/1) -auto={C(1/1,-3)}:Add {R}{R}{R} +auto={C(1/1,-3)}:add{R}{R}{R} text=Whenever you cast a red spell, if Runaway Steam-Kin has fewer than three +1/+1 counters on it, put a +1/+1 counter on Runaway Steam-Kin. -- Remove three +1/+1 counters from Runaway Steam-Kin: Add {R}{R}{R}. mana={1}{R} type=Creature @@ -43821,7 +43821,7 @@ type=Sorcery [/card] [card] name=Saltcrusted Steppe -auto={T}: Add {1} +auto={T}:add{C} auto={1}{T}:counter(0/0,1,Storage) auto={1}{C(0/0,-1,Storage)}: ability$! _ choice add{G} _ choice add{W} !$ controller text={T}: Add {C}. -- {1}, {T}: Put a storage counter on Saltcrusted Steppe. -- {1}, Remove X storage counters from Saltcrusted Steppe: Add X mana in any combination of {G} and/or {W}. @@ -51999,6 +51999,16 @@ power=1 toughness=2 [/card] [card] +name=Synthetic Destiny +aicode=activate transforms((,newability[target(*[zpos=findfirsttypecreature]|mylibrary) transforms((,newability[phaseaction[endofturn once] moveTo(myBattlefield) and!( shuffle )!])) ueot])) oneshot +auto=count(type:creature:mybattlefield) +auto=all(creature|myBattlefield) moveto(exile) +auto=thisforeach(variable{countedamount}) ability$!name(Reveal from top) name(Reveal from top) reveal:1 revealuntil(creature|mylibrary) optionone name(Choose creature to play end of turn) target(creature|myreveal) moveto(mylibrary) and!( becomes(tobecast) ueot )! optiononeend optiontwo name(Put back) target(*|myreveal) moveto(mylibrary) and!( all(*|myreveal) moveto(mylibrary) )! optiontwoend afterrevealed all(tobecast|mylibrary) transforms((,newability[phaseaction[endofturn once] moveTo(myBattlefield) and!( shuffle )!])) ueot afterrevealedend revealend!$ controller +text=Exile all creatures you control. At the beginning of the next end step, reveal cards from the top of your library until you reveal that many creature cards, put all creature cards revealed this way onto the battlefield, then shuffle the rest of the revealed cards into your library. +mana={4}{U}{U} +type=Instant +[/card] +[card] name=Syr Alin, the Lion's Claw abilities=first strike auto=@combat(attacking) source(this):all(other creature|mybattlefield) 1/1 ueot @@ -52281,45 +52291,45 @@ type=Sorcery [/card] [card] name=Talisman of Conviction -auto={T}:add {1} -auto={T}:add {R} and!( damage:1 controller )! -auto={T}:add {W} and!( damage:1 controller )! +auto={T}:add{C} +auto={T}:add{R} and!( damage:1 controller )! +auto={T}:add{W} and!( damage:1 controller )! text={T}: Add {1}. -- {T}: Add {R} or {W}. Talisman of Conviction deals 1 damage to you. mana={2} type=Artifact [/card] [card] name=Talisman of Creativity -auto={T}:add {1} -auto={T}:add {R} and!( damage:1 controller )! -auto={T}:add {U} and!( damage:1 controller )! +auto={T}:add{1} +auto={T}:add{R} and!( damage:1 controller )! +auto={T}:add{U} and!( damage:1 controller )! text={T}: Add {1}. -- {T}: Add {U} or {R}. Talisman of Creativity deals 1 damage to you. mana={2} type=Artifact [/card] [card] name=Talisman of Curiosity -auto={T}:add {1} -auto={T}:add {G} and!( damage:1 controller )! -auto={T}:add {U} and!( damage:1 controller )! -text={T}: Add {1}. -- {T}: Add {G} or {U}. Talisman of Curiosity deals 1 damage to you. +auto={T}:add{C} +auto={T}:add{G} and!( damage:1 controller )! +auto={T}:add{U} and!( damage:1 controller )! +text={T}: Add {1}. -- {T}: Add {G} or {U}. Talisman of Curiosity deals 1 damage to you. mana={2} type=Artifact [/card] [card] name=Talisman of Hierarchy -auto={T}:add {1} -auto={T}:add {B} and!( damage:1 controller )! -auto={T}:add {W} and!( damage:1 controller )! +auto={T}:add{C} +auto={T}:add{B} and!( damage:1 controller )! +auto={T}:add{W} and!( damage:1 controller )! text={T}: Add {1}. -- {T}: Add {W} or {B}. Talisman of Hierarchy deals 1 damage to you. mana={2} type=Artifact [/card] [card] name=Talisman of Resilience -auto={T}:add {1} -auto={T}:add {G} and!( damage:1 controller )! -auto={T}:add {B} and!( damage:1 controller )! +auto={T}:add{C} +auto={T}:add{G} and!( damage:1 controller )! +auto={T}:add{B} and!( damage:1 controller )! text={T}: Add {1}. -- {T}: Add {B} or {G}. Talisman of Resilience deals 1 damage to you. mana={2} type=Artifact @@ -54453,7 +54463,7 @@ toughness=1 [card] name=Tinder Wall abilities=defender -auto={S}:add {R}{R} +auto={S}:add{R}{R} auto={R}{S}:damage:2 target(creature[blocked]) text=Defender (This creature cant attack.) -- Sacrifice Tinder Wall: Add {R}{R}. -- {R}, Sacrifice Tinder Wall: It deals 2 damage to target creature its blocking. mana={G} @@ -56699,7 +56709,7 @@ type=Artifact [card] name=Urza, Lord High Artificer auto=token(-464024) -auto={T(artifact|myBattlefield)}:add {U} +auto={T(artifact|myBattlefield)}:add{U} auto={5}:name(Suffle and cast) shuffle && reveal:1 optionone name(Reveal)if type(*|reveal)~morethan~0 then name(Check to cast) target(*|reveal) transforms((,newability[if type(*|mybattlefield)~morethan~0 then castcard(putinplay)])) else name(not a creature) target(*|reveal) donothing optiononeend optiontwo choice all(*|reveal) bottomoflibrary optiontwoend revealend text=When Urza, Lord High Artificer enters the battlefield, create a 0/0 colorless Construct artifact creature token with "This creature gets +1/+1 for each artifact you control." -- Tap an untapped artifact you control: Add {U}. -- {5}: Shuffle your library, then exile the top card. Until end of turn, you may play that card without paying its mana cost. mana={2}{U}{U} @@ -60048,7 +60058,7 @@ subtype=Swamp Forest [/card] [card] name=Woodland Mystic -auto={T}:Add {G} +auto={T}:add{G} text={T}: Add {G}. mana={1}{G} type=Creature diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index a80ec6dcc..c2510e7c1 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -16061,7 +16061,7 @@ toughness=2 [/card] [card] name=Cabal Coffers -auto={2}{T}:name(Add {B} for each swamp) foreach(swamp|myBattlefield) add{B} +auto={2}{T}:name(Add black mana for each swamp) foreach(swamp|myBattlefield) add{B} text={2}, {T}: Add {B} to your mana pool for each Swamp you control. type=Land [/card] @@ -44265,7 +44265,7 @@ type=Sorcery [/card] [card] name=Gaea's Cradle -auto={T}:name(add {G} for each creature) foreach(creature|myBattlefield) add{G} +auto={T}:name(add green mana for each creature) foreach(creature|myBattlefield) add{G} text={T}: Add {G} to your mana pool for each creature you control. type=Legendary Land [/card] @@ -70219,8 +70219,8 @@ type=Artifact [/card] [card] name=Mana Echoes -auto=@movedTo(creature|myBattlefield):may name(Add {C} for each creature that shares...) all(trigger) transforms((,newability[foreach(*[creature;share!types!]|mybattlefield) add{1} oneshot])) -auto=@movedTo(creature|opponentBattlefield):may name(Add {C} for each creature that shares...) all(trigger) transforms((,newability[foreach(*[creature;share!types!]|opponentbattlefield) add{1} opponent oneshot])) +auto=@movedTo(creature|myBattlefield):may name(Add colorless mana for each creature that shares...) all(trigger) transforms((,newability[foreach(*[creature;share!types!]|mybattlefield) add{1} oneshot])) +auto=@movedTo(creature|opponentBattlefield):may name(Add colorless mana for each creature that shares...) all(trigger) transforms((,newability[foreach(*[creature;share!types!]|opponentbattlefield) add{1} opponent oneshot])) text=Whenever a creature enters the battlefield, you may add {C} to your mana pool for each creature you control that shares a creature type with it. mana={2}{R}{R} type=Enchantment @@ -102600,7 +102600,7 @@ type=Enchantment [/card] [card] name=Serra's Sanctum -auto={T}:name(add {W} for each enchantment) foreach(enchantment|myBattlefield) add{W} +auto={T}:name(add white mana for each enchantment) foreach(enchantment|myBattlefield) add{W} text={T}: Add {W} to your mana pool for each enchantment you control. type=Legendary Land [/card] @@ -122008,7 +122008,7 @@ type=Land [/card] [card] name=Tolarian Academy -auto={T}:name(add {U} for each artifact) foreach(artifact|myBattlefield) add{U} +auto={T}:name(add blue mana for each artifact) foreach(artifact|myBattlefield) add{U} text={T}: Add {U} to your mana pool for each artifact you control. type=Legendary Land [/card] diff --git a/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt b/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt index 6467198d2..30d660bb4 100644 --- a/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt +++ b/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt @@ -525,7 +525,7 @@ subtype=Chandra name=Chandra, Novice Pyromancer auto=counter(0/0,5,loyalty) auto={C(0/0,1,Loyalty)}:name(+1: Elemental creatures gets +2/+0) all(creature[elemental]|mybattlefield) 2/0 ueot -auto={C(0/0,-1,Loyalty)}:name(-1: Add two red mana) add {R}{R} +auto={C(0/0,-1,Loyalty)}:name(-1: Add two red mana) add{R}{R} auto={C(0/0,-2,Loyalty)}:name(-2: Deals 2 damage to any target) damage:2 target(player,creature,planeswalker) text=+1: Elementals you control get +2/+0 until end of turn. -- -1: Add {R}{R}. -- -2: Chandra, Novice Pyromancer deals 2 damage to any target. mana={3}{R} @@ -581,7 +581,7 @@ subtype=Chandra name=Chandra, Torch of Defiance auto=counter(0/0,4,loyalty) auto={C(0/0,1,Loyalty)}:name(+1: Exile Top Card) reveal:1 optionone target(*|reveal) moveto(exile) and!( becomes(tobecast) ueot )! optiononeend afterrevealed if type(tobecast[-land]|myexile)~morethan~0 then transforms((,newability[choice all(tobecast|myexile) castcard(restricted),newability[choice name(deal 2 damage) damage:2 opponent && all(tobecast|myexile) moveto(ownerexile)])) oneshot else choice name(deal 2 damage) damage:2 opponent && all(tobecast|myexile) moveto(ownerexile) afterrevealedend revealend -auto={C(0/0,1,Loyalty)}:name(+1: Add {R}{R} Mana) Add{R}{R} +auto={C(0/0,1,Loyalty)}:name(+1: Add two red mana) add{R}{R} auto={C(0/0,-3,Loyalty)}:name(-3: Deals 4 damage to target creature) damage:4 target(creature) auto={C(0/0,-7,Loyalty)}:name(-7: Emblem: "whenever cast a spell, deals 5 damage any target) emblem transforms((,newability[@movedTo(*|mystack):damage:5 target(player,creature,planeswalker)])) forever dontremove text=+1: Exile the top card of your library. You may cast that card. If you don't, Chandra, Torch of Defiance deals 2 damage to each opponent. -- +1: Add {R}{R} to your mana pool. -- -3: Chandra, Torch of Defiance deals 4 damage to target creature. -- -7: You get an emblem with "Whenever you cast a spell, this emblem deals 5 damage to target creature or player." @@ -649,8 +649,8 @@ subtype=Domri name=Domri, Chaos Bringer auto=counter(0/0,5,loyalty) aicode=activate moveto(myHand) target(creature[zpos=2]|myLibrary) -auto={C(0/0,1,Loyalty)}:name(+1: Add {R} if its a creature, Riot) add{R} && if type(creature|myStack)~morethan~0 then ability$!name(Choose one) choice name(Put a +1/1 counter) counter(1/1,1) target(creature[fresh]|myBattlefield) _ choice name(Gain Haste) haste target(creature[fresh]|myBattlefield)!$ controller -auto={C(0/0,1,Loyalty)}:name(+1: Add {G} if its a creature, Riot) add{G} && if type(creature|myStack)~morethan~0 then ability$!name(Choose one) choice name(Put a +1/1 counter) counter(1/1,1) target(creature[fresh]|myBattlefield) _ choice name(Gain Haste) haste target(creature[fresh]|myBattlefield)!$ controller !$ controller +auto={C(0/0,1,Loyalty)}:name(+1: Add red if its a creature, Riot) add{R} && if type(creature|myStack)~morethan~0 then ability$!name(Choose one) choice name(Put a +1/1 counter) counter(1/1,1) target(creature[fresh]|myBattlefield) _ choice name(Gain Haste) haste target(creature[fresh]|myBattlefield)!$ controller +auto={C(0/0,1,Loyalty)}:name(+1: Add green if its a creature, Riot) add{G} && if type(creature|myStack)~morethan~0 then ability$!name(Choose one) choice name(Put a +1/1 counter) counter(1/1,1) target(creature[fresh]|myBattlefield) _ choice name(Gain Haste) haste target(creature[fresh]|myBattlefield)!$ controller !$ controller auto={C(0/0,-3,Loyalty)}:name(-3: Reveal four and put up to two creature) name(Look your Library) reveal:4 optionone name(Get a card) target(*[creature]|reveal) moveto(myhand) optiononeend optiontwo name(put on bottom) target(<4>*|reveal) bottomoflibrary optiontwoend revealend auto={C(0/0,-8,Loyalty)}:name(-8: Emblem: "Each end of turn create a 4/4 Beast) emblem transforms((,newability[@each endofturn: token(Beast,Creature Beast,4/4,red,green,trample)])) forever dontrevome text=+1: Add {R} or {G}. If that mana is spent on a creature spell, it gains riot. (It enters the battlefield with your choice of a +1/+1 counter or haste.) -- −3: Look at the top four cards of your library. You may reveal up to two creature cards from among them and put them into your hand. Put the rest on the bottom of your library in a random order. -- −8: You get an emblem with “At the beginning of each end step, create a 4/4 red and green Beast creature token with trample.” @@ -1278,7 +1278,7 @@ subtype=Jeska [card] name=Jaya Ballard auto=counter(0/0,5,Loyalty) -auto={C(0/0,1,Loyalty)}:name(+1: Add {R}{R}{R}) if type(*[instant;sorcery]|myhand)~morethan~0 then add{R}{R}{R} +auto={C(0/0,1,Loyalty)}:name(+1: Add 3 red mana) if type(*[instant;sorcery]|myhand)~morethan~0 then add{R}{R}{R} auto={C(0/0,1,Loyalty)}:name(+1: Discard up to three and draw that many) reject notatarget(*|myhand) and!( draw:1 controller )! auto={C(0/0,-8,Loyalty)}:name(-8: Emblem: "Yoy may cast instants or sorceries from graveyard") emblem transforms((,newability[lord(*[instant;sorcery]|mygraveyard) canplayfromgraveyard],newability[lord(*[instant;sorcery]|mygraveyard) gainedexiledeath])) forever dontremove text=+1: Add {R}{R}{R}. Spend this mana only to cast instant or sorcery spells. -- +1: Discard up to three cards, then draw that many cards. -- −8: You get an emblem with “You may cast instant and sorcery spells from your graveyard. If a spell cast this way would be put into your graveyard, exile it instead.” @@ -1445,7 +1445,7 @@ subtype=Kiora name=Koth of the Hammer auto=counter(0/0,3,loyalty) auto={C(0/0,1,Loyalty)}:name(+1: Untap target land and becomes a 4/4 Elemental) untap target(mountain) && transforms((Elemental Creature,setpower=4,settoughness=4,red)) ueot -auto={C(0/0,-2,Loyalty)}:name(-2: Add {R} for each mountain) foreach(mountain|myBattlefield) add{R} +auto={C(0/0,-2,Loyalty)}:name(-2: Add red mana for each mountain) foreach(mountain|myBattlefield) add{R} auto={C(0/0,-5,Loyalty)}:name(-5: Emblem: "Mountains gains: Deals 1 damage any target") emblem transforms((,newability[lord(mountain|mybattlefield) {T}:damage:1 target(creature)],newability[lord(mountain|mybattlefield) {T}:damage:1 target(player)])) forever dontremove text=+1: Untap target Mountain. It becomes a 4/4 red Elemental creature until end of turn. It's still a land. -- -2: Add {R} to your mana pool for each Mountain you control. -- -5: You get an emblem with "Mountains you control have '{T}: This land deals 1 damage to target creature or player.'" mana={2}{R}{R} diff --git a/projects/mtg/bin/Res/sets/primitives/unsupported.txt b/projects/mtg/bin/Res/sets/primitives/unsupported.txt index d1cb9708a..5bf92e18b 100644 --- a/projects/mtg/bin/Res/sets/primitives/unsupported.txt +++ b/projects/mtg/bin/Res/sets/primitives/unsupported.txt @@ -765,6 +765,13 @@ power=3 toughness=3 [/card] [card] +name=Barrel Down Sokenzan +text=Sweep Return any number of Mountains you control to their owner's hand. Barrel Down Sokenzan deals damage to target creature equal to twice the number of Mountains returned this way. +mana={2}{R} +type=Instant +subtype=Arcane +[/card] +[card] name=Barrin's Unmaking text=Return target permanent to its owner's hand if that permanent shares a color with the most common color among all permanents or a color tied for most common. mana={1}{U} @@ -2381,7 +2388,7 @@ type=Artifact [/card] [card] name=Crucible of the Spirit Dragon -auto={T}: Add {1} +auto={T}:add{C} auto={1}{T}:counter(0/0,1,Storage) auto={T}{C(0/0,-1,Storage)}: ability$! _ choice add{U} _ choice add{B} _ choice add{G} _ choice add{R} _ choice add{W} !$ controller text={T}: Add {1} to your mana pool. -- {1}, {T}: Put a storage counter on Crucible of the Spirit Dragon. -- {T}, Remove X storage counters from Crucible of the Spirit Dragon: Add X mana in any combination of colors to your mana pool. Spend this mana only to cast Dragon spells or activate abilities of Dragons. @@ -12015,12 +12022,6 @@ mana={2}{G}{G} type=Sorcery [/card] [card] -name=Synthetic Destiny -text=Exile all creatures you control. At the beginning of the next end step, reveal cards from the top of your library until you reveal that many creature cards, put all creature cards revealed this way onto the battlefield, then shuffle the rest of the revealed cards into your library. -mana={4}{U}{U} -type=Instant -[/card] -[card] name=Syr Cadian, Knight Owl text=Knightlifelink (Damage dealt by Knights you control also causes you to gain that much life.) -- {W}: Syr Cadian, Knight Owl gains vigilance until end of turn. Activate this ability only from sunrise to sunset. -- {B}: Syr Cadian, Knight Owl gains flying until end of turn. Activate this ability only from sunset to sunrise. mana={3}{W}{W} diff --git a/projects/mtg/src/AIPlayerBaka.cpp b/projects/mtg/src/AIPlayerBaka.cpp index 140fcc059..fd65df716 100644 --- a/projects/mtg/src/AIPlayerBaka.cpp +++ b/projects/mtg/src/AIPlayerBaka.cpp @@ -2770,16 +2770,16 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * pMana, const char * ty if (hasFlashback && !CanHandleCost(card->getManaCost()->getFlashback(),card)) continue; - // Case were manacost is equal to flashback cost, if they are different the AI hangs - if (hasFlashback && (card->getManaCost() != card->getManaCost()->getFlashback())) + if (hasRetrace && !CanHandleCost(card->getManaCost()->getRetrace(),card)) continue; - if (hasRetrace && !CanHandleCost(card->getManaCost()->getRetrace(),card)) + /*// Case were manacost is equal to flashback cost, if they are different the AI hangs + if (hasFlashback && (card->getManaCost() != card->getManaCost()->getFlashback())) continue; // Case were manacost is equal to retrace cost, if they are different the AI hangs if (hasRetrace && (card->getManaCost() != card->getManaCost()->getRetrace())) - continue; + continue;*/ if (card->hasType(Subtypes::TYPE_LAND)) { @@ -3376,8 +3376,18 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * pMana, const char * ty } if(nextCardToPlay) { - if(!pMana->canAfford(nextCardToPlay->getManaCost(),0) || nextCardToPlay->getManaCost()->getKicker()) - gotPayments = canPayMana(nextCardToPlay,nextCardToPlay->getManaCost(),nextCardToPlay->has(Constants::ANYTYPEOFMANA)); + if(nextCardToPlay->currentZone == game->graveyard && !nextCardToPlay->has(Constants::CANPLAYFROMGRAVEYARD) && !nextCardToPlay->has(Constants::TEMPFLASHBACK)){ //Now AI can play cards with flashback and retrace costs. + if(nextCardToPlay->getManaCost()->getFlashback()){ + if(!pMana->canAfford(nextCardToPlay->getManaCost()->getFlashback(),0)) + gotPayments = canPayMana(nextCardToPlay,nextCardToPlay->getManaCost()->getFlashback(),nextCardToPlay->has(Constants::ANYTYPEOFMANA)); + } else if(nextCardToPlay->getManaCost()->getRetrace()){ + if(!pMana->canAfford(nextCardToPlay->getManaCost()->getRetrace(),0)) + gotPayments = canPayMana(nextCardToPlay,nextCardToPlay->getManaCost()->getRetrace(),nextCardToPlay->has(Constants::ANYTYPEOFMANA)); + } + } else { + if(!pMana->canAfford(nextCardToPlay->getManaCost(),0) || nextCardToPlay->getManaCost()->getKicker()) + gotPayments = canPayMana(nextCardToPlay,nextCardToPlay->getManaCost(),nextCardToPlay->has(Constants::ANYTYPEOFMANA)); + } DebugTrace(" AI wants to play card." << endl << "- Next card to play: " << (nextCardToPlay ? nextCardToPlay->name : "None" ) << endl ); @@ -3696,11 +3706,29 @@ int AIPlayerBaka::computeActions() gotPayments.clear();//if any. return 1; } - if(payTheManaCost(nextCardToPlay->getManaCost(),nextCardToPlay->has(Constants::ANYTYPEOFMANA),nextCardToPlay,gotPayments)) - { - AIAction * a = NEW AIAction(this, nextCardToPlay); - clickstream.push(a); - gotPayments.clear(); + if(nextCardToPlay->currentZone == game->graveyard && !nextCardToPlay->has(Constants::CANPLAYFROMGRAVEYARD) && !nextCardToPlay->has(Constants::TEMPFLASHBACK)){ //Now AI can play cards with flashback and retrace costs. + if(nextCardToPlay->getManaCost()->getFlashback()){ + if(payTheManaCost(nextCardToPlay->getManaCost()->getFlashback(),nextCardToPlay->has(Constants::ANYTYPEOFMANA),nextCardToPlay,gotPayments)) + { + AIAction * a = NEW AIAction(this, nextCardToPlay); + clickstream.push(a); + gotPayments.clear(); + } + } else if(nextCardToPlay->getManaCost()->getRetrace()){ + if(payTheManaCost(nextCardToPlay->getManaCost()->getRetrace(),nextCardToPlay->has(Constants::ANYTYPEOFMANA),nextCardToPlay,gotPayments)) + { + AIAction * a = NEW AIAction(this, nextCardToPlay); + clickstream.push(a); + gotPayments.clear(); + } + } + } else { + if(payTheManaCost(nextCardToPlay->getManaCost(),nextCardToPlay->has(Constants::ANYTYPEOFMANA),nextCardToPlay,gotPayments)) + { + AIAction * a = NEW AIAction(this, nextCardToPlay); + clickstream.push(a); + gotPayments.clear(); + } } return 1; } diff --git a/projects/mtg/src/DeckStats.cpp b/projects/mtg/src/DeckStats.cpp index d24abca13..57e46a726 100644 --- a/projects/mtg/src/DeckStats.cpp +++ b/projects/mtg/src/DeckStats.cpp @@ -493,7 +493,7 @@ void StatsWrapper::updateStats(DeckDataWrapper *myDeck) for (int v = 0; v < (int) abilitiesVector.size(); v++) { string s = abilitiesVector[v]; - size_t t = s.find("add"); + size_t t = s.find("add{"); //Fix crash when ability contains "counteradded" or similar substring. if (t != string::npos) { s = s.substr(t + 3);