use calculated value son PC for combat stats

This commit is contained in:
2025-02-03 20:20:01 -06:00
parent 4e417c8810
commit afbe23fc03
3 changed files with 19 additions and 2 deletions
+4 -1
View File
@@ -546,6 +546,8 @@ public enum CombatManager {
return;
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
PlayerCharacter pc = (PlayerCharacter) ac;
pc.combatStats.calculateATR(true);
pc.combatStats.calculateATR(false);
if (mainHand) {
atr = pc.combatStats.atrHandOne;
minDamage = pc.combatStats.minDamageHandOne;
@@ -659,6 +661,7 @@ public enum CombatManager {
} else {
AbstractCharacter tar = (AbstractCharacter) target;
if(tar.getObjectType().equals(GameObjectType.PlayerCharacter)){
((PlayerCharacter)tar).combatStats.calculateDefense();
defense = ((PlayerCharacter)tar).combatStats.defense;
}else {
defense = tar.getDefenseRating();
@@ -671,7 +674,7 @@ public enum CombatManager {
//Get hit chance
//int chance;
float dif = atr - defense;
//float dif = atr - defense;
//if (dif > 100)
// chance = 94;
@@ -148,7 +148,9 @@ public class CombatUtilities {
}
switch (target.getObjectType()) {
case PlayerCharacter:
defense = ((AbstractCharacter) target).getDefenseRating();
PlayerCharacter pc = (PlayerCharacter)target;
pc.combatStats.calculateDefense();
defense = pc.combatStats.defense;
break;
case Mob:
+12
View File
@@ -42,51 +42,61 @@ public class PlayerCombatStats {
public void update() {
try {
this.calculateATR(true);
this.owner.atrHandOne = (int) this.atrHandOne;
} catch (Exception e) {
//Logger.error("FAILED TO CALCULATE ATR FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateATR(false);
this.owner.atrHandTwo = (int) this.atrHandTwo;
} catch (Exception e) {
//Logger.error("FAILED TO CALCULATE ATR FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateMin(true);
this.owner.minDamageHandOne = this.minDamageHandOne;
} catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Min FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateMin(false);
this.owner.minDamageHandTwo = this.minDamageHandTwo;
} catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Min FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateMax(true);
this.owner.maxDamageHandOne = this.maxDamageHandOne;
} catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Max FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateMax(false);
this.owner.maxDamageHandTwo = this.maxDamageHandTwo;
} catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Max FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateAttackSpeed(true);
this.owner.speedHandOne = this.attackSpeedHandOne;
} catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Attack Speed FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateAttackSpeed(false);
this.owner.speedHandTwo = this.attackSpeedHandTwo;
} catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Attack Speed FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateAttackRange(true);
this.owner.rangeHandOne = this.rangeHandOne;
} catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Attack Range FOR: " + this.owner.getObjectUUID());
}
try {
this.calculateAttackRange(false);
this.owner.rangeHandTwo = this.rangeHandTwo;
} catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Attack Range FOR: " + this.owner.getObjectUUID());
}
@@ -97,9 +107,11 @@ public class PlayerCombatStats {
//}
try {
this.calculateDefense();
this.owner.defenseRating = this.defense;
} catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Defense FOR: " + this.owner.getObjectUUID());
}
}
public void calculateATR(boolean mainHand) {