diff --git a/src/engine/objects/Item.java b/src/engine/objects/Item.java index 050beb17..e6038ae8 100644 --- a/src/engine/objects/Item.java +++ b/src/engine/objects/Item.java @@ -1492,4 +1492,21 @@ public class Item extends AbstractWorldObject { return false; return true; } + + public float getModifiedSpeed() { + float speed = this.getItemBase().getSpeed(); + try { + for (Effect eff : this.effects.values()) { + for (AbstractEffectModifier mod : eff.getEffectModifiers()) { + if (mod.modType.equals(ModType.WeaponSpeed)) { + float modValue = 1 + mod.getPercentMod() * 0.01f; + speed *= modValue; + } + } + } + }catch(Exception e){ + + } + return speed; + } } diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index e202b9b3..ce843be2 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4240,8 +4240,8 @@ public class PlayerCharacter extends AbstractCharacter { } //calculate speed - if (weaponBase != null) - speed = weaponBase.getSpeed(); + if (weapon != null) + speed = weapon.getModifiedSpeed(); else speed = 20f; //unarmed attack speed @@ -4265,17 +4265,6 @@ public class PlayerCharacter extends AbstractCharacter { // } //} - - if(weapon != null){ - for(Effect eff : weapon.effects.values()){ - for (AbstractEffectModifier mod : eff.getEffectModifiers()){ - if(mod.modType.equals(ModType.WeaponSpeed)){ - speed *= 1 + (mod.getPercentMod() * 0.01f); - } - } - } - } - if(this.bonuses!= null){ for (AbstractEffectModifier mod : this.bonuses.bonusFloats.keySet()) { if (mod.modType.equals(ModType.AttackDelay)) {