TheWinABagel / ZenithAttributes

A port of Apotheosis attributes to fabric
MIT License
2 stars 5 forks source link

Armor reduction calculations produce unexpected results #25

Open Partonetrain opened 3 months ago

Partonetrain commented 3 months ago

Hitting a skeleton wearing full iron armor while having 15 armor pierce should result in the armor totally being negated, right? Well, I tried it with with a netherite sword, and the skeleton had 16.8 health, meaning the hit had dealt only 3.2 damage. 3.2 is the amount of damage a netherite sword should be dealing to full iron without any piercing or shreddding, but with Zenith it does 1.28.

image image

Something's clearly up. I tested a debug stick with +100 armor shred too (even though this attribute is maxed to 2), and the result was also 3.2 damage. image image

While tracing the issue, I noticed that ALCombatRules#getDamageAfterArmor was getting passed a different value then what zenith_attributes$getDamageAfterAbsorb is passed. The ratio between what is passed to getDamageAfterAbsorb and getDamageAfterArmor is always 2.5:1. My "not really fixing the problem" solution is to multiply the amount passed to to getDamageAfterArmor by 2.5 if the armor is greater than 0, but that's not a good solution lol

This is not the case in AttributesLib: image

I made a calculator to aid with debugging here: https://partonetrain.info/tools/ModdedDamageCalculator.html It's not the prettiest, but it works (and outputs the expected values).