Added/fixed primitives, added new keywords "fourtimes", "fivetimes", "thirdpaid", fixed Tavis-CI build.

This commit is contained in:
Vittorio Alfieri
2021-04-21 18:27:33 +02:00
parent abe8b580c8
commit 68a64238cb
3 changed files with 490 additions and 25 deletions

View File

@@ -29,6 +29,8 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
bool thirddown = false;
bool twice = false;
bool thrice = false;
bool fourtimes = false;
bool fivetimes = false;
bool other = false;//othertype:[subtype]
if (!target) target = card;
@@ -91,7 +93,18 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
size_t tXXX = s.find("thrice");
s.erase(tXXX,tXXX + 6);
}
if(s.find("fourtimes") != string::npos)
{
fourtimes = true;
size_t tXXX = s.find("fourtimes");
s.erase(tXXX,tXXX + 9);
}
if(s.find("fivetimes") != string::npos)
{
fivetimes = true;
size_t tXXX = s.find("fivetimes");
s.erase(tXXX,tXXX + 9);
}
if(s.find("othertype") != string::npos)
{
other = true;
@@ -179,6 +192,11 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
intValue = computeX(spell, card) / 2;
if(intValue < 0) intValue = 0;
}
else if (s == "xxx" || s == "XXX" || s == "thirdpaid")
{
intValue = computeX(spell, card) / 3;
if(intValue < 0) intValue = 0;
}
else if (s == "castx" || s == "Iroas")//calculate castx - devotion to red white
{
intValue = (s == "castx")?card->castX:countDevotionTo(card, card->controller()->inPlay(), Constants::MTG_COLOR_RED, Constants::MTG_COLOR_WHITE);
@@ -1079,6 +1097,10 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
intValue = intValue * 2;
if (thrice)
intValue = intValue * 3;
if (fourtimes)
intValue = intValue * 4;
if (fivetimes)
intValue = intValue * 5;
if (intValue < 0)
{
//we remove "-" at the start and are parsing for real values.