Browse Source

attack speed calculation handled correctly

postwipe-mines
FatBoy-DOTC 7 months ago
parent
commit
74bd7ddb8b
  1. 21
      src/engine/objects/AbstractCharacter.java
  2. 2
      src/engine/objects/PlayerBonuses.java

21
src/engine/objects/AbstractCharacter.java

@ -31,6 +31,7 @@ import engine.net.client.msg.ApplyRuneMsg;
import engine.net.client.msg.UpdateStateMsg; import engine.net.client.msg.UpdateStateMsg;
import engine.powers.EffectsBase; import engine.powers.EffectsBase;
import engine.powers.PowersBase; import engine.powers.PowersBase;
import engine.powers.effectmodifiers.AbstractEffectModifier;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@ -804,7 +805,25 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
if (weapon != null) if (weapon != null)
speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.WeaponSpeed, SourceType.None)); 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) if (speed < 10)
speed = 10; speed = 10;

2
src/engine/objects/PlayerBonuses.java

@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class PlayerBonuses { public class PlayerBonuses {
//First bonus set //First bonus set
private ConcurrentHashMap<AbstractEffectModifier, Float> bonusFloats = new ConcurrentHashMap<>(); ConcurrentHashMap<AbstractEffectModifier, Float> bonusFloats = new ConcurrentHashMap<>();
private ConcurrentHashMap<AbstractEffectModifier, DamageShield> bonusDamageShields = new ConcurrentHashMap<>(); private ConcurrentHashMap<AbstractEffectModifier, DamageShield> bonusDamageShields = new ConcurrentHashMap<>();
private ConcurrentHashMap<AbstractEffectModifier, String> bonusStrings = new ConcurrentHashMap<>(); private ConcurrentHashMap<AbstractEffectModifier, String> bonusStrings = new ConcurrentHashMap<>();
private ConcurrentHashMap<ModType, HashSet<SourceType>> bonusLists = new ConcurrentHashMap<>(); private ConcurrentHashMap<ModType, HashSet<SourceType>> bonusLists = new ConcurrentHashMap<>();

Loading…
Cancel
Save