Browse Source

PlayerCombatStats weapon speed calculations

lakebane-dex-penalty
FatBoy-DOTC 1 week ago
parent
commit
810812d06b
  1. 2
      src/engine/devcmd/cmds/PrintStatsCmd.java
  2. 52
      src/engine/objects/PlayerCombatStats.java

2
src/engine/devcmd/cmds/PrintStatsCmd.java

@ -77,7 +77,7 @@ public class PrintStatsCmd extends AbstractDevCmd {
newOut += "HAND ONE" + newline; newOut += "HAND ONE" + newline;
newOut += "ATR: " + tar.combatStats.atrHandOne + newline; newOut += "ATR: " + tar.combatStats.atrHandOne + newline;
newOut += "MIN: " + tar.combatStats.minDamageHandOne + newline; newOut += "MIN: " + tar.combatStats.minDamageHandOne + newline;
newOut += "MAX: " + " VS " + tar.combatStats.maxDamageHandOne + newline; newOut += "MAX: " + tar.combatStats.maxDamageHandOne + newline;
newOut += "RANGE: " + tar.combatStats.rangeHandOne + newline; newOut += "RANGE: " + tar.combatStats.rangeHandOne + newline;
newOut += "ATTACK SPEED: " + tar.combatStats.attackSpeedHandOne + newline; newOut += "ATTACK SPEED: " + tar.combatStats.attackSpeedHandOne + newline;
newOut += "HAND TWO" + newline; newOut += "HAND TWO" + newline;

52
src/engine/objects/PlayerCombatStats.java

@ -3,6 +3,7 @@ package engine.objects;
import engine.Enum; import engine.Enum;
import engine.powers.effectmodifiers.AbstractEffectModifier; import engine.powers.effectmodifiers.AbstractEffectModifier;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -35,18 +36,66 @@ public class PlayerCombatStats {
} }
public void update() { public void update() {
try {
this.calculateATR(true); this.calculateATR(true);
} catch (Exception e) {
Logger.error("FAILED TO CALCULATE ATR FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateATR(false); this.calculateATR(false);
} catch (Exception e) {
Logger.error("FAILED TO CALCULATE ATR FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateMin(true); this.calculateMin(true);
} catch (Exception e) {
Logger.error("FAILED TO CALCULATE Min FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateMin(false); this.calculateMin(false);
} catch (Exception e) {
Logger.error("FAILED TO CALCULATE Min FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateMax(true); this.calculateMax(true);
} catch (Exception e) {
Logger.error("FAILED TO CALCULATE Max FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateMax(false); this.calculateMax(false);
} catch (Exception e) {
Logger.error("FAILED TO CALCULATE Max FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateAttackSpeed(true); this.calculateAttackSpeed(true);
} catch (Exception e) {
Logger.error("FAILED TO CALCULATE Attack Speed FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateAttackSpeed(false); this.calculateAttackSpeed(false);
} catch (Exception e) {
Logger.error("FAILED TO CALCULATE Attack Speed FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateAttackRange(true); this.calculateAttackRange(true);
} catch (Exception e) {
Logger.error("FAILED TO CALCULATE Attack Range FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateAttackRange(false); this.calculateAttackRange(false);
} catch (Exception e) {
Logger.error("FAILED TO CALCULATE Attack Range FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateRegen(); this.calculateRegen();
} catch (Exception e) {
Logger.error("FAILED TO CALCULATE Regen FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateDefense(); this.calculateDefense();
} catch (Exception e) {
Logger.error("FAILED TO CALCULATE Defense FOR: " + this.owner.getObjectUUID());
}
} }
public void calculateATR(boolean mainHand) { public void calculateATR(boolean mainHand) {
@ -226,7 +275,7 @@ public class PlayerCombatStats {
//Weapon Max DMG = BaseDMG * (0.0124*Primary Stat + 0.118*(Primary Stat -0.75)^0.5 //Weapon Max DMG = BaseDMG * (0.0124*Primary Stat + 0.118*(Primary Stat -0.75)^0.5
// + 0.0022*Secondary Stat + 0.028*(Secondary Stat-0.75)^0.5 + 0.0075*(Weapon Skill + Weapon Mastery)) // + 0.0022*Secondary Stat + 0.028*(Secondary Stat-0.75)^0.5 + 0.0075*(Weapon Skill + Weapon Mastery))
Item weapon; Item weapon;
double baseDMG = 6; double baseDMG = 5;
int primaryStat = this.owner.statDexCurrent; int primaryStat = this.owner.statDexCurrent;
int secondaryStat = this.owner.statStrCurrent; int secondaryStat = this.owner.statStrCurrent;
double weaponSkill = 5; double weaponSkill = 5;
@ -302,6 +351,7 @@ public class PlayerCombatStats {
for(Effect eff : weapon.effects.values()){ for(Effect eff : weapon.effects.values()){
for(AbstractEffectModifier mod : eff.getEffectModifiers()){ for(AbstractEffectModifier mod : eff.getEffectModifiers()){
if(mod.modType.equals(Enum.ModType.WeaponSpeed) || mod.modType.equals(Enum.ModType.AttackDelay)){ if(mod.modType.equals(Enum.ModType.WeaponSpeed) || mod.modType.equals(Enum.ModType.AttackDelay)){
float percent = mod.getPercentMod() * 0.01f;
speed *= 1 + (mod.getPercentMod() * 0.01f); speed *= 1 + (mod.getPercentMod() * 0.01f);
weaponSpecificValues += (mod.getPercentMod() * 0.01f); weaponSpecificValues += (mod.getPercentMod() * 0.01f);
} }

Loading…
Cancel
Save