Class DamageCalculator

java.lang.Object
studio.magemonkey.divinity.manager.damage.DamageCalculator

public final class DamageCalculator extends Object
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.

  • Constructor Details

  • 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 modifier
      entityTypeModifier - 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 applies
      protectionFactor - the attached defense's protection factor (ignored when defense is null)