Skip to content

Commit

Permalink
Added support for standard DamageFactor property on Armor, PowerProte…
Browse files Browse the repository at this point in the history
…ction and PowerDamage items.
  • Loading branch information
MajorCooke authored and coelckers committed Feb 9, 2020
1 parent 39a9a48 commit e781cb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion wadsrc/static/zscript/actors/inventory/armor.zs
Expand Up @@ -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
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);
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions wadsrc/static/zscript/actors/inventory/powerups.zs
Expand Up @@ -1659,7 +1659,8 @@ class PowerDamage : Powerup
{
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);
}
}
Expand Down Expand Up @@ -1753,7 +1754,8 @@ class PowerProtection : Powerup
{
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);
}
}
Expand Down

2 comments on commit e781cb4

@Doom2fan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it was a good idea to merge this commit. There could be mods out there that tried to use DamageFactor without knowing it didn't work, then when it didn't do anything, just applied type-specific factors. This would break those.

@coelckers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to revert it then. I noticed too late that this was mixing two unrelated things into one PR.

Please sign in to comment.