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:
Vittorio Alfieri
2021-01-25 17:24:15 +01:00
parent 4bdc1fdfe1
commit c60f8787d1
7 changed files with 47 additions and 2 deletions
+12
View File
@@ -278,6 +278,18 @@ int Damage::resolve()
}
}
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE && ((MTGCardInstance*)target)->hasType(Subtypes::TYPE_PLANESWALKER)){ // Fix life calculation for planeswalker damage.
if (((MTGCardInstance*)target)->counters){
Counters * counters = ((MTGCardInstance*)target)->counters;
for(size_t i = 0; i < counters->counters.size(); ++i){
Counter * counter = counters->counters[i];
if(counter->name == "loyalty"){
target->life = counter->nb - target->damageCount;
break;
}
}
}
}
//Send (Damage/Replaced effect) event to listeners
observer->receiveEvent(e);
return a;