removed WParsedInt "morethanfour", "plusone","plustwo","plusthree"

added 2 things
first plus/plusend, minus/minusend
written many ways damage:type:*:myhandminus2minusend
would deal damage equal to the cards in my hand -2
damage:type:creature:mybattlefieldplustype:creature:opponentbattlefieldplusend
damage equal to the number of creatures in my battlefield plus the number of creatures in opponents battlefield.

now there are special cases where we need to know the value BEFORE applying multipliers. life: is one of them. I added "math/mathend"

auto=@each opponent upkeep:target(opponent) life:-mathtype:*:myhandminustype:*:opponenthandminusendmathend opponent
in the example above, without "math" the "-" would be used for the first section of the minus parsed int, instead of being applied as a multiplier for the total of the number.

this is extremely flexible, and can contain any Wparsed int in both parts, you can add or subtract and use the differences between to values as the value of the parsedInt.
This commit is contained in:
zethfoxster
2016-07-04 10:43:07 -04:00
parent fdddee415f
commit 76f1591b58
2 changed files with 132 additions and 80 deletions
+51 -11
View File
@@ -1032,7 +1032,7 @@ type=Enchantment
[/card] [/card]
[card] [card]
name=AEther Burst name=AEther Burst
target=<plusonetype:AEther Burst:graveyard>creature|battlefield target=<type:AEther Burst:graveyardplus1plusend>creature|battlefield
auto=moveto(ownerhand) 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. 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} mana={1}{U}
@@ -3666,7 +3666,7 @@ toughness=1+*
[/card] [/card]
[card] [card]
name=An-Havva Inn 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. text=You gain X plus 1 life, where X is the number of green creatures on the battlefield.
mana={1}{G}{G} mana={1}{G}{G}
type=Sorcery type=Sorcery
@@ -10107,7 +10107,7 @@ type=Sorcery
[card] [card]
name=Black Vise name=Black Vise
auto=name(choose opponent) notatarget(opponent) deplete:0 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. 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} mana={1}
type=Artifact type=Artifact
@@ -54292,7 +54292,7 @@ type=Artifact
[/card] [/card]
[card] [card]
name=Iron Maiden 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. 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} mana={3}
type=Artifact type=Artifact
@@ -57844,7 +57844,7 @@ type=Instant
[card] [card]
name=Kindle name=Kindle
target=creature,player 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. 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} mana={1}{R}
type=Instant type=Instant
@@ -61435,7 +61435,7 @@ toughness=5
[card] [card]
name=Lhurgoyf name=Lhurgoyf
alias=1111 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. 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} mana={2}{G}{G}
type=Creature type=Creature
@@ -68000,7 +68000,7 @@ type=Legendary Land
[card] [card]
name=Mind Burst name=Mind Burst
target=player target=player
auto=ability$!name(discard) target(<plusonetype:mind burst:graveyard>*|myhand) reject!$ targetedplayer auto=ability$!name(discard) target(<type:mind burst:graveyard>*|myhandplus1plusend) reject!$ targetedplayer
text=Target player discards X cards, where X is one plus the number of cards named Mind Burst in all graveyards. text=Target player discards X cards, where X is one plus the number of cards named Mind Burst in all graveyards.
mana={1}{B} mana={1}{B}
type=Sorcery type=Sorcery
@@ -109175,7 +109175,7 @@ toughness=7
[/card] [/card]
[card] [card]
name=Tarmogoyf 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.) 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} mana={1}{G}
type=Creature type=Creature
@@ -119960,7 +119960,7 @@ toughness=3
[/card] [/card]
[card] [card]
name=Viseling 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. 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} mana={4}
type=Artifact Creature type=Artifact Creature
@@ -120035,7 +120035,7 @@ type=Instant
[/card] [/card]
[card] [card]
name=Vitalizing Cascade name=Vitalizing Cascade
auto=life:Xplusthree auto=life:Xplus3plusend
text=You gain X plus 3 life. text=You gain X plus 3 life.
mana={X}{G}{W} mana={X}{G}{W}
type=Instant type=Instant
@@ -121775,7 +121775,7 @@ toughness=4
[card] [card]
name=Wall of Tombstones name=Wall of Tombstones
abilities=defender 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.) 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} mana={1}{B}
type=Creature type=Creature
@@ -127351,6 +127351,46 @@ subtype=Orc Warrior
power=7 power=7
toughness=2 toughness=2
[/card] [/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 ##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. ##be in the end of the primitive to avoid abilities like changling thinking that "forest" is a creature type.
[card] [card]
+71 -59
View File
@@ -179,10 +179,8 @@ private:
bool halfdown = false; bool halfdown = false;
bool twice = false; bool twice = false;
bool thrice = false; bool thrice = false;
bool plusone = false;
bool plustwo = false;
bool plusthree = false;
bool other = false;//othertype:[subtype] bool other = false;//othertype:[subtype]
if (!target) target = card; if (!target) target = card;
int multiplier = 1; int multiplier = 1;
if (s[0] == '-') if (s[0] == '-')
@@ -231,24 +229,7 @@ private:
size_t tXXX = s.find("thrice"); size_t tXXX = s.find("thrice");
s.erase(tXXX,tXXX + 6); 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) if(s.find("othertype") != string::npos)
{ {
other = true; other = true;
@@ -273,7 +254,47 @@ private:
size_t otc = s.find("otherconvertedcost"); size_t otc = s.find("otherconvertedcost");
s.erase(otc,otc + 5); 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.
vector<string>mathFound = 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
{
vector<string>plusSplit = parseBetween(s, "", "plus", true);
if (plusSplit.size())
{
WParsedInt numPar(plusSplit[1], NULL, card);
intValue = numPar.getValue();
}
vector<string>plusFound = parseBetween(s, "plus", "plusend", true);
if (plusFound.size())
{
WParsedInt numPar(plusFound[1], NULL, card);
intValue += numPar.getValue();
}
vector<string>minusSplit = parseBetween(s, "", "minus", true);
if (minusSplit.size())
{
WParsedInt numPar(minusSplit[1], NULL, card);
intValue = numPar.getValue();
}
vector<string>minusFound = 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) if (card->setX > -1)
{ {
@@ -806,12 +827,18 @@ private:
else if (s == "pbasiclandtypes")//Basic Land types else if (s == "pbasiclandtypes")//Basic Land types
{ {
MTGGameZone * checkZone = card->controller()->inPlay(); MTGGameZone * checkZone = card->controller()->inPlay();
intValue = intValue = //mtg rules 205.4c
cardHasTypeinZone("forest",checkZone) + cardHasTypeinZone("waste", checkZone) +
cardHasTypeinZone("plains",checkZone) + cardHasTypeinZone("forest", checkZone) +
cardHasTypeinZone("swamp",checkZone) + cardHasTypeinZone("plains", checkZone) +
cardHasTypeinZone("island",checkZone) + cardHasTypeinZone("swamp", checkZone) +
cardHasTypeinZone("mountain",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 else if (s == "myname")//Name of the card you control
{ {
@@ -858,13 +885,6 @@ private:
cardHasTypeinZone("artifact",checkZone); 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 else if (s == "powertotalinplay")//Count Total Power of Creatures you control... Formidable
{ {
intValue = 0; intValue = 0;
@@ -889,40 +909,32 @@ private:
if (card->revealedLast) if (card->revealedLast)
intValue = card->revealedLast->getManaCost()->getConvertedCost(); intValue = card->revealedLast->getManaCost()->getConvertedCost();
} }
else else if(!intValue)//found nothing, try parsing a atoi
{ {
intValue = atoi(s.c_str()); intValue = atoi(s.c_str());
} }
if(intValue > 0) if (intValue > 0)//dont divide by 0 the rest are valid.
{ {
if(halfup) if (halfup)
{ {
if(intValue%2 == 1) if (intValue % 2 == 1)
intValue++; intValue++;
intValue = intValue/2; intValue = intValue / 2;
} }
if(halfdown) if (halfdown)
intValue = intValue/2; 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 (twice)
intValue = intValue * 2;
if (thrice)
intValue = intValue * 3;
if (intValue < 0)
{ {
if(plusone) //we remove "-" at the start and are parsing for real values.
intValue = intValue+1; //if we ended up with a value less than 0, then we return just 0
if(plustwo) intValue = 0;
intValue = intValue+2;
if(plusthree)
intValue = intValue+3;
} }
intValue *= multiplier; intValue *= multiplier;
} }
public: public: