Browse Source

use calculated value son PC for combat stats

lakebane-ai
FatBoy-DOTC 3 weeks ago
parent
commit
afbe23fc03
  1. 5
      src/engine/gameManager/CombatManager.java
  2. 4
      src/engine/mobileAI/utilities/CombatUtilities.java
  3. 12
      src/engine/objects/PlayerCombatStats.java

5
src/engine/gameManager/CombatManager.java

@ -546,6 +546,8 @@ public enum CombatManager {
return; return;
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){ if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
PlayerCharacter pc = (PlayerCharacter) ac; PlayerCharacter pc = (PlayerCharacter) ac;
pc.combatStats.calculateATR(true);
pc.combatStats.calculateATR(false);
if (mainHand) { if (mainHand) {
atr = pc.combatStats.atrHandOne; atr = pc.combatStats.atrHandOne;
minDamage = pc.combatStats.minDamageHandOne; minDamage = pc.combatStats.minDamageHandOne;
@ -659,6 +661,7 @@ public enum CombatManager {
} else { } else {
AbstractCharacter tar = (AbstractCharacter) target; AbstractCharacter tar = (AbstractCharacter) target;
if(tar.getObjectType().equals(GameObjectType.PlayerCharacter)){ if(tar.getObjectType().equals(GameObjectType.PlayerCharacter)){
((PlayerCharacter)tar).combatStats.calculateDefense();
defense = ((PlayerCharacter)tar).combatStats.defense; defense = ((PlayerCharacter)tar).combatStats.defense;
}else { }else {
defense = tar.getDefenseRating(); defense = tar.getDefenseRating();
@ -671,7 +674,7 @@ public enum CombatManager {
//Get hit chance //Get hit chance
//int chance; //int chance;
float dif = atr - defense; //float dif = atr - defense;
//if (dif > 100) //if (dif > 100)
// chance = 94; // chance = 94;

4
src/engine/mobileAI/utilities/CombatUtilities.java

@ -148,7 +148,9 @@ public class CombatUtilities {
} }
switch (target.getObjectType()) { switch (target.getObjectType()) {
case PlayerCharacter: case PlayerCharacter:
defense = ((AbstractCharacter) target).getDefenseRating(); PlayerCharacter pc = (PlayerCharacter)target;
pc.combatStats.calculateDefense();
defense = pc.combatStats.defense;
break; break;
case Mob: case Mob:

12
src/engine/objects/PlayerCombatStats.java

@ -42,51 +42,61 @@ public class PlayerCombatStats {
public void update() { public void update() {
try { try {
this.calculateATR(true); this.calculateATR(true);
this.owner.atrHandOne = (int) this.atrHandOne;
} catch (Exception e) { } catch (Exception e) {
//Logger.error("FAILED TO CALCULATE ATR FOR: " + this.owner.getObjectUUID()); //Logger.error("FAILED TO CALCULATE ATR FOR: " + this.owner.getObjectUUID());
} }
try { try {
this.calculateATR(false); this.calculateATR(false);
this.owner.atrHandTwo = (int) this.atrHandTwo;
} catch (Exception e) { } catch (Exception e) {
//Logger.error("FAILED TO CALCULATE ATR FOR: " + this.owner.getObjectUUID()); //Logger.error("FAILED TO CALCULATE ATR FOR: " + this.owner.getObjectUUID());
} }
try { try {
this.calculateMin(true); this.calculateMin(true);
this.owner.minDamageHandOne = this.minDamageHandOne;
} catch (Exception e) { } catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Min FOR: " + this.owner.getObjectUUID()); //Logger.error("FAILED TO CALCULATE Min FOR: " + this.owner.getObjectUUID());
} }
try { try {
this.calculateMin(false); this.calculateMin(false);
this.owner.minDamageHandTwo = this.minDamageHandTwo;
} catch (Exception e) { } catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Min FOR: " + this.owner.getObjectUUID()); //Logger.error("FAILED TO CALCULATE Min FOR: " + this.owner.getObjectUUID());
} }
try { try {
this.calculateMax(true); this.calculateMax(true);
this.owner.maxDamageHandOne = this.maxDamageHandOne;
} catch (Exception e) { } catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Max FOR: " + this.owner.getObjectUUID()); //Logger.error("FAILED TO CALCULATE Max FOR: " + this.owner.getObjectUUID());
} }
try { try {
this.calculateMax(false); this.calculateMax(false);
this.owner.maxDamageHandTwo = this.maxDamageHandTwo;
} catch (Exception e) { } catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Max FOR: " + this.owner.getObjectUUID()); //Logger.error("FAILED TO CALCULATE Max FOR: " + this.owner.getObjectUUID());
} }
try { try {
this.calculateAttackSpeed(true); this.calculateAttackSpeed(true);
this.owner.speedHandOne = this.attackSpeedHandOne;
} catch (Exception e) { } catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Attack Speed FOR: " + this.owner.getObjectUUID()); //Logger.error("FAILED TO CALCULATE Attack Speed FOR: " + this.owner.getObjectUUID());
} }
try { try {
this.calculateAttackSpeed(false); this.calculateAttackSpeed(false);
this.owner.speedHandTwo = this.attackSpeedHandTwo;
} catch (Exception e) { } catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Attack Speed FOR: " + this.owner.getObjectUUID()); //Logger.error("FAILED TO CALCULATE Attack Speed FOR: " + this.owner.getObjectUUID());
} }
try { try {
this.calculateAttackRange(true); this.calculateAttackRange(true);
this.owner.rangeHandOne = this.rangeHandOne;
} catch (Exception e) { } catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Attack Range FOR: " + this.owner.getObjectUUID()); //Logger.error("FAILED TO CALCULATE Attack Range FOR: " + this.owner.getObjectUUID());
} }
try { try {
this.calculateAttackRange(false); this.calculateAttackRange(false);
this.owner.rangeHandTwo = this.rangeHandTwo;
} catch (Exception e) { } catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Attack Range FOR: " + this.owner.getObjectUUID()); //Logger.error("FAILED TO CALCULATE Attack Range FOR: " + this.owner.getObjectUUID());
} }
@ -97,9 +107,11 @@ public class PlayerCombatStats {
//} //}
try { try {
this.calculateDefense(); this.calculateDefense();
this.owner.defenseRating = this.defense;
} catch (Exception e) { } catch (Exception e) {
//Logger.error("FAILED TO CALCULATE Defense FOR: " + this.owner.getObjectUUID()); //Logger.error("FAILED TO CALCULATE Defense FOR: " + this.owner.getObjectUUID());
} }
} }
public void calculateATR(boolean mainHand) { public void calculateATR(boolean mainHand) {

Loading…
Cancel
Save