Browse Source

PlayerCombatStats defense

lakebane-dex-penalty
FatBoy-DOTC 1 week ago
parent
commit
fdf42bd913
  1. 23
      src/engine/objects/PlayerCombatStats.java

23
src/engine/objects/PlayerCombatStats.java

@ -7,7 +7,6 @@ import java.util.ArrayList; @@ -7,7 +7,6 @@ import java.util.ArrayList;
import java.util.HashMap;
public class PlayerCombatStats {
public static HashMap<PlayerCharacter, PlayerCombatStats> combatstats = new HashMap<>();
public PlayerCharacter owner;
//main hand data
@ -47,7 +46,6 @@ public class PlayerCombatStats { @@ -47,7 +46,6 @@ public class PlayerCombatStats {
this.calculateAttackRange(false);
this.calculateRegen();
this.calculateDefense();
combatstats.put(this.owner, this);
}
public void calculateATR(boolean mainHand) {
@ -338,7 +336,6 @@ public class PlayerCombatStats { @@ -338,7 +336,6 @@ public class PlayerCombatStats {
double blockSkill = 0;
double weaponSkill = 0;
double weaponMastery = 0;
int flatBonuses = 0;
//armor defense value need to loop all equipped items and log armor defense values
ArrayList<String> armorTypes = new ArrayList<>();
@ -399,21 +396,23 @@ public class PlayerCombatStats { @@ -399,21 +396,23 @@ public class PlayerCombatStats {
}
float stanceValue = 0.0f;
float bonusValues = 0;
float percentBonus = 0;
if (this.owner.bonuses != null) {
for (String effID : this.owner.effects.keySet()) {
if(effID.contains("STC")){
if (effID.contains("Stance")) {
if (this.owner.effects != null) {
for (AbstractEffectModifier mod : this.owner.effects.get(effID).getEffectModifiers()) {
if(mod.modType.equals(Enum.ModType.AttackDelay)){
if (mod.modType.equals(Enum.ModType.DCV)) {
stanceValue = mod.getPercentMod() * 0.01f; // account for weapon prefix and suffix mods
}
}
}
}
}
float bonusValues = 1.0f + this.owner.bonuses.getFloat(Enum.ModType.DCV, Enum.SourceType.None);
bonusValues -= stanceValue; // take away stance modifier from alac bonus values
flatBonuses += bonusValues; // apply alac bonuses without stance mod
bonusValues = this.owner.bonuses.getFloat(Enum.ModType.DCV, Enum.SourceType.None);
percentBonus = this.owner.bonuses.getFloatPercentAll(Enum.ModType.DCV, Enum.SourceType.None) - stanceValue;
}
double defense = (1 + armorSkill / 50.0) * armorDefense +
@ -421,8 +420,10 @@ public class PlayerCombatStats { @@ -421,8 +420,10 @@ public class PlayerCombatStats {
(weaponSkill / 2.0) +
(weaponMastery / 2.0) +
dexterity * 2.0 +
flatBonuses;
bonusValues;
defense *= 1.0f + percentBonus;
defense *= 1.0f + stanceValue;
this.defense = (int) (defense * 1.0f + stanceValue);
this.defense = (int) defense;
}
}

Loading…
Cancel
Save