Fixed primitives, fixed a problem on "flip" ability for some backside cards (e.g. "Edgar Markov's Coffin"), added new keywords "pnumcreswp" and "onumcreswp" to calculate the number of creatures that have toughness greater than their power.

This commit is contained in:
Vittorio Alfieri
2021-11-07 22:13:39 +01:00
parent f371295f24
commit 8012672a70
5 changed files with 26 additions and 13 deletions

View File

@@ -1453,6 +1453,18 @@ void WParsedInt::extendedParse(string s, Spell * spell, MTGCardInstance * card)
}
}
}
else if(s.find("pnumcreswp") != string::npos || s.find("onumcreswp") != string::npos){ //Number of creatures that have toughness greater than their power.
intValue = 0;
bool opponent = (s.find("onumcreswp")!=string::npos)?true:false;
Player* p = card->controller();
if (opponent)
p = card->controller()->opponent();
for(unsigned int i = 0; i < p->game->inPlay->cards.size(); i++){
if(p->game->inPlay->cards[i]->hasType(Subtypes::TYPE_CREATURE) && p->game->inPlay->cards[i]->toughness > p->game->inPlay->cards[i]->power){
intValue++;
}
}
}
else if(!intValue)//found nothing, try parsing a atoi
{
intValue = atoi(s.c_str());