Last active
July 22, 2023 23:55
-
-
Save apacheli/806506dbbc066b5fac5c0d5c0819ff8d to your computer and use it in GitHub Desktop.
DMG (damage) reduction refers to the amount of DMG that can be reduced relative to the target's max HP. Here in this example, the targeting is receiving 100 DMG. The target can reduce 25% of that damage. However, if that 25% of DMG is higher than 30% of the target's max HP (as indicated by damage_reduction_limit), it will max at that amount. The…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const damage = 100; | |
const hp = 15_000; | |
const damage_reduction = .25; | |
const damage_reduction_limit = hp * .3; | |
const damage_reduced = Math.min(damage * damage_reduction, damage_reduction_limit); | |
const incoming_damage = Math.max(1, damage - damage_reduced); | |
console.log(incoming_damage); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment