diff --git a/CHANGELOG.md b/CHANGELOG.md index 08675f7b9..634a0a9ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,11 @@ ## [master] (https://github.com/WagicProject/wagic/tree/master) +### 12/09/21 +- *Committed:* Added/Fixed primitives, updated the "missing_cards_by_sets" folder, added a new option "keepname" to keep the original name after the copy (e.g. Olag, Ludevic's Hubris), implemented a fix to avoid triggering of oneshot abilities when "flip" ability is used to return from a copy, fixed an issue with colors and "transforms" keyword, implemented a fix to avoid crashes when the card paying extracost has also a cost alteration (e.g. combo with "Pirate's Pillage" and "Ruby Medallion"), added a new keyword "totmanaspent" to return the real amount of mana spent to cast a card (e.g. Memory Deluge), added new keywords "pnumofidentitycols" and "onumofidentitycols" to return the total amount of commander identity colors for controller or opponent (e.g. War Room), improved "totcnt" keyword, added new keywords "totalcololorsinplay" and "oppototalcololorsinplay" to return the total amount of colors on controller or opponent battlefield (e.g. Moonveil Regent), added new keywords "pcoven" and "ocoven" to return if a player controls three or more creatures with different powers (e.g. Augur of Autumn). ([Vitty85](https://github.com/Vitty85)) + ### 07/09/21 -- *Committed:* Added/fixed primitives, updated the "missing_cards_by_sets" folder, added new ability "hasstrive" to implement Strive cost with multikicker and refactored all cards with Strive cost (now they use a special version of multikicker but they don't count as kicked spell), improved "targeted" and "vampired" trigger to allow the "turnlimited" option, improved Android gesture to emulate "option menu" button pressure (slide down) and emulate "back" button pressure (slide up). ([Vitty85](https://github.com/Vitty85)) +- *Committed:* Added/fixed primitives, updated the "missing_cards_by_sets" folder, added new ability "hasstrive" to implement Strive cost with multikicker and refactored all cards with Strive cost (now they use a special version of multikicker but they don't count as kicked spell), improved "targeted" and "vampired" trigger to allow the "turnlimited" option, improved Android gesture to emulate "option menu" button pressure (slide down) and emulate "back" button pressure (slide up). https://github.com/WagicProject/wagic/commit/9aa15766d455c6b9f5fec1bb003ca35a34cbb5fc ([Vitty85](https://github.com/Vitty85)) ### 06/09/21 - *Committed:* Fixed primitives, changed type of "isFlipped" card variable from bool to int and fixed a related bug on targeting cards with "isFlipped" attribute, improved "disturb" ability (now fi you counter a card casted with disturb it correctly goes to exile), added "decayed" ability, added two new zone alias "mycommandplay" and "opponentcommandplay" for targeting Battlefield and CommandZone at the same time. https://github.com/WagicProject/wagic/commit/9dabf121d3719aa0d684e9d5d9732dc1b4a92b3d ([Vitty85](https://github.com/Vitty85)) diff --git a/projects/mtg/bin/Res/missing_cards_by_sets/10E.txt b/projects/mtg/bin/Res/missing_cards_by_sets/10E.txt index b85b8e811..2630aae94 100644 --- a/projects/mtg/bin/Res/missing_cards_by_sets/10E.txt +++ b/projects/mtg/bin/Res/missing_cards_by_sets/10E.txt @@ -14,12 +14,6 @@ mana={4}{U}{U} type=Instant [/card] [card] -name=Pithing Needle -text=As Pithing Needle enters the battlefield, name a card. -- Activated abilities of sources with the chosen name can't be activated unless they're mana abilities. -mana={1} -type=Artifact -[/card] -[card] name=High Ground text=Each creature you control can block an additional creature. mana={W} diff --git a/projects/mtg/bin/Res/missing_cards_by_sets/M10.txt b/projects/mtg/bin/Res/missing_cards_by_sets/M10.txt index e90200b07..15667d62a 100644 --- a/projects/mtg/bin/Res/missing_cards_by_sets/M10.txt +++ b/projects/mtg/bin/Res/missing_cards_by_sets/M10.txt @@ -11,12 +11,6 @@ mana={W} type=Instant [/card] [card] -name=Pithing Needle -text=As Pithing Needle enters the battlefield, name a card. -- Activated abilities of sources with the chosen name can't be activated unless they're mana abilities. -mana={1} -type=Artifact -[/card] -[card] name=Mirror of Fate text={T}, Sacrifice Mirror of Fate: Choose up to seven face-up exiled cards you own. Exile all the cards from your library, then put the chosen cards on top of your library. mana={5} diff --git a/projects/mtg/bin/Res/missing_cards_by_sets/MPS.txt b/projects/mtg/bin/Res/missing_cards_by_sets/MPS.txt index b28dd89f6..9ea3fe31f 100644 --- a/projects/mtg/bin/Res/missing_cards_by_sets/MPS.txt +++ b/projects/mtg/bin/Res/missing_cards_by_sets/MPS.txt @@ -1,10 +1,4 @@ [card] -name=Pithing Needle -text=As Pithing Needle enters the battlefield, name a card. -- Activated abilities of sources with the chosen name can't be activated unless they're mana abilities. -mana={1} -type=Artifact -[/card] -[card] name=Scroll Rack text={1}, {T}: Exile any number of cards from your hand face down. Put that many cards from the top of your library into your hand. Then look at the exiled cards and put them on top of your library in any order. mana={2} diff --git a/projects/mtg/bin/Res/missing_cards_by_sets/RTR.txt b/projects/mtg/bin/Res/missing_cards_by_sets/RTR.txt index 7c3caacdf..f4da240dc 100644 --- a/projects/mtg/bin/Res/missing_cards_by_sets/RTR.txt +++ b/projects/mtg/bin/Res/missing_cards_by_sets/RTR.txt @@ -37,9 +37,3 @@ text=As Tablet of the Guilds enters the battlefield, choose two colors. -- Whene mana={2} type=Artifact [/card] -[card] -name=Pithing Needle -text=As Pithing Needle enters the battlefield, name a card. -- Activated abilities of sources with the chosen name can't be activated unless they're mana abilities. -mana={1} -type=Artifact -[/card] diff --git a/projects/mtg/bin/Res/missing_cards_by_sets/SOK.txt b/projects/mtg/bin/Res/missing_cards_by_sets/SOK.txt index 6ca5b87e8..28773d407 100644 --- a/projects/mtg/bin/Res/missing_cards_by_sets/SOK.txt +++ b/projects/mtg/bin/Res/missing_cards_by_sets/SOK.txt @@ -117,9 +117,3 @@ subtype=Zubera Spirit power=3 toughness=3 [/card] -[card] -name=Pithing Needle -text=As Pithing Needle enters the battlefield, name a card. -- Activated abilities of sources with the chosen name can't be activated unless they're mana abilities. -mana={1} -type=Artifact -[/card] diff --git a/projects/mtg/bin/Res/sets/primitives/borderline.txt b/projects/mtg/bin/Res/sets/primitives/borderline.txt index 4fa86bed6..6378696c1 100644 --- a/projects/mtg/bin/Res/sets/primitives/borderline.txt +++ b/projects/mtg/bin/Res/sets/primitives/borderline.txt @@ -2473,12 +2473,11 @@ type=Land [/card] [card] name=Arcane Signet -auto=if type(*[red]|myzones)~morethan~0 then transforms((,newability[{T}:add{R}])) forever -auto=if type(*[white]|myzones)~morethan~0 then transforms((,newability[{T}:add{W}])) forever -auto=if type(*[green]|myzones)~morethan~0 then transforms((,newability[{T}:add{G}])) forever -auto=if type(*[blue]|myzones)~morethan~0 then transforms((,newability[{T}:add{U}])) forever -auto=if type(*[black]|myzones)~morethan~0 then transforms((,newability[{T}:add{B}])) forever -auto=if type(*[-black;-red;-white;-blue;-green]|myzones)~morethan~0 then transforms((,newability[{T}:add{C}])) forever +auto=aslongas(*[iscommander&red]|myzones) {T}:add{R} +auto=aslongas(*[iscommander&white]|myzones) {T}:add{W} +auto=aslongas(*[iscommander&green]|myzones) {T}:add{G} +auto=aslongas(*[iscommander&blue]|myzones) {T}:add{U} +auto=aslongas(*[iscommander&black]|myzones) {T}:add{B} text={T}: Add one mana of any color in your commander's color identity. mana={2} type=Artifact @@ -5265,7 +5264,7 @@ type=Instant name=Belbe, Corrupted Observer text=At the beginning of each player's postcombat main phase, that player adds {C}{C} for each of your opponents who lost life this turn. (Damage causes loss of life.) auto=@each my secondmain restriction{compare(oplifelost)~morethan~0}:add{C}{C} -auto=@each opponent secondmain restriction{compare(lifelost)~morethan~0}:add{C}{C} opponent +auto=@each opponent secondmain restriction{compare(oplifelost)~morethan~0}:add{C}{C} opponent mana={B}{G} type=Legendary Creature subtype=Zombie Elf @@ -11894,12 +11893,11 @@ type=Land [/card] [card] name=Command Tower -auto=if type(*[red]|myzones)~morethan~0 then transforms((,newability[{T}:add{R}])) forever -auto=if type(*[white]|myzones)~morethan~0 then transforms((,newability[{T}:add{W}])) forever -auto=if type(*[green]|myzones)~morethan~0 then transforms((,newability[{T}:add{G}])) forever -auto=if type(*[blue]|myzones)~morethan~0 then transforms((,newability[{T}:add{U}])) forever -auto=if type(*[black]|myzones)~morethan~0 then transforms((,newability[{T}:add{B}])) forever -auto=if type(*[-black;-red;-white;-blue;-green]|myzones)~morethan~0 then transforms((,newability[{T}:add{C}])) forever +auto=aslongas(*[iscommander&red]|myzones) {T}:add{R} +auto=aslongas(*[iscommander&white]|myzones) {T}:add{W} +auto=aslongas(*[iscommander&green]|myzones) {T}:add{G} +auto=aslongas(*[iscommander&blue]|myzones) {T}:add{U} +auto=aslongas(*[iscommander&black]|myzones) {T}:add{B} text={T}: Add to your mana pool one mana of any color in your commander's color identity. type=Land [/card] @@ -11939,12 +11937,11 @@ name=Commander's Plate auto={5}:equip auto=aslongas(*[iscommander]|myBattlefield) {3}:name(equip a commander) name(equip a commander) rehook target(creature[iscommander]|mybattlefield) auto=teach(creature) 3/3 -auto=aslongas(*[red]|myzones) teach(creature) protection from red <1 -auto=aslongas(*[white]|myzones) teach(creature) protection from white <1 -auto=aslongas(*[green]|myzones) teach(creature) protection from green <1 -auto=aslongas(*[blue]|myzones) teach(creature) protection from blue <1 -auto=aslongas(*[black]|myzones) then teach(creature) protection from black <1 -auto=aslongas(*[colorless]|myzones) teach(creature) protection from(artifact) <1 +auto=aslongas(*[red]|myzones) <1 teach(creature) aslongas(*[iscommander]|myzones) protection from red +auto=aslongas(*[white]|myzones) <1 teach(creature) aslongas(*[iscommander]|myzones) protection from white +auto=aslongas(*[green]|myzones) <1 teach(creature) aslongas(*[iscommander]|myzones) protection from green +auto=aslongas(*[blue]|myzones) <1 teach(creature) aslongas(*[iscommander]|myzones) protection from blue +auto=aslongas(*[black]|myzones) <1 teach(creature) aslongas(*[iscommander]|myzones) protection from black text=Equipped creature gets +3/+3 and has protection from each color that's not in your commander's color identity. -- Equip commander {3} -- Equip {5} mana={1} type=Artifact @@ -11953,12 +11950,11 @@ subtype=Equipment [card] name=Commander's Sphere auto={S}:name(Sacrifice and draw) draw:1 controller -auto=aslongas(*[red]|myzones) {T}:add{R} -auto=aslongas(*[white]|myzones) {T}:add{W} -auto=aslongas(*[green]|myzones) {T}:add{G} -auto=aslongas(*[blue]|myzones) {T}:add{U} -auto=aslongas(*[black]|myzones) {T}:add{B} -auto=aslongas(*[colorless]|myzones) {T}:add{C} +auto=aslongas(*[iscommander&red]|myzones) {T}:add{R} +auto=aslongas(*[iscommander&white]|myzones) {T}:add{W} +auto=aslongas(*[iscommander&green]|myzones) {T}:add{G} +auto=aslongas(*[iscommander&blue]|myzones) {T}:add{U} +auto=aslongas(*[iscommander&black]|myzones) {T}:add{B} text={T}: Add to your mana pool one mana of any color in your commander's color identity. -- Sacrifice Commander's Sphere: Draw a card. mana={3} type=Artifact @@ -21147,7 +21143,7 @@ toughness=0 [card] name=Faerie Artisans abilities=flying -auto=@movedto(creature[-token]|opponentBattlefield) clone(creature[-token]|opponentBattlefield) with (transform[artifact]) then moveTo(exile all[other tokens creature]|myBattlefield) +auto=@movedto(creature[-token]|opponentBattlefield):name(Copy creature) all(trigger[to]) clone addtype(artifact) and!( transform((,newability[counter(0/0.1.ArtisanCreated)],newability[name(Exile other tokens) all(other creature[counter{0/0.1.ArtisanCreated}]|myBattlefield) moveTo(exile)])) oneshot )! text=Flying -- Whenever a nontoken creature enters the battlefield under an opponent’s control, create a token that’s a copy of that creature except it’s an artifact in addition to its other types. Then exile all other tokens created with Faerie Artisans. mana={3}{U} type=Creature @@ -22118,7 +22114,7 @@ type=Sorcery [card] name=Field of Ruin auto={T}:Add{1} -auto={2}{T}{S}:destroy target(land[-basic]|opponentlbattlefield) && moveto(mybattlefield) target(basic|mylibrary) && ability$!moveto(mybattlefield) target(basic|mylibrary)!$ opponent +auto={2}{T}{S}:name(Destroy non-basic land) target(land[-basic]|opponentbattlefield) destroy && ability$!name(Search library) name(Search library) target(land[basic]|mylibrary) moveto(mybattlefield) and!( shuffle )! !$ controller && ability$!name(Search library) name(Search library) target(land[basic]|mylibrary) moveto(mybattlefield) and!( shuffle )! !$ opponent text={T}: Add {1} to your mana pool. -- {2}, {T}, Sacrifice Field of Ruin: Destroy target nonbasic land an opponent controls. Each player searches his or her library for a basic land card, puts it onto the battlefield, then shuffles his or her library. type=Land [/card] @@ -41206,7 +41202,7 @@ subtype=Equipment [/card] [card] name=Mirror of the Forebears -auto=chooseatype transforms(([{1}:becomes [clone target(creature[chosentype]|myBattlefield)] && transforms(artifact)])) chooseend ueot +auto=chooseatype transforms((,newability[{1}:name(Becomes copy) target(creature[chosentype]|myBattlefield) copy and!( all(this) transforms((Artifact,newability[phaseaction[endofturn once] flip(Mirror of the Forebears) undocpy])) forever )!])) forever chooseend text=As Mirror of the Forebears enters the battlefield, choose a creature type. -- {1}: Until end of turn, Mirror of the Forebears becomes a copy of target creature you control of the chosen type, except it’s an artifact in addition to its other types. mana={2} type=Artifact @@ -44901,8 +44897,8 @@ type=Enchantment [/card] [card] name=Opal Acrolith -auto=@movedTo(creature|opponentstack):transforms((removetypes)) forever && transforms((Soldier Creature,setpower=2,settoughness=4)) forever -auto={0}:transforms((removetypes,newability[becomes(Enchantment)])) forever +auto=@movedTo(creature|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Soldier Creature,setpower=2,settoughness=4)) forever +auto={0}:name(Becomes an enchantment) transforms((removetypes,newability[becomes(Enchantment)])) forever text=Whenever an opponent casts a creature spell, if Opal Acrolith is an enchantment, Opal Acrolith becomes a 2/4 Soldier creature. -- {0}: Opal Acrolith becomes an enchantment. mana={2}{W} type=Enchantment @@ -44910,22 +44906,46 @@ type=Enchantment [card] name=Opal Palace auto={T}:add{C} -auto=if type(*[red]|myzones)~morethan~0 then transforms((,newability[{T}:add{R}])) forever -auto=if type(*[white]|myzones)~morethan~0 then transforms((,newability[{T}:add{W}])) forever -auto=if type(*[green]|myzones)~morethan~0 then transforms((,newability[{T}:add{G}])) forever -auto=if type(*[blue]|myzones)~morethan~0 then transforms((,newability[{T}:add{U}])) forever -auto=if type(*[black]|myzones)~morethan~0 then transforms((,newability[{T}:add{B}])) forever -auto=@movedto(*[iscommander]|mybattlefield) from(mycommandzone):all(trigger[to]) counter(1/1,pnumofcommandcast) limit:1 +auto=aslongas(*[iscommander&red]|myzones) {1}{T}:name(Add red mana) name(Add red mana) transforms((,newability[add{R}],newability[if type(*[iscommander]|myrestrictedcastingzone)~morethan~0 then counter(0/0.1.OpalEffect)])) oneshot +auto=aslongas(*[iscommander&white]|myzones) {1}{T}:name(Add white mana) name(Add white mana) transforms((,newability[add{W}],newability[if type(*[iscommander]|myrestrictedcastingzone)~morethan~0 then counter(0/0.1.OpalEffect)])) oneshot +auto=aslongas(*[iscommander&green]|myzones) {1}{T}:name(Add green mana) name(Add green mana) transforms((,newability[add{G}],newability[if type(*[iscommander]|myrestrictedcastingzone)~morethan~0 then counter(0/0.1.OpalEffect)])) oneshot +auto=aslongas(*[iscommander&blue]|myzones) {1}{T}:name(Add blue mana) name(Add blue mana) transforms((,newability[add{U}],newability[if type(*[iscommander]|myrestrictedcastingzone)~morethan~0 then counter(0/0.1.OpalEffect)])) oneshot +auto=aslongas(*[iscommander&black]|myzones) {1}{T}:name(Add black mana) name(Add black mana) transforms((,newability[add{B}],newability[if type(*[iscommander]|myrestrictedcastingzone)~morethan~0 then counter(0/0.1.OpalEffect)])) oneshot +auto=@movedto(*[iscommander]|mybattlefield) restriction{compare(hascntopaleffect)~morethan~0}:name(Put 1/1 counter) all(trigger[to]) name(Put 1/1 counter) transforms((,newability[counter(1/1.numofcommandcast)])) oneshot +auto=@movedto(*[iscommander]|mybattlefield) restriction{compare(hascntopaleffect)~morethan~0}:name(Effect ends) removeallcounters(0/0.1.OpalEffect) +auto=@each endofturn restriction{compare(hascntopaleffect)~morethan~0}:name(Effect ends) removeallcounters(0/0.1.OpalEffect) text={T}: Add {C} to your mana pool. -- {1}, {T}: Add to your mana pool one mana of any color in your commander's color identity. If you spend this mana to cast your commander, it enters the battlefield with a number of additional +1/+1 counters on it equal to the number of times it's been cast from the command zone this game. type=Land [/card] [card] name=Opal Titan -auto=@movedTo(creature[blue]|opponentstack):transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,newability[protection from blue)) forever -auto=@movedTo(creature[white]|opponentstack):transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,newability[protection from white)) forever -auto=@movedTo(creature[green]|opponentstack):transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,newability[protection from green)) forever -auto=@movedTo(creature[black]|opponentstack):transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,newability[protection from black)) forever -auto=@movedTo(creature[red]|opponentstack):transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,newability[protection from red)) forever +auto=@movedTo(creature[blue;-multicolor]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from blue])) forever +auto=@movedTo(creature[white;-multicolor]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from white])) forever +auto=@movedTo(creature[green;-multicolor]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from green])) forever +auto=@movedTo(creature[black;-multicolor]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from black])) forever +auto=@movedTo(creature[red;-multicolor]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from red])) forever +auto=@movedto(creature[red&blue;-green;-black;-white]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from blue],newability[protection from red])) forever +auto=@movedto(creature[red&green;-blue;-black;-white]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from green],newability[protection from red])) forever +auto=@movedto(creature[red&black;-blue;-green;-white]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from black],newability[protection from red])) forever +auto=@movedto(creature[red&white;-blue;-green;-black]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from white],newability[protection from red])) forever +auto=@movedto(creature[white&blue;-green;-black;-red]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from blue],newability[protection from white])) forever +auto=@movedto(creature[white&green;-blue;-black;-red]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from white],newability[protection from green])) forever +auto=@movedto(creature[white&black;-blue;-green;-red]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from white],newability[protection from black])) forever +auto=@movedto(creature[black&blue;-green;-black;-red]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from blue],newability[protection from black])) forever +auto=@movedto(creature[black&green;-blue;-black;-red]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from black],newability[protection from green])) forever +auto=@movedto(creature[green&blue;-red;-black;-white]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from blue],newability[protection from green])) forever +auto=@movedto(creature[green&blue&red;-black;-white]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from green],newability[protection from blue],newability[protection from red])) forever +auto=@movedto(creature[green&blue&black;-red;-white]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from blue],newability[protection from black],newability[protection from green])) forever +auto=@movedto(creature[green&blue&white;-red;-black]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from green],newability[protection from blue],newability[protection from white])) forever +auto=@movedto(creature[red&blue&black;-green;-white]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from blue],newability[protection from black],newability[protection from red])) forever +auto=@movedto(creature[red&blue&white;-green;-black]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from blue],newability[protection from white],newability[protection from red])) forever +auto=@movedto(creature[black&blue&white;-green;-red]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from black],newability[protection from blue],newability[protection from white])) forever +auto=@movedto(creature[black&blue&white&green;-red]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from black],newability[protection from blue],newability[protection from white],newability[protection from green])) forever +auto=@movedto(creature[black&blue&white&red;-green]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from black],newability[protection from blue],newability[protection from white],newability[protection from red])) forever +auto=@movedto(creature[black&blue&red&green;-white]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from black],newability[protection from blue],newability[protection from green],newability[protection from red])) forever +auto=@movedto(creature[black&red&white&green;-blue]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from black],newability[protection from red],newability[protection from white],newability[protection from green])) forever +auto=@movedto(creature[blue&red&white&green;-black]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from blue],newability[protection from red],newability[protection from white],newability[protection from green])) forever +auto=@movedto(creature[black&blue&white&green&red]|opponentstack):if cantargetcard(*[enchantment]|*) then transforms((removetypes)) forever && transforms((Giant Creature,setpower=4,settoughness=4,white,newability[protection from white],newability[protection from black],newability[protection from green],newability[protection from blue],newability[protection from red])) forever text=When an opponent casts a creature spell, if Opal Titan is an enchantment, Opal Titan becomes a 4/4 Giant creature with protection from each of that spell's colors. mana={2}{W}{W} type=Enchantment @@ -46267,12 +46287,14 @@ toughness=4 name=Path of Ancestry auto=tap(noevent) aicode=activate transforms((,newability[all(*[zpos<=1]|mylibrary) transforms((,newability[may name(Put on bottom of library) moveto(myreveal) and!( bottomoflibrary )!])) oneshot])) oneshot -auto=if type(*[red]|myzones)~morethan~0 then transforms((,newability[{T}:add{R} && scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) forever -auto=if type(*[white]|myzones)~morethan~0 then transforms((,newability[{T}:add{W} && scry:1 scrycore delayed dontshow donothing scrycoreend scryend}])) forever -auto=if type(*[green]|myzones)~morethan~0 then transforms((,newability[{T}:add{G} && scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) forever -auto=if type(*[blue]|myzones)~morethan~0 then transforms((,newability[{T}:add{U} && scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) forever -auto=if type(*[black]|myzones)~morethan~0 then transforms((,newability[{T}:add{B} && scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) forever -auto=if type(*[-black;-red;-white;-blue;-green]|myzones)~morethan~0 then transforms((,newability[{T}:add{C} && scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) forever +auto=aslongas(*[iscommander&red]|myzones) {T}:name(Add red mana) name(Add red mana) transforms((,newability[add{R}],newability[if type(creature|myrestrictedcastingzone)~morethan~0 then counter(0/0.1.PathEffect)])) oneshot +auto=aslongas(*[iscommander&white]|myzones) {T}:name(Add white mana) name(Add white mana) transforms((,newability[add{W}],newability[if type(creature|myrestrictedcastingzone)~morethan~0 then counter(0/0.1.PathEffect)])) oneshot +auto=aslongas(*[iscommander&green]|myzones) {T}:name(Add green mana) name(Add green mana) transforms((,newability[add{G}],newability[if type(creature|myrestrictedcastingzone)~morethan~0 then counter(0/0.1.PathEffect)])) oneshot +auto=aslongas(*[iscommander&blue]|myzones) {T}:name(Add blue mana) name(Add blue mana) transforms((,newability[add{U}],newability[if type(creature|myrestrictedcastingzone)~morethan~0 then counter(0/0.1.PathEffect)])) oneshot +auto=aslongas(*[iscommander&black]|myzones) {T}:name(Add black mana) name(Add black mana) transforms((,newability[add{B}],newability[if type(creature|myrestrictedcastingzone)~morethan~0 then counter(0/0.1.PathEffect)])) oneshot +auto=@movedto(creature|mybattlefield) restriction{compare(hascntpatheffect)~morethan~0}:name(Scry if share type) all(trigger[to]) name(Scry if share type) transforms((,newability[if type(*[iscommander&share!types!]|myzones)~morethan~0 then scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) oneshot +auto=@movedto(creature|mybattlefield) restriction{compare(hascntpatheffect)~morethan~0}:name(Effect ends) removeallcounters(0/0.1.PathEffect) +auto=@each endofturn restriction{compare(hascntpatheffect)~morethan~0}:name(Effect ends) removeallcounters(0/0.1.PathEffect) text=Path of Ancestry enters the battlefield tapped. -- {T}: Add one mana of any color in your commander's color identity. When that mana is spent to cast a creature spell that shares a creature type with your commander, scry 1. type=Land [/card] @@ -46833,7 +46855,7 @@ toughness=3 [/card] [card] name=Phyrexian Metamorph -auto=may copy NotATarget(creature,artifact) transform(artifact) forever +auto=may name(Copy artifact or creature) target(*[creature;artifact]|battlefield) copy and!( transforms((Artifact)) forever )! text=({U/P} can be paid with either {U} or 2 life.) -- You may have Phyrexian Metamorph enter the battlefield as a copy of any artifact or creature on the battlefield, except it’s an artifact in addition to its other types. mana={3}{P(U)} type=Artifact Creature @@ -47118,7 +47140,7 @@ color=red [/card] [card] name=Pirate's Cutlass -auto=aslongas(parents) name(Attach to creature) rehook target(creature|myBattlefield) <1 +auto=name(Attach to creature) rehook target(creature|myBattlefield) auto=teach(creature) 2/1 auto={2}:equip text=When Pirate's Cutlass enters the battlefield, attach it to target Pirate you control. -- Equipped creature gets +2/+1. -- Equip {2} ({2}: Attach to target creature you control. Equip only as a sorcery.) @@ -47130,7 +47152,7 @@ subtype=Equipment name=Pirate's Pillage auto=draw:2 controller auto=token(Treasure Sur)*2 -text=As an additional cost to cast this spell, discard a card. -- Draw two cards and create two Treasure tokens. (They're artifacts with " {T}, Sacrifice this artifact: Add one mana of any color.") +text=As an additional cost to cast this spell, discard a card. -- Draw two cards and create two Treasure tokens. (They're artifacts with "{T}, Sacrifice this artifact: Add one mana of any color.") mana={3}{R}{D(other *|myhand)} type=Sorcery [/card] @@ -47176,6 +47198,13 @@ power=2 toughness=5 [/card] [card] +name=Pithing Needle +auto=chooseanameopp lord(*[chosenname]) noactivatedability chooseend +text=As Pithing Needle enters the battlefield, name a card. -- Activated abilities of sources with the chosen name can't be activated unless they're mana abilities. +mana={1} +type=Artifact +[/card] +[card] name=Pitiless Gorgon abilities=deathtouch text=Deathtouch @@ -54039,9 +54068,9 @@ type=Instant [/card] [card] name=Saheeli's Artistry -auto=choice clone target(artifact) -auto=choice clone target(creature) && transforms(artifact) forever -auto=choice clone target(artifact) then clone target(creature) && transforms(artifact) forever +auto=if type(artifact|battlefield)~morethan~0 then choice name(Clone an artifact) name(Clone an artifact) target(artifact) clone +auto=if type(creature|battlefield)~morethan~0 then choice name(Clone a creature) name(Clone a creature) target(creature) clone addtype(artifact) +auto=if type(artifact|battlefield)~morethan~0 then if type(creature|battlefield)~morethan~0 then choice name(Choose both) name(Choose both) name(Choose both) target(artifact) clone && ability$!name(Clone a creature) name(Clone a creature) target(creature) clone addtype(artifact)!$ controller text=Choose one or both — • Create a token that’s a copy of target artifact. • Create a token that’s a copy of target creature, except it’s an artifact in addition to its other types. mana={4}{U}{U} type=Sorcery @@ -72096,7 +72125,8 @@ toughness=3 [/card] [card] name=War Barge -auto={3}:target(creature) islandwalk ueot && transforms((,newability[@movedto(War Barge|graveyard) from(battlefield):bury all(this)])) forever +auto={3}:name(Your creature gains islandwalk) target(creature|myBattlefield) transforms((,newability[islandwalk],newability[@movedto(War Barge|nonbattlezone) from(mybattlefield):bury])) ueot +auto={3}:name(Opponent creature gains islandwalk) target(creature|opponentBattlefield) transforms((,newability[islandwalk],newability[@movedto(War Barge|nonbattlezone) from(opponentBattlefield):bury])) ueot text={3}: Target creature gains islandwalk until end of turn. When War Barge leaves the battlefield this turn, destroy that creature. A creature destroyed this way can't be regenerated. mana={4} type=Artifact @@ -72104,11 +72134,7 @@ type=Artifact [card] name=War Room auto={T}:add{C} -auto={L:1}{3}{T}:name(1 color in your identity) name(1 color in your identity) draw:1 controller -auto={L:2}{3}{T}:name(2 colors in your identity) name(2 colors in your identity) draw:1 controller -auto={L:3}{3}{T}:name(3 colors in your identity) name(3 colors in your identity) draw:1 controller -auto={L:4}{3}{T}:name(4 colors in your identity) name(4 colors in your identity) draw:1 controller -auto={L:5}{3}{T}:name(5 colors in your identity) name(5 colors in your identity) draw:1 controller +auto=aslongas(*[iscommander]|myzones) {L:pnumofidentitycols}{3}{T}:name(Draw a card) name(Draw a card) draw:1 controller text={T}: Add {C}. -- {3}, {T}, Pay life equal to the number of colors in your commanders' color identity: Draw a card. type=Land [/card] diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index ded5f0a19..a3a3f822e 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -120715,7 +120715,7 @@ abilities=vigilance backside=Thraben Militia restriction=compare(isflipped)~equalto~0 anyzone={0}:doubleside(backside) -auto=@movedTo(creature|graveyard) from(mybattlefield):may flip() +auto=@movedTo(other creature|graveyard) from(mybattlefield):may flip(backside) text=Vigilance -- Whenever another creature you control dies, you may transform Thraben Sentry. // Thraben Militia mana={3}{W} type=Creature diff --git a/projects/mtg/bin/Res/sets/primitives/unsupported.txt b/projects/mtg/bin/Res/sets/primitives/unsupported.txt index 6eb110b60..eeaccfc47 100644 --- a/projects/mtg/bin/Res/sets/primitives/unsupported.txt +++ b/projects/mtg/bin/Res/sets/primitives/unsupported.txt @@ -7846,12 +7846,6 @@ mana={U}{U} type=Sorcery [/card] [card] -name=Pithing Needle -text=As Pithing Needle enters the battlefield, name a card. -- Activated abilities of sources with the chosen name can't be activated unless they're mana abilities. -mana={1} -type=Artifact -[/card] -[card] name=Plague of Vermin text=Starting with you, each player may pay any amount of life. Repeat this process until no one pays life. Each player puts a 1/1 black Rat creature token onto the battlefield for each 1 life he or she paid this way. mana={6}{B} diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index a2546ad4b..62684b601 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -2031,6 +2031,10 @@ int AACopier::resolve() /*since we look for the real card it will not copy granted haste ability however for token we copy all*/ /*but how to do backup for token so we just copy the backup???*/ bool nolegend = options.find("nolegend") != string::npos; // Check if the copy has to be legendary or not. (e.g. Echoing Equation) + string keepname = ""; + if(options.find("keepname") != string::npos){ // Keep the original name after the copy. (e.g. "Olag, Ludevic's Hubris") + keepname = source->getName(); + } if(tokencopied && !_target->isACopier && !_target->getMTGId()) { source->copy(_target->tokCard, nolegend); @@ -2138,6 +2142,8 @@ int AACopier::resolve() andAbilityClone->addToGame(); } } + if(keepname != "") + source->name = keepname; // Keep the original name after the copy. (e.g. "Olag, Ludevic's Hubris") } currentAbilities.clear(); return 1; @@ -4822,21 +4828,25 @@ int AAFlip::resolve() { if (a->oneShot) { - if(_target->hasType(Subtypes::TYPE_PLANESWALKER)){ // Fix to don't let planeswalker die on flip (since the counter ability is not resolving correctly during flip). - AACounter * tmp = dynamic_cast(a); - if(tmp && tmp->counterstring.find("loyalty") != string::npos){ - for (int j = 0; j < tmp->nb; j++) - _target->counters->addCounter("loyalty", 0, 0, true); + if(!backfromcopy){ // Fix to avoid triggering of oneshot abilities when flip is used to return from a copy. + if(_target->hasType(Subtypes::TYPE_PLANESWALKER)){ // Fix to don't let planeswalker die on flip (since the counter ability is not resolving correctly during flip). + AACounter * tmp = dynamic_cast(a); + if(tmp && tmp->counterstring.find("loyalty") != string::npos){ + for (int j = 0; j < tmp->nb; j++) + _target->counters->addCounter("loyalty", 0, 0, true); + } else a->resolve(); } else a->resolve(); - } else a->resolve(); + } SAFE_DELETE(a); } else { - a->addToGame(); MayAbility * dontAdd = dynamic_cast(a); - if(!dontAdd) + if(!dontAdd){ + a->addToGame(); _target->cardsAbilities.push_back(a); + } else if(!backfromcopy) // Fix to avoid triggering of may abilities when flip is used to return from a copy (e.g. Mirror of the Forebears). + a->addToGame(); } } } @@ -10270,11 +10280,17 @@ void PopulateColorIndexVector(list& colors, const string& colorStringList, vector abilitiesList = split(colorStringList, delimiter); for (vector::iterator iter = abilitiesList.begin(); iter != abilitiesList.end(); ++iter) { + // if the text is not a basic ability but contains a valid color add it to the color vector + if((*iter).find("newcolors[") != string::npos){ + size_t start_pos = (*iter).find("newcolors["); + (*iter).replace(start_pos, 10, ""); + start_pos = (*iter).find("]"); + (*iter).replace(start_pos, 1, ""); + } for (int colorIndex = Constants::MTG_COLOR_ARTIFACT; colorIndex < Constants::NB_Colors; ++colorIndex) { - // if the text is not a basic ability but contains a valid color add it to the color vector - if ((Constants::GetBasicAbilityIndex(*iter) == -1) - && ((*iter).find(Constants::MTGColorStrings[colorIndex]) != string::npos)) + // We match now exactly the color to avoid wrong color assignment from gained abilities (e.g. protection from blue) + if ((Constants::GetBasicAbilityIndex(*iter) == -1) && ((*iter) == Constants::MTGColorStrings[colorIndex])) colors.push_back(colorIndex); } } diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 6e9a5fe85..ef8e55594 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -1172,8 +1172,8 @@ void GameObserver::Affinity() { for (int dd = 0; dd < 2; dd++) { - MTGGameZone * dzones[] = { players[dd]->game->graveyard, players[dd]->game->hand, players[dd]->game->library, players[dd]->game->exile }; - for (int kk = 0; kk < 4; kk++) + MTGGameZone * dzones[] = { players[dd]->game->graveyard, players[dd]->game->hand, players[dd]->game->library, players[dd]->game->commandzone, players[dd]->game->exile }; + for (int kk = 0; kk < 5; kk++) { MTGGameZone * zone = dzones[kk]; for (int cc = zone->nb_cards - 1; cc >= 0; cc--) @@ -1280,6 +1280,9 @@ void GameObserver::Affinity() if (!DoReduceIncrease) continue; + if (mExtraPayment != NULL && card == mExtraPayment->source) // Fix to avoid crash when the card paying extracost has also a cost alteration (e.g. combo with "Pirate's Pillage" and "Ruby Medallion"). + continue; + //above we check if there are even any cards that effect cards manacost //only do any of the following if a card with the stated ability is in your hand. //kicker is an addon to normal cost, suspend is not casting. add cost as needed EXACTLY as seen below. diff --git a/projects/mtg/src/WParsedInt.cpp b/projects/mtg/src/WParsedInt.cpp index 7828e855b..2663e0e42 100644 --- a/projects/mtg/src/WParsedInt.cpp +++ b/projects/mtg/src/WParsedInt.cpp @@ -424,13 +424,35 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card) intValue = card->previous->previous->sunburst; } } - else if (s == "converge") + else if (s == "converge" || s == "totmanaspent") { intValue = 0; - for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i) - { - if(card->getManaCost()->getManaUsedToCast()->hasColor(i)) - intValue +=1; + if(s == "converge"){ + for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i){ + if(card->getManaCost()->getManaUsedToCast() && card->getManaCost()->getManaUsedToCast()->hasColor(i)) + intValue +=1; + } + } else if(s == "totmanaspent") { // Return the real amount of mana spent to cast the card (e.g. Memory Deluge) + if(card->getManaCost()->getManaUsedToCast()) + intValue = card->getManaCost()->getManaUsedToCast()->getConvertedCost(); + else { + if(card->alternateCostPaid[ManaCost::MANA_PAID_WITH_RETRACE] == 1 && card->getManaCost()->getRetrace()) + intValue = card->getManaCost()->getRetrace()->getConvertedCost(); + else if(card->alternateCostPaid[ManaCost::MANA_PAID_WITH_FLASHBACK] == 1 && card->getManaCost()->getFlashback()) + intValue = card->getManaCost()->getFlashback()->getConvertedCost(); + else if(card->alternateCostPaid[ManaCost::MANA_PAID_WITH_ALTERNATIVE] == 1 && card->getManaCost()->getAlternative()) + intValue = card->getManaCost()->getAlternative()->getConvertedCost(); + else if(card->alternateCostPaid[ManaCost::MANA_PAID_WITH_BESTOW] == 1 && card->getManaCost()->getBestow()) + intValue = card->getManaCost()->getBestow()->getConvertedCost(); + else if(card->alternateCostPaid[ManaCost::MANA_PAID_WITH_BUYBACK] == 1 && card->getManaCost()->getBuyback()) + intValue = card->getManaCost()->getBuyback()->getConvertedCost(); + else if(card->alternateCostPaid[ManaCost::MANA_PAID_WITH_MORPH] == 1 && card->getManaCost()->getMorph()) + intValue = card->getManaCost()->getMorph()->getConvertedCost(); + else if(card->alternateCostPaid[ManaCost::MANA_PAID_WITH_SUSPEND] == 1 && card->getManaCost()->getSuspend()) + intValue = card->getManaCost()->getSuspend()->getConvertedCost(); + else + intValue = card->getManaCost()->getConvertedCost(); + } } } else if (s == "penergy" || s == "oenergy") @@ -469,9 +491,52 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card) { intValue = (s == "countmycrespell")?card->controller()->game->stack->seenThisTurn("creature", Constants::CAST_ALL):card->controller()->game->stack->seenThisTurn("*[-creature]", Constants::CAST_ALL); } - else if(s == "pnumofcommandcast" || s == "onumofcommandcast") + else if(s == "numofcommandcast" || s == "pnumofcommandcast" || s == "onumofcommandcast" || s == "pnumofidentitycols" || s == "onumofidentitycols") { - intValue = (s == "pnumofcommandcast")?card->controller()->numOfCommandCast:card->controller()->opponent()->numOfCommandCast; + intValue = 0; + if(s == "pnumofcommandcast") //Return how many times controller casted a commander (e.g. Skull Storm). + intValue = card->controller()->numOfCommandCast; + else if(s == "onumofcommandcast") //Return how many times controller casted a commander (e.g. Commander's Insight). + intValue = card->controller()->opponent()->numOfCommandCast; + else if(s == "numofcommandcast") //Return how many times this commander has been casted from command zone (e.g. Opal Palace). + intValue = card->numofcastfromcommandzone; + else if (s == "pnumofidentitycols" || s == "onumofidentitycols") //Return the total amount of commander identity colors for controller or opponent (e.g. War Room) + { + intValue = 0; + bool blueFound = false; + bool redFound = false; + bool whiteFound = false; + bool greenFound = false; + bool blackFound = false; + Player* p = card->controller(); + if (s == "onumofidentitycols") + p = card->controller()->opponent(); + MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->exile, p->game->commandzone, p->game->sideboard }; + for(int i = 0; i < 7; i++){ + for(int j = 0; j < zones[i]->nb_cards; j++){ + if(zones[i]->cards[j]->has(Constants::ISCOMMANDER) && zones[i]->cards[j]->hasColor(Constants::MTG_COLOR_RED) && !redFound){ + intValue++; + redFound = true; + } + if(zones[i]->cards[j]->has(Constants::ISCOMMANDER) && zones[i]->cards[j]->hasColor(Constants::MTG_COLOR_BLACK) && !blackFound){ + intValue++; + blackFound = true; + } + if(zones[i]->cards[j]->has(Constants::ISCOMMANDER) && zones[i]->cards[j]->hasColor(Constants::MTG_COLOR_BLUE) && !blueFound){ + intValue++; + blueFound = true; + } + if(zones[i]->cards[j]->has(Constants::ISCOMMANDER) && zones[i]->cards[j]->hasColor(Constants::MTG_COLOR_GREEN) && !greenFound){ + intValue++; + greenFound = true; + } + if(zones[i]->cards[j]->has(Constants::ISCOMMANDER) && zones[i]->cards[j]->hasColor(Constants::MTG_COLOR_WHITE) && !whiteFound){ + intValue++; + whiteFound = true; + } + } + } + } } else if (s == "isflipped" || s == "iscopied") // Return 1 if card has been flipped -- Return 1 if card has copied another card { @@ -1230,7 +1295,12 @@ void WParsedInt::extendedParse(string s, Spell * spell, MTGCardInstance * card) { intValue = 0; for (int j = card->controller()->game->inPlay->nb_cards - 1; j >= 0; --j){ - if ((s.find("totcntcre") != string::npos || s.find("totcntall") != string::npos) && card->controller()->game->inPlay->cards[j]->hasType(Subtypes::TYPE_CREATURE)){ + if ((s.find("totcntcre") != string::npos && card->controller()->game->inPlay->cards[j]->hasType(Subtypes::TYPE_CREATURE)) || + (s.find("totcntpla") != string::npos && card->controller()->game->inPlay->cards[j]->hasType(Subtypes::TYPE_PLANESWALKER)) || + (s.find("totcntart") != string::npos && card->controller()->game->inPlay->cards[j]->hasType(Subtypes::TYPE_ARTIFACT)) || + (s.find("totcntenc") != string::npos && card->controller()->game->inPlay->cards[j]->hasType(Subtypes::TYPE_ENCHANTMENT)) || + (s.find("totcntlan") != string::npos && card->controller()->game->inPlay->cards[j]->hasType(Subtypes::TYPE_LAND)) || + s.find("totcntall") != string::npos){ if (card->controller()->game->inPlay->cards[j]->counters){ Counters * counters = card->controller()->game->inPlay->cards[j]->counters; for(size_t i = 0; i < counters->counters.size(); ++i){ @@ -1324,6 +1394,60 @@ void WParsedInt::extendedParse(string s, Spell * spell, MTGCardInstance * card) else if (s == "totaldmg") intValue = (card->damageToController + card->damageToCreature + card->damageToOpponent); } + else if (s.find("totalcololorsinplay") != string::npos || s.find("oppototalcololorsinplay") != string::npos) //Return the total amount of colors on controller or opponent battlefield (e.g. Moonveil Regent) + { + intValue = 0; + bool blueFound = false; + bool redFound = false; + bool whiteFound = false; + bool greenFound = false; + bool blackFound = false; + Player* p = card->controller(); + if (s == "oppototalcololorsinplay") + p = card->controller()->opponent(); + for( int j = 0; j < p->inPlay()->nb_cards; j++){ + if(p->inPlay()->cards[j]->hasColor(Constants::MTG_COLOR_RED) && !redFound){ + intValue++; + redFound = true; + } + if(p->inPlay()->cards[j]->hasColor(Constants::MTG_COLOR_BLACK) && !blackFound){ + intValue++; + blackFound = true; + } + if(p->inPlay()->cards[j]->hasColor(Constants::MTG_COLOR_BLUE) && !blueFound){ + intValue++; + blueFound = true; + } + if(p->inPlay()->cards[j]->hasColor(Constants::MTG_COLOR_GREEN) && !greenFound){ + intValue++; + greenFound = true; + } + if(p->inPlay()->cards[j]->hasColor(Constants::MTG_COLOR_WHITE) && !whiteFound){ + intValue++; + whiteFound = true; + } + } + } + else if(s.find("pcoven") != string::npos || s.find("ocoven") != string::npos){ //Player or opponent controls three or more creatures with different powers (e.g. Augur of Autumn) + intValue = 0; + bool opponent = (s.find("ocoven")!=string::npos)?true:false; + Player* p = card->controller(); + if (opponent) + p = card->controller()->opponent(); + for(unsigned int i = 0; i < p->game->inPlay->cards.size() && intValue == 0; i++){ + if(p->game->inPlay->cards[i]->hasType(Subtypes::TYPE_CREATURE)){ + for(unsigned int j = i+1; j < p->game->inPlay->cards.size() && intValue == 0; j++){ + if(p->game->inPlay->cards[j]->hasType(Subtypes::TYPE_CREATURE) && p->game->inPlay->cards[j]->power != p->game->inPlay->cards[i]->power){ + for(unsigned int k = j+1; k < p->game->inPlay->cards.size() && intValue == 0; k++){ + if(p->game->inPlay->cards[k]->hasType(Subtypes::TYPE_CREATURE) && (p->game->inPlay->cards[k]->power != p->game->inPlay->cards[i]->power && p->game->inPlay->cards[k]->power != p->game->inPlay->cards[j]->power)){ + intValue = 1; + } + } + } + } + } + } + } else if(!intValue)//found nothing, try parsing a atoi { intValue = atoi(s.c_str());