From 74bd7ddb8bc84b42b4ef64edc281d283fa853d3d Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 31 May 2024 19:02:59 -0500 Subject: [PATCH] attack speed calculation handled correctly --- src/engine/objects/AbstractCharacter.java | 21 ++++++++++++++++++++- src/engine/objects/PlayerBonuses.java | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index 4d17992e..7c48a3cd 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -31,6 +31,7 @@ import engine.net.client.msg.ApplyRuneMsg; import engine.net.client.msg.UpdateStateMsg; import engine.powers.EffectsBase; import engine.powers.PowersBase; +import engine.powers.effectmodifiers.AbstractEffectModifier; import engine.server.MBServerStatics; import org.pmw.tinylog.Logger; @@ -804,7 +805,25 @@ public abstract class AbstractCharacter extends AbstractWorldObject { if (weapon != null) speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.WeaponSpeed, SourceType.None)); - speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.AttackDelay, SourceType.None)); + PlayerBonuses bonuses = abstractCharacter.bonuses; + if(bonuses != null){ + ModType modType = ModType.AttackDelay; + for (AbstractEffectModifier mod : bonuses.bonusFloats.keySet()) { + + if (mod.getPercentMod() == 0) + continue; + + + if (!mod.modType.equals(modType)) + continue; + + if (bonuses.bonusFloats.get(mod) == null) + continue; + + speed *= (1 + bonuses.bonusFloats.get(mod)); + } + } + //speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.AttackDelay, SourceType.None)); if (speed < 10) speed = 10; diff --git a/src/engine/objects/PlayerBonuses.java b/src/engine/objects/PlayerBonuses.java index d5532172..46583d18 100644 --- a/src/engine/objects/PlayerBonuses.java +++ b/src/engine/objects/PlayerBonuses.java @@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentHashMap; public class PlayerBonuses { //First bonus set - private ConcurrentHashMap bonusFloats = new ConcurrentHashMap<>(); + ConcurrentHashMap bonusFloats = new ConcurrentHashMap<>(); private ConcurrentHashMap bonusDamageShields = new ConcurrentHashMap<>(); private ConcurrentHashMap bonusStrings = new ConcurrentHashMap<>(); private ConcurrentHashMap> bonusLists = new ConcurrentHashMap<>();