Added/fixed primitives, added a new ability "undamageable" (e.g. Dralnu, Lich Lord).

This commit is contained in:
Vittorio Alfieri
2021-03-11 16:39:50 +01:00
parent 37ce334688
commit 2234a508c3
5 changed files with 169 additions and 124 deletions
+8 -5
View File
@@ -236,14 +236,17 @@ int Damage::resolve()
{
// "Normal" case,
//return the left over amount after effects have been applied to them.
if (target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER && ((Player *)target)->inPlay()->hasAbility(Constants::CANTCHANGELIFE))
if ((target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER && ((Player *)target)->inPlay()->hasAbility(Constants::CANTCHANGELIFE)) ||
(target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE && (((MTGCardInstance*)target)->basicAbilities[Constants::UNDAMAGEABLE] == 1)))
;//do nothing
else
a = target->dealDamage(damage);
target->damageCount += damage;//the amount must be the actual damage so i changed this from 1 to damage, this fixes pdcount and odcount
if(typeOfDamage == 2)
target->nonCombatDamage += damage;
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE){
if (!(target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE && (((MTGCardInstance*)target)->basicAbilities[Constants::UNDAMAGEABLE] == 1))){
target->damageCount += damage;//the amount must be the actual damage so i changed this from 1 to damage, this fixes pdcount and odcount
if(typeOfDamage == 2)
target->nonCombatDamage += damage;
}
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE && (((MTGCardInstance*)target)->basicAbilities[Constants::UNDAMAGEABLE] == 0)){
((MTGCardInstance*)target)->wasDealtDamage = true;
((MTGCardInstance*)source)->damageToCreature = true;
}
+2 -1
View File
@@ -210,7 +210,8 @@ const char* Constants::MTGBasicAbilities[] = {
"boast", //It has boast ability
"twoboast", //It has boast twice ability (e.g. Birgi, God of Storytelling)
"replacescry", //It has scry replacement ability
"hasnokicker" //Kicker cost is not a real kicker cost (eg. cards with Fuse cost)
"hasnokicker", //Kicker cost is not a real kicker cost (eg. cards with Fuse cost)
"undamageable" //It cannot be damaged by any source
};
map<string,int> Constants::MTGBasicAbilitiesMap;