Added support for standard DamageFactor property on Armor, PowerProtection and PowerDamage items.

This commit is contained in:
Major Cooke 2020-02-06 13:28:51 -06:00 committed by Christoph Oelckers
parent 39a9a48ad6
commit e781cb4043
2 changed files with 6 additions and 3 deletions

View file

@ -201,7 +201,8 @@ class BasicArmor : Armor
// Once the armor has absorbed its part of the damage, then apply its damage factor, if any, to the player // Once the armor has absorbed its part of the damage, then apply its damage factor, if any, to the player
if ((damage > 0) && (ArmorType != 'None')) // BasicArmor is not going to have any damage factor, so skip it. if ((damage > 0) && (ArmorType != 'None')) // BasicArmor is not going to have any damage factor, so skip it.
{ {
newdamage = ApplyDamageFactors(ArmorType, damageType, damage, damage); damage = int(damage * DamageFactor);
newdamage = (damage < 1) ? 0 : ApplyDamageFactors(ArmorType, damageType, damage, damage);
} }
} }
} }

View file

@ -1659,7 +1659,8 @@ class PowerDamage : Powerup
{ {
if (!passive && damage > 0) if (!passive && damage > 0)
{ {
newdamage = max(1, ApplyDamageFactors(GetClass(), damageType, damage, damage * 4)); damage = int(damage * DamageFactor);
newdamage = (damage < 1) ? 0 : max(1, ApplyDamageFactors(GetClass(), damageType, damage, damage * 4));
if (Owner != null && newdamage > damage) Owner.A_StartSound(ActiveSound, CHAN_AUTO, CHANF_DEFAULT, 1.0, ATTN_NONE); if (Owner != null && newdamage > damage) Owner.A_StartSound(ActiveSound, CHAN_AUTO, CHANF_DEFAULT, 1.0, ATTN_NONE);
} }
} }
@ -1753,7 +1754,8 @@ class PowerProtection : Powerup
{ {
if (passive && damage > 0) if (passive && damage > 0)
{ {
newdamage = max(0, ApplyDamageFactors(GetClass(), damageType, damage, damage / 4)); damage = int(damage * DamageFactor);
newdamage = (damage < 1) ? 0 : max(0, ApplyDamageFactors(GetClass(), damageType, damage, damage / 4));
if (Owner != null && newdamage < damage) Owner.A_StartSound(ActiveSound, CHAN_AUTO, CHANF_DEFAULT, 1.0, ATTN_NONE); if (Owner != null && newdamage < damage) Owner.A_StartSound(ActiveSound, CHAN_AUTO, CHANF_DEFAULT, 1.0, ATTN_NONE);
} }
} }