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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user