Added a new keyword "excessdamage" to retrieve theamount of exceeded damage to creature or planeswalker, fixed an issue on planeswalker damage count, added a new keyword "genrand" to generate a random number between 0 and a specific number (e.g. "genrand3"), improved Flip ability in order to allow the flip back from copy for a generic card name (e.g. "flip(myorigname) undocpy)"
This commit is contained in:
@@ -531,6 +531,24 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
|
||||
if(card && card->thatmuch > intValue)
|
||||
intValue = card->thatmuch;
|
||||
}
|
||||
else if (s == "excessdamage") // Return the amount of exceeded damage of a target
|
||||
{
|
||||
if(target->exceededDamage < 0)
|
||||
intValue = target->exceededDamage;
|
||||
int checkagain = 0;
|
||||
if(target->hasSubtype(Subtypes::TYPE_AURA) || target->hasSubtype(Subtypes::TYPE_EQUIPMENT)){
|
||||
if(target->target){
|
||||
if(target->target->exceededDamage < 0)
|
||||
checkagain = target->target->exceededDamage;
|
||||
}
|
||||
}
|
||||
if(checkagain < intValue)
|
||||
intValue = checkagain;
|
||||
if(card && card->exceededDamage < intValue)
|
||||
intValue = card->exceededDamage;
|
||||
if(intValue < 0)
|
||||
intValue = abs(intValue);
|
||||
}
|
||||
else if (s == "lifelost" || s == "oplifelost")
|
||||
{
|
||||
intValue = (s == "lifelost")?target->controller()->lifeLostThisTurn:target->controller()->opponent()->lifeLostThisTurn;
|
||||
@@ -592,6 +610,10 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s.find("genrand") != string::npos) //Return a random value between 0 and a specific number (minus 1);
|
||||
{
|
||||
intValue = std::rand() % atoi(s.substr(7).c_str());
|
||||
}
|
||||
else if (s == "manacost") //Return the converted manacost
|
||||
{
|
||||
intValue = (target->currentZone == target->controller()->game->stack)?(target->myconvertedcost + target->castX):target->myconvertedcost;//X is 0 except if it's on the stack
|
||||
|
||||
Reference in New Issue
Block a user