Fixed Treasure token, added boast trigger event, added new keyword "hascnt" to retrieve the amount of specific counter type on a card (e.g. hascntloyalty).

This commit is contained in:
Vittorio Alfieri
2021-01-24 20:37:14 +01:00
parent f6199719fd
commit 4bdc1fdfe1
7 changed files with 127 additions and 6 deletions

View File

@@ -578,6 +578,20 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
if(Constants::MTGBasicAbilities[i] == s.substr(10))
intValue = card->basicAbilities[i];
}
else if (s.find("hascnt") != string::npos) //Return the amount of specific counters on card
{
intValue = 0;
if (card->counters){
Counters * counters = card->counters;
for(size_t i = 0; i < counters->counters.size(); ++i){
Counter * counter = counters->counters[i];
if(counter->name == s.substr(6)){
intValue = counter->nb;
break;
}
}
}
}
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