From bbabf814e114f1723a4567dd96130fbfd6a9ef85 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Mon, 20 Jan 2025 13:44:32 -0600 Subject: [PATCH] attack speed calculations --- src/engine/objects/PlayerCharacter.java | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 5e2cb593..4b34c256 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -36,6 +36,7 @@ import engine.net.client.ClientConnection; import engine.net.client.msg.*; import engine.net.client.msg.login.CommitNewCharacterMsg; import engine.powers.EffectsBase; +import engine.powers.effectmodifiers.AbstractEffectModifier; import engine.server.MBServerStatics; import engine.server.login.LoginServer; import engine.server.login.LoginServerMsgHandler; @@ -3968,9 +3969,26 @@ public class PlayerCharacter extends AbstractCharacter { speed = weaponBase.getSpeed(); else speed = 20f; //unarmed attack speed - if (weapon != null) - speed *= (1 + this.bonuses.getFloatPercentAll(ModType.WeaponSpeed, SourceType.None)); - speed *= (1 + this.bonuses.getFloatPercentAll(ModType.AttackDelay, SourceType.None)); + if (weapon != null) { + //speed *= (1 + this.bonuses.getFloatPercentAll(ModType.WeaponSpeed, SourceType.None)); + for(Effect eff : this.effects.values()){ + for(AbstractEffectModifier mod : eff.getEffectModifiers()){ + if(mod.modType.equals(ModType.WeaponSpeed)){ + speed *= 1 + mod.getPercentMod(); + } + } + } + } + //speed *= (1 + this.bonuses.getFloatPercentAll(ModType.AttackDelay, SourceType.None)); + + for(Effect eff : this.effects.values()){ + for(AbstractEffectModifier mod : eff.getEffectModifiers()){ + if(mod.modType.equals(ModType.AttackDelay)){ + speed *= 1 + mod.getPercentMod(); + } + } + } + if (speed < 10) speed = 10;