From d695d3db263c0f4b19a0009939802a206bbaa5c0 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 28 May 2023 16:07:18 -0500 Subject: [PATCH] epic mob damage calc fix and epic mob null reference fix --- src/engine/ai/utilities/CombatUtilities.java | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/engine/ai/utilities/CombatUtilities.java b/src/engine/ai/utilities/CombatUtilities.java index 91f2ca32..a5d3bd9e 100644 --- a/src/engine/ai/utilities/CombatUtilities.java +++ b/src/engine/ai/utilities/CombatUtilities.java @@ -403,13 +403,21 @@ public class CombatUtilities { DamageType dt = DamageType.Crush; AbstractWorldObject target = agent.getCombatTarget(); float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None); - if (agent.getEquip().get(1).getItemBase() != null) { - dt = agent.getEquip().get(1).getItemBase().getDamageType(); - } else if (agent.getEquip().get(2).getItemBase() != null && agent.getEquip().get(2).getItemBase().isShield() == false) { - dt = agent.getEquip().get(2).getItemBase().getDamageType(); + double min = agent.getMinDamageHandOne(); + double max = agent.getMaxDamageHandOne(); + if(agent.getEquip().get(1) != null) { + if (agent.getEquip().get(1).getItemBase() != null) { + dt = agent.getEquip().get(1).getItemBase().getDamageType(); + min = agent.getMinDamageHandOne(); + max = agent.getMaxDamageHandOne(); + } else if (agent.getEquip().get(2).getItemBase() != null && agent.getEquip().get(2).getItemBase().isShield() == false) { + dt = agent.getEquip().get(2).getItemBase().getDamageType(); + min = agent.getMinDamageHandTwo(); + max = agent.getMaxDamageHandTwo(); + } } - double min = agent.getMobBase().getMinDmg(); - double max = agent.getMobBase().getMaxDmg(); + + double range = max - min; double damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2; return (int) (((AbstractCharacter) target).getResists().getResistedDamage(agent, (AbstractCharacter) target, dt, (float) damage, 0) * dmgMultiplier);