kernitus / BukkitOldCombatMechanics

Spigot plugin to configure combat mechanics from 1.9 onwards
https://www.spigotmc.org/resources/19510/
Mozilla Public License 2.0
168 stars 71 forks source link

Fix protection enchant for armor #555

Closed XDMAN500 closed 1 year ago

XDMAN500 commented 3 years ago

Current Armor Strength Module heals players who have a high protection enchant on armor (they take negative damage). This happens because the module fails to clear the vanilla damage reduction from the MAGIC modifer before checking if the MAGIC damage reduction for the module should be calculated.

This commit fixes the issue by correctly setting the vanilla MAGIC reduction to zero before the final damage check.

kernitus commented 3 years ago

To be completely fair, there's something very broken about the DamageModifier system. I encountered a similar issue with Resistance effects while I was investigating #499. I wonder if it'd be better to just override the system completely? Would it make a difference to other plugins?

XDMAN500 commented 2 years ago

If you want to avoid using the damage modifier api then this module could calculate the expected damage after determining the the protection from armor points and protection enchantments and skip to adjusting the final damage for the event. This means that the damage value in the BASE damage modifier would not match the damage value in the ATTACK_DAMAGE attribute how ever the final effect should be the same. This change will certainly have some effect other plugins that try to implement their own damage system like MCMMO.

kernitus commented 1 year ago

Fixed in a similar way in the testing branch.