diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 1a3d0d5ce..8b3661598 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -1032,7 +1032,7 @@ type=Enchantment [/card] [card] name=AEther Burst -target=creature|battlefield +target=creature|battlefield auto=moveto(ownerhand) text=Return up to X target creatures to their owners' hands, where X is one plus the number of cards named AEther Burst in all graveyards as you cast AEther Burst. mana={1}{U} @@ -3666,7 +3666,7 @@ toughness=1+* [/card] [card] name=An-Havva Inn -auto=life:plusonetype:creature[green]|battlefield controller +auto=life:type:creature[green]|battlefieldplus1plusend controller text=You gain X plus 1 life, where X is the number of green creatures on the battlefield. mana={1}{G}{G} type=Sorcery @@ -10107,7 +10107,7 @@ type=Sorcery [card] name=Black Vise auto=name(choose opponent) notatarget(opponent) deplete:0 -auto=@each targetedplayer upkeep:damage:morethanfourcards targetedplayer +auto=@each targetedplayer upkeep:damage:type:*:opponenthandminus4minusend targetedplayer text=As Black Vise enters the battlefield, choose an opponent. -- At the beginning of the chosen player's upkeep, Black Vise deals X damage to that player, where X is the number of cards in his or her hand minus 4. mana={1} type=Artifact @@ -54292,7 +54292,7 @@ type=Artifact [/card] [card] name=Iron Maiden -auto=@each opponent upkeep:damage:morethanfourcards opponent +auto=@each opponent upkeep:damage:type:*:opponenthandminus4minusend opponent text=At the beginning of each opponent's upkeep, Iron Maiden deals X damage to that player, where X is the number of cards in his or her hand minus 4. mana={3} type=Artifact @@ -57844,7 +57844,7 @@ type=Instant [card] name=Kindle target=creature,player -auto=damage:plustwotype:kindle:graveyard +auto=damage:type:kindle:graveyardplus2plusend text=Kindle deals X damage to target creature or player, where X is 2 plus the number of cards named Kindle in all graveyards. mana={1}{R} type=Instant @@ -61435,7 +61435,7 @@ toughness=5 [card] name=Lhurgoyf alias=1111 -anyzone=type:creature:graveyard/plusonetype:creature:graveyard cdaactive +anyzone=type:creature:graveyard/type:creature:graveyardplus1plusend cdaactive text=Lhurgoyf's power is equal to the number of creature cards in all graveyards and its toughness is equal to that number plus 1. mana={2}{G}{G} type=Creature @@ -68000,7 +68000,7 @@ type=Legendary Land [card] name=Mind Burst target=player -auto=ability$!name(discard) target(*|myhand) reject!$ targetedplayer +auto=ability$!name(discard) target(*|myhandplus1plusend) reject!$ targetedplayer text=Target player discards X cards, where X is one plus the number of cards named Mind Burst in all graveyards. mana={1}{B} type=Sorcery @@ -109175,7 +109175,7 @@ toughness=7 [/card] [card] name=Tarmogoyf -anyzone=gravecardtypes/plusonegravecardtypes cdaactive +anyzone=gravecardtypes/gravecardtypesplus1plusend cdaactive text=Tarmogoyf's power is equal to the number of card types among cards in all graveyards and its toughness is equal to that number plus 1. (The card types are artifact, creature, enchantment, instant, land, planeswalker, sorcery, and tribal.) mana={1}{G} type=Creature @@ -119960,7 +119960,7 @@ toughness=3 [/card] [card] name=Viseling -auto=@each opponent upkeep:damage:morethanfourcards opponent +auto=@each opponent upkeep:damage:type:*:opponenthandminus4minusend opponent text=At the beginning of each opponent's upkeep, Viseling deals X damage to that player, where X is the number of cards in his or her hand minus 4. mana={4} type=Artifact Creature @@ -120035,7 +120035,7 @@ type=Instant [/card] [card] name=Vitalizing Cascade -auto=life:Xplusthree +auto=life:Xplus3plusend text=You gain X plus 3 life. mana={X}{G}{W} type=Instant @@ -121775,7 +121775,7 @@ toughness=4 [card] name=Wall of Tombstones abilities=defender -auto=@each my upkeep:transforms((,settoughness=plusonetype:creature:mygraveyard)) forever +auto=@each my upkeep:transforms((,settoughness=type:creature:mygraveyardplus1plusend)) forever text=Defender (This creature can't attack.) -- At the beginning of your upkeep, Wall of Tombstones's toughness becomes 1 plus the number of creature cards in your graveyard. (This effect lasts indefinitely.) mana={1}{B} type=Creature @@ -127351,6 +127351,46 @@ subtype=Orc Warrior power=7 toughness=2 [/card] +###### +######unsorted +[card] +name=Dark Suspicions +auto=@each opponent upkeep:life:-mathtype:*:opponenthandminustype:*:myhandminusendmathend opponent +text=At the beginning of each opponent's upkeep, that player loses X life, where X is the number of cards in that player's hand minus the number of cards in your hand. +mana={2}{B}{B} +type=Enchantment +[/card] +[card] +name=Bulwark +auto=@each opponent upkeep:target(opponent) damage:mathtype:*:myhandminustype:*:opponenthandminusendmathend opponent +text=At the beginning of your upkeep, Bulwark deals X damage to target opponent, where X is the number of cards in your hand minus the number of cards in that player's hand. +mana={3}{R}{R} +type=Enchantment +[/card] +[card] +name=Roiling Horror +anyzone=mathlifetotalminusopponentlifetotalminusendmathend/mathlifetotalminusopponentlifetotalminusendmathend cdaactive +autoexile=@counterremoved(0/0,1,Time) from(sourcecard) suspended:ability$!choice life:-1 target(opponent) && life:1 controller!$ controller +text=Roiling Horror's power and toughness are each equal to your life total minus the life total of an opponent with the most life. -- Suspend X—{X}{B}{B}{B}. X can't be 0. (Rather than cast this card from your hand, you may pay {X}{B}{B}{B} and exile it with X time counters on it. At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost. It has haste.) -- Whenever a time counter is removed from Roiling Horror while it's exiled, target player loses 1 life and you gain 1 life. +mana={3}{B}{B} +suspend(0)={X}{b}{b}{b} +type=Creature +subtype=Horror +power=* +toughness=* +[/card] +[card] +name=Dark Deal +auto=count(type:*:myhand) +auto=all(*|myhand) reject +auto=draw:countedamountplus1plusend controller +auto=count(type:*:opponenthand) +auto=all(*|opponenthand) reject +auto=draw:countedamountplus1plusend opponent +text=Each player discards all the cards in his or her hand, then draws that many cards minus one. +mana={2}{B} +type=Sorcery +[/card] ##due to card type association dryad arbor is placed at the end. any other card that associates 2 super types in this manner should also ##be in the end of the primitive to avoid abilities like changling thinking that "forest" is a creature type. [card] diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 5a652b823..a7045d5e9 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -179,10 +179,8 @@ private: bool halfdown = false; bool twice = false; bool thrice = false; - bool plusone = false; - bool plustwo = false; - bool plusthree = false; bool other = false;//othertype:[subtype] + if (!target) target = card; int multiplier = 1; if (s[0] == '-') @@ -231,24 +229,7 @@ private: size_t tXXX = s.find("thrice"); s.erase(tXXX,tXXX + 6); } - if(s.find("plusone") != string::npos) - { - plusone = true; - size_t pOne = s.find("plusone"); - s.erase(pOne,pOne + 7); - } - if(s.find("plustwo") != string::npos) - { - plustwo = true; - size_t pTwo = s.find("plustwo"); - s.erase(pTwo,pTwo + 7); - } - if(s.find("plusthree") != string::npos) - { - plusthree = true; - size_t pThree = s.find("plusthree"); - s.erase(pThree,pThree + 9); - } + if(s.find("othertype") != string::npos) { other = true; @@ -273,7 +254,47 @@ private: size_t otc = s.find("otherconvertedcost"); s.erase(otc,otc + 5); } - if(s == "prex") + + if (s.find("plusend") != string::npos || s.find("minusend") != string::npos || s.find("math") != string::npos) + { + //plus#plusend and minus#minusend splits the first part and second parts and parses the + //ints for each part, then either adds or subtracts those 2 variables as specified. + vectormathFound = parseBetween(s, "math", "mathend", true); + if (mathFound.size())//maths allows us to get the value before applying multipliers + { + WParsedInt numPar(mathFound[1], NULL, card); + intValue = numPar.getValue(); + + } + else + { + vectorplusSplit = parseBetween(s, "", "plus", true); + if (plusSplit.size()) + { + WParsedInt numPar(plusSplit[1], NULL, card); + intValue = numPar.getValue(); + } + vectorplusFound = parseBetween(s, "plus", "plusend", true); + if (plusFound.size()) + { + WParsedInt numPar(plusFound[1], NULL, card); + intValue += numPar.getValue(); + } + vectorminusSplit = parseBetween(s, "", "minus", true); + if (minusSplit.size()) + { + WParsedInt numPar(minusSplit[1], NULL, card); + intValue = numPar.getValue(); + } + vectorminusFound = parseBetween(s, "minus", "minusend", true); + if (minusFound.size()) + { + WParsedInt numPar(minusFound[1], NULL, card); + intValue -= numPar.getValue(); + } + } + } + else if(s == "prex") { if (card->setX > -1) { @@ -806,12 +827,18 @@ private: else if (s == "pbasiclandtypes")//Basic Land types { MTGGameZone * checkZone = card->controller()->inPlay(); - intValue = - cardHasTypeinZone("forest",checkZone) + - cardHasTypeinZone("plains",checkZone) + - cardHasTypeinZone("swamp",checkZone) + - cardHasTypeinZone("island",checkZone) + - cardHasTypeinZone("mountain",checkZone); + intValue = //mtg rules 205.4c + cardHasTypeinZone("waste", checkZone) + + cardHasTypeinZone("forest", checkZone) + + cardHasTypeinZone("plains", checkZone) + + cardHasTypeinZone("swamp", checkZone) + + cardHasTypeinZone("island", checkZone) + + cardHasTypeinZone("mountain", checkZone) + + cardHasTypeinZone("snow-covered forest", checkZone) + + cardHasTypeinZone("snow-covered plains", checkZone) + + cardHasTypeinZone("snow-covered swamp", checkZone) + + cardHasTypeinZone("snow-covered island", checkZone) + + cardHasTypeinZone("snow-covered mountain", checkZone); } else if (s == "myname")//Name of the card you control { @@ -858,13 +885,6 @@ private: cardHasTypeinZone("artifact",checkZone); } } - else if (s == "morethanfourcards") - { - intValue = 0; - int damage = card->playerTarget ? card->playerTarget->game->hand->nb_cards - 4 : card->controller()->opponent()->game->hand->nb_cards - 4; - if ( damage > 0 ) - intValue = damage; - } else if (s == "powertotalinplay")//Count Total Power of Creatures you control... Formidable { intValue = 0; @@ -889,42 +909,34 @@ private: if (card->revealedLast) intValue = card->revealedLast->getManaCost()->getConvertedCost(); } - else + else if(!intValue)//found nothing, try parsing a atoi { intValue = atoi(s.c_str()); - } - if(intValue > 0) - { - if(halfup) - { - if(intValue%2 == 1) - intValue++; - intValue = intValue/2; - } - if(halfdown) - intValue = intValue/2; - if(twice) - intValue = intValue*2; - if(thrice) - intValue = intValue*3; - if(plusone) - intValue = intValue+1; - if(plustwo) - intValue = intValue+2; - if(plusthree) - intValue = intValue+3; - } - else - { - if(plusone) - intValue = intValue+1; - if(plustwo) - intValue = intValue+2; - if(plusthree) - intValue = intValue+3; - } - intValue *= multiplier; - } + } + if (intValue > 0)//dont divide by 0 the rest are valid. + { + if (halfup) + { + if (intValue % 2 == 1) + intValue++; + intValue = intValue / 2; + } + if (halfdown) + intValue = intValue / 2; + } + if (twice) + intValue = intValue * 2; + if (thrice) + intValue = intValue * 3; + if (intValue < 0) + { + //we remove "-" at the start and are parsing for real values. + //if we ended up with a value less than 0, then we return just 0 + intValue = 0; + } + + intValue *= multiplier; + } public: int countDevotionTo(MTGCardInstance * card, MTGGameZone * zone, int color1, int color2)