From d18232df1043f2c01d86dfe4564246c3ff5bd36f Mon Sep 17 00:00:00 2001 From: valfieri Date: Tue, 8 Dec 2020 00:32:33 +0100 Subject: [PATCH] Fixed Commander Format selection of identity color, added/fixed primitives related to commanders abilities. --- .../bin/Res/sets/primitives/borderline.txt | 49 +++++++++++++++++-- .../bin/Res/sets/primitives/unsupported.txt | 31 ------------ projects/mtg/src/MTGGameZones.cpp | 33 +++++++++---- 3 files changed, 69 insertions(+), 44 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/borderline.txt b/projects/mtg/bin/Res/sets/primitives/borderline.txt index fb8a56c79..05244c940 100644 --- a/projects/mtg/bin/Res/sets/primitives/borderline.txt +++ b/projects/mtg/bin/Res/sets/primitives/borderline.txt @@ -1783,7 +1783,7 @@ auto=if type(*[white]|myzones)~morethan~0 then transforms((,newability[{T}:add{W 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(artifact|myzones)~morethan~0 then transforms((,newability[{T}:add{C}])) forever +auto=if type(*[-black;-red;-white;-blue;-green]|myzones)~morethan~0 then transforms((,newability[{T}:add{C}])) forever text={T}: Add one mana of any color in your commander's color identity. mana={2} type=Artifact @@ -8235,7 +8235,7 @@ auto=if type(*[white]|myzones)~morethan~0 then transforms((,newability[{T}:add{W 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(artifact|myzones)~morethan~0 then transforms((,newability[{T}:add{C}])) forever +auto=if type(*[-black;-red;-white;-blue;-green]|myzones)~morethan~0 then transforms((,newability[{T}:add{C}])) forever text={T}: Add to your mana pool one mana of any color in your commander's color identity. type=Land [/card] @@ -8273,7 +8273,7 @@ auto=if type(*[white]|myzones)~lessthan~1 then teach(creature) protection from w auto=if type(*[green]|myzones)~lessthan~1 then teach(creature) protection from green auto=if type(*[blue]|myzones)~lessthan~1 then teach(creature) protection from blue auto=if type(*[black]|myzones)~lessthan~1 then teach(creature) protection from black -auto=if type(artifact|myzones)~lessthan~1 then teach(creature) protection from(artifact) +auto=if type(*[-black;-red;-white;-blue;-green]|myzones)~lessthan~1 then teach(creature) protection from(artifact) 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 @@ -8286,7 +8286,7 @@ auto=if type(*[white]|myzones)~morethan~0 then transforms((,newability[{T}:add{W 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(artifact|myzones)~morethan~0 then transforms((,newability[{T}:add{C}])) forever +auto=if type(*[-black;-red;-white;-blue;-green]|myzones)~morethan~0 then transforms((,newability[{T}:add{C}])) forever auto={S}:draw:1 controller 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} @@ -29242,6 +29242,14 @@ mana={2}{U} type=Instant [/card] [card] +name=Myth Unbound +auto=thisforeach(variable{pnumofcommandcast}) lord(*[iscommander]|mycastingzone) altercost(colorless, -1) +auto=@movedto(*[iscommander]|mycommandzone):draw:1 controller +text=Your commander costs {1} less to cast for each time it's been cast from the command zone this game. -- Whenever your commander is put into the command zone from anywhere, draw a card. +mana={2}{G} +type=Enchantment +[/card] +[card] name=Mythos of Brokkos abilities=hiddenface aicode=activate moveto(myGraveyard) target(*|mylibrary) @@ -31416,6 +31424,19 @@ mana={2}{W} type=Enchantment [/card] [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=if type(*[-black;-red;-white;-blue;-green]|myzones)~morethan~0 then transforms((,newability[{T}:add{C}])) forever +auto=@movedto(*[iscommander]|mybattlefield) from(mycommandzone):all(trigger[to]) counter(1/1,pnumofcommandcast) limit:1 +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 @@ -41044,6 +41065,14 @@ power=3 toughness=1 [/card] [card] +name=Skull Storm +auto=if type(creature|opponentbattlefield)~lessthan~compare(pnumofcommandcastplus1plusend) then life:-halfupopponentlifetotal opponent +auto=thisforeach(variable{pnumofcommandcastplus1plusend}) ability$!name(sacrifice creature) notatarget(creature|mybattlefield) sacrifice!$ opponent +text=When you cast this spell, copy it for each time you've cast your commander from the command zone this game. -- Each opponent sacrifices a creature. Each opponent who can't loses half their life, rounded up. +mana={7}{B}{B} +type=Sorcery +[/card] +[card] name=Skullcrack #MISSING:Damage can't be prevented auto=transforms((,newability[nolifegain],newability[nolifegainopponent])) ueot @@ -52596,6 +52625,18 @@ power=0 toughness=0 [/card] [card] +name=Yuriko, the Tiger's Shadow +autohand={U}{B}{N}:ninjutsu +auto=@combatdamagefoeof(player) from(ninja|myBattlefield):moveto(myhand) and!( transforms((,newability[damage:manacost opponent])) ueot )! all(*[zpos=1]|mylibrary) +auto=@combatdamageof(player) from(ninja|myBattlefield):moveto(myhand) and!( transforms((,newability[damage:manacost controller])) ueot )! all(*[zpos=1]|mylibrary) +text=Commander ninjutsu {U}{B} ({U}{B}, Return an unblocked attacker you control to hand: Put this card onto the battlefield from your hand or the command zone tapped and attacking.) -- Whenever a Ninja you control deals combat damage to a player, reveal the top card of your library and put that card into your hand. Each opponent loses life equal to that card's converted mana cost. +mana={1}{U}{B} +type=Legendary Creature +subtype=Human Ninja +power=1 +toughness=3 +[/card] +[card] name=Yurlok of Scorch Thrash abilities=vigilance auto={1}{T}:add{B}{R}{G} && add{B}{R}{G} opponent diff --git a/projects/mtg/bin/Res/sets/primitives/unsupported.txt b/projects/mtg/bin/Res/sets/primitives/unsupported.txt index ee03254cf..7afdd8fbc 100644 --- a/projects/mtg/bin/Res/sets/primitives/unsupported.txt +++ b/projects/mtg/bin/Res/sets/primitives/unsupported.txt @@ -9086,12 +9086,6 @@ type=Enchantment subtype=Aura [/card] [card] -name=Myth Unbound -text=Your commander costs {1} less to cast for each time it's been cast from the command zone this game. -- Whenever your commander is put into the command zone from anywhere, draw a card. -mana={2}{G} -type=Enchantment -[/card] -[card] name=Mythos of Snapdax text=Each player chooses an artifact, a creature, an enchantment, and a planeswalker from among the nonland permanents they control, then sacrifices the rest. If {B}{R} was spent to cast this spell, you choose the permanents for each player instead. mana={2}{W}{W} @@ -9649,11 +9643,6 @@ power=3 toughness=1 [/card] [card] -name=Opal Palace -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-Eye, Konda's Yojimbo abilities=defender text=Defender (This creature can't attack.) -- Bushido 1 (When this blocks or becomes blocked, it gets +1/+1 until end of turn.) -- {T}: The next time a source of your choice would deal damage this turn, that damage is dealt to Opal-Eye, Konda's Yojimbo instead. -- {1}{W}: Prevent the next 1 damage that would be dealt to Opal-Eye this turn. @@ -9963,11 +9952,6 @@ power=3 toughness=3 [/card] [card] -name=Path of Ancestry -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] -[card] name=Patriarch's Bidding text=Each player chooses a creature type. Each player returns all creature cards of a type chosen this way from his or her graveyard to the battlefield. mana={3}{B}{B} @@ -12272,12 +12256,6 @@ power=4 toughness=1 [/card] [card] -name=Skull Storm -text=When you cast this spell, copy it for each time you've cast your commander from the command zone this game. -- Each opponent sacrifices a creature. Each opponent who can't loses half their life, rounded up. -mana={7}{B}{B} -type=Sorcery -[/card] -[card] name=Skullbriar, the Walking Grave text=Haste -- Whenever Skullbriar, the Walking Grave deals combat damage to a player, put a +1/+1 counter on it. -- Counters remain on Skullbriar as it moves to any zone other than a player's hand or library. mana={B}{G} @@ -15487,15 +15465,6 @@ power=1 toughness=1 [/card] [card] -name=Yuriko, the Tiger's Shadow -text=Commander ninjutsu {U}{B} ({U}{B}, Return an unblocked attacker you control to hand: Put this card onto the battlefield from your hand or the command zone tapped and attacking.) -- Whenever a Ninja you control deals combat damage to a player, reveal the top card of your library and put that card into your hand. Each opponent loses life equal to that card's converted mana cost. -mana={1}{U}{B} -type=Legendary Creature -subtype=Human Ninja -power=1 -toughness=3 -[/card] -[card] name=Zada, Hedron Grinder text=Whenever you cast an instant or sorcery spell that targets only Zada, Hedron Grinder, copy that spell for each other creature you control that the spell could target. Each copy targets a different one of those creatures. mana={3}{R} diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index dd4df028b..f181005a6 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -81,23 +81,38 @@ void MTGPlayerCards::initDeck(MTGDeck * deck) if(newCard->hasType("Land") && newCard->hasType("Basic")){ //There are no limitations for basic lands cards. library->addCard(newCard); } else{ - bool colorFound = false; // All the cards have to share at least one color with commander identity color. + bool colorFound = false; // All the cards have to share at least one color with commander identity color (any symbol in manacost or magic text). + bool colorless = false; // Colorless card can be always added to deck. for(unsigned int i = 0; i < commandzone->cards.size() && !colorFound; i++){ if((newCard->hasColor(Constants::MTG_COLOR_WHITE) && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_WHITE)) || (newCard->hasColor(Constants::MTG_COLOR_BLACK) && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_BLACK)) || (newCard->hasColor(Constants::MTG_COLOR_RED) && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_RED)) || (newCard->hasColor(Constants::MTG_COLOR_BLUE) && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_BLUE)) || - (newCard->hasColor(Constants::MTG_COLOR_GREEN) && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_GREEN))){ - colorFound = true; - } else if((newCard->hasColor(Constants::MTG_COLOR_WHITE) && commandzone->cards[i]->magicText.find("{W}") != std::string::npos) || - (newCard->hasColor(Constants::MTG_COLOR_BLACK) && commandzone->cards[i]->magicText.find("{B}") != std::string::npos)|| - (newCard->hasColor(Constants::MTG_COLOR_RED) && commandzone->cards[i]->magicText.find("{R}") != std::string::npos) || - (newCard->hasColor(Constants::MTG_COLOR_BLUE) && commandzone->cards[i]->magicText.find("{U}") != std::string::npos) || - (newCard->hasColor(Constants::MTG_COLOR_GREEN) && commandzone->cards[i]->magicText.find("{G}") != std::string::npos)){ + (newCard->hasColor(Constants::MTG_COLOR_GREEN) && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_GREEN)) || + (newCard->hasColor(Constants::MTG_COLOR_WHITE) && commandzone->cards[i]->magicText.find("{w}") != std::string::npos) || + (newCard->hasColor(Constants::MTG_COLOR_BLACK) && commandzone->cards[i]->magicText.find("{b}") != std::string::npos)|| + (newCard->hasColor(Constants::MTG_COLOR_RED) && commandzone->cards[i]->magicText.find("{r}") != std::string::npos) || + (newCard->hasColor(Constants::MTG_COLOR_BLUE) && commandzone->cards[i]->magicText.find("{u}") != std::string::npos) || + (newCard->hasColor(Constants::MTG_COLOR_GREEN) && commandzone->cards[i]->magicText.find("{g}") != std::string::npos) || + (newCard->magicText.find("{w}") != std::string::npos && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_WHITE)) || + (newCard->magicText.find("{b}") != std::string::npos && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_BLACK)) || + (newCard->magicText.find("{r}") != std::string::npos && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_RED)) || + (newCard->magicText.find("{u}") != std::string::npos && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_BLUE)) || + (newCard->magicText.find("{g}") != std::string::npos && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_GREEN)) || + (newCard->magicText.find("{w}") != std::string::npos && commandzone->cards[i]->magicText.find("{w}") != std::string::npos) || + (newCard->magicText.find("{b}") != std::string::npos && commandzone->cards[i]->magicText.find("{b}") != std::string::npos)|| + (newCard->magicText.find("{r}") != std::string::npos && commandzone->cards[i]->magicText.find("{r}") != std::string::npos) || + (newCard->magicText.find("{u}") != std::string::npos && commandzone->cards[i]->magicText.find("{u}") != std::string::npos) || + (newCard->magicText.find("{g}") != std::string::npos && commandzone->cards[i]->magicText.find("{g}") != std::string::npos)){ colorFound = true; } } - if(colorFound || newCard->hasColor(Constants::MTG_COLOR_ARTIFACT) || newCard->colors == Constants::MTG_UNCOLORED || newCard->hasColor(Constants::MTG_COLOR_LAND)){ + if(!colorFound) + colorless = (newCard->magicText.find("{g}") == std::string::npos && newCard->magicText.find("{w}") == std::string::npos && newCard->magicText.find("{b}") == std::string::npos && + newCard->magicText.find("{r}") == std::string::npos && newCard->magicText.find("{u}") == std::string::npos && !newCard->hasColor(Constants::MTG_COLOR_BLUE) && + !newCard->hasColor(Constants::MTG_COLOR_RED) && !newCard->hasColor(Constants::MTG_COLOR_WHITE) && !newCard->hasColor(Constants::MTG_COLOR_GREEN) && + !newCard->hasColor(Constants::MTG_COLOR_BLACK)); + if(colorFound || colorless){ bool onlyInstance = true; // In commander format only single cards are allowed if they are not basic lands. for(unsigned int k = 0; k < library->cards.size() && onlyInstance; k++){ if(library->cards[k]->name == newCard->name)