Browse Source

weapon speed

lakebane-dex-penalty
FatBoy-DOTC 1 week ago
parent
commit
8f402c8c03
  1. 17
      src/engine/objects/Item.java
  2. 15
      src/engine/objects/PlayerCharacter.java

17
src/engine/objects/Item.java

@ -1492,4 +1492,21 @@ public class Item extends AbstractWorldObject {
return false; return false;
return true; 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;
}
} }

15
src/engine/objects/PlayerCharacter.java

@ -4240,8 +4240,8 @@ public class PlayerCharacter extends AbstractCharacter {
} }
//calculate speed //calculate speed
if (weaponBase != null) if (weapon != null)
speed = weaponBase.getSpeed(); speed = weapon.getModifiedSpeed();
else else
speed = 20f; //unarmed attack speed 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){ if(this.bonuses!= null){
for (AbstractEffectModifier mod : this.bonuses.bonusFloats.keySet()) { for (AbstractEffectModifier mod : this.bonuses.bonusFloats.keySet()) {
if (mod.modType.equals(ModType.AttackDelay)) { if (mod.modType.equals(ModType.AttackDelay)) {

Loading…
Cancel
Save