Added/fixed primitives, Added keywords "showopponenthand" and "showcontrollerhand" to allow controller and opponent to play with their hand revealed, added "mytarg" prefix to check values for a card target as like we do for "storedcard" prefix (e.g. "Redirect"), fixed "undocpy" keyoword for all cards (e.g. "Renegade Doppelganger") that have to be back from a previous copy.

This commit is contained in:
Vittorio Alfieri
2021-08-27 00:29:47 +02:00
parent bbc25e2727
commit 1ce0facf21
11 changed files with 305 additions and 216 deletions

View File

@@ -16,7 +16,7 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
return;
if (!card)
{
intValue = atoi(s.c_str());//if there is no card, try parsing a number.
intValue = atoi(s.c_str()); //if there is no card, try parsing a number.
return;
}
MTGCardInstance * target = card->target;
@@ -45,6 +45,12 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
altered.append(s.substr(+6));
return init(altered,spell,card->storedCard);
}
if(s.find("mytarg") != string::npos)
{
string altered ="-";
altered.append(s.substr(+6));
return init(altered,spell,card->target); //we refer the target (e.g. Redirect)
}
}
if(s[0] == '+')
{
@@ -55,6 +61,10 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
{
return init(s.substr(+6),spell,card->storedCard);
}
if(s.find("mytarg") != string::npos)
{
return init(s.substr(+6),spell,card->target); //we refer the target (e.g. Redirect)
}
//rounding values, the words can be written anywhere in the line,
//they are erased after parsing.
if(s.find("halfup") != string::npos)
@@ -742,7 +752,7 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
}
else if (s == "kicked" || s == "handsize")
{
intValue = (s == "kicked")?target->kicked:target->controller()->handsize;
intValue = (s == "kicked")?card->kicked:target->controller()->handsize;
}
else if (s == "olandg" || s == "olandu")
{