diff --git a/src/engine/objects/PlayerBonuses.java b/src/engine/objects/PlayerBonuses.java index 5a8ad2ed..509aba29 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<>(); diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index f6bbb6fa..48bd97b3 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -3970,28 +3970,35 @@ public class PlayerCharacter extends AbstractCharacter { else speed = 20f; //unarmed attack speed - //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)){ - float modValue = 1 + mod.getPercentMod() * 0.01f; + if(this.effects != null) { + 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; } } } - //} - //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)){ - float modValue = 1 + mod.getPercentMod() * 0.01f; + for (Effect eff : this.effects.values()) { + for (AbstractEffectModifier mod : eff.getEffectModifiers()) { + if (mod.modType.equals(ModType.AttackDelay)) { + float modValue = 1 + mod.getPercentMod() * 0.01f; + speed *= modValue; + } + } + } + } + if(this.bonuses!= null){ + for (AbstractEffectModifier mod : this.bonuses.bonusFloats.keySet()) { + if (mod.modType.equals(ModType.AttackDelay) || mod.modType.equals(ModType.WeaponSpeed)) { + float modValue = 1 + mod.getPercentMod() * 0.01f; speed *= modValue; } } } + if (speed < 10) speed = 10;