Class DamageCalculator
java.lang.Object
studio.magemonkey.divinity.manager.damage.DamageCalculator
The damage formula, on plain numbers. It needs no Bukkit and no plugin instance.
DamageManager does the lookups (stats, attributes, hooks, enchantments) and passes the results in.
The order of the floating-point operations is deliberately the same as it was when the formula lived in
DamageManager#onDamageRPGStart; do not reorder them.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe modifiers that are the same for every damage type of one hit.static classThe result for one damage type. -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
DamageCalculator
-
-
Method Details
-
calculate
public DamageCalculator.Result calculate(double damage, double entityTypeModifier, double factionModifier, @Nullable Double defense, double protectionFactor) Calculates one damage type of the hit.- Parameters:
damage- the damage of this type before any modifierentityTypeModifier- the damage attribute's modifier for the victim's entity type (1 if none)factionModifier- the damage attribute's modifier for the victim's MythicMobs faction (1 if none)defense- the victim's value of the attached defense, or null if no defense appliesprotectionFactor- the attached defense's protection factor (ignored whendefenseis null)
-