From 1ff0238b6e72f5aadf37ab7bf62172c1cb80ed3e Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 3 Sep 2023 20:22:01 -0500 Subject: [PATCH] skill loading bypass for guards --- src/engine/objects/CharacterSkill.java | 63 ++++++++++++++------------ 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/src/engine/objects/CharacterSkill.java b/src/engine/objects/CharacterSkill.java index a4cb9588..5dd0a539 100644 --- a/src/engine/objects/CharacterSkill.java +++ b/src/engine/objects/CharacterSkill.java @@ -223,7 +223,7 @@ public class CharacterSkill extends AbstractGameObject { this.numTrains.set(0); this.ownerUID = pc.getObjectUUID(); calculateBaseAmount(); - calculateModifiedAmount(); + calculateModifiedAmount(false); this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken()); } @@ -238,7 +238,7 @@ public class CharacterSkill extends AbstractGameObject { this.ownerUID = pc.getObjectUUID(); this.trained = true; calculateBaseAmount(); - calculateModifiedAmount(); + calculateModifiedAmount(false); this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken()); } @@ -254,7 +254,7 @@ public class CharacterSkill extends AbstractGameObject { this.numTrains.set(rs.getShort("trains")); this.ownerUID = pc.getObjectUUID(); calculateBaseAmount(); - calculateModifiedAmount(); + calculateModifiedAmount(false); this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken()); } @@ -264,8 +264,9 @@ public class CharacterSkill extends AbstractGameObject { this.numTrains.set(trains); this.ownerUID = mob.getObjectUUID(); this.isMobOwner = true; - calculateMobBaseAmount(); - calculateModifiedAmount(); + boolean isGuard = mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) || mob.agentType.equals(Enum.AIAgentType.GUARDMINION); + calculateMobBaseAmount(isGuard); + calculateModifiedAmount(isGuard); this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken()); } @@ -277,7 +278,7 @@ public class CharacterSkill extends AbstractGameObject { this.ownerUID = rs.getInt("CharacterID"); // this.owner = DbManager.PlayerCharacterQueries.GET_PLAYER_CHARACTER(rs.getInt("CharacterID")); calculateBaseAmount(); - calculateModifiedAmount(); + calculateModifiedAmount(false); this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken()); } @@ -370,7 +371,7 @@ public class CharacterSkill extends AbstractGameObject { String name = it.next(); CharacterSkill cs = skills.get(name); if (cs != null) - cs.calculateModifiedAmount(); + cs.calculateModifiedAmount(false); } @@ -756,7 +757,7 @@ public class CharacterSkill extends AbstractGameObject { //recalculate this skill calculateBaseAmount(); - calculateModifiedAmount(); + calculateModifiedAmount(false); //see if any new skills or powers granted pc.calculateSkills(); @@ -848,7 +849,7 @@ public class CharacterSkill extends AbstractGameObject { if (recalculate) { //recalculate this skill calculateBaseAmount(); - calculateModifiedAmount(); + calculateModifiedAmount(false); //see if any skills or powers removed pc.calculateSkills(); @@ -887,7 +888,7 @@ public class CharacterSkill extends AbstractGameObject { if (recalculate) { //recalculate this skill calculateBaseAmount(); - calculateModifiedAmount(); + calculateModifiedAmount(false); //see if any skills or powers removed pc.calculateSkills(); @@ -1016,21 +1017,22 @@ public class CharacterSkill extends AbstractGameObject { this.modifiedAmountBeforeMods = Math.round(this.baseAmountBeforeMods + calculateAmountAfterTrains()); } - public void calculateMobBaseAmount() { - if (CharacterSkill.GetOwner(this) == null) { - Logger.error("owner not found for owner uuid : " + this.ownerUID); - this.baseAmount = 1; - this.modifiedAmount = 1; - return; - } + public void calculateMobBaseAmount(boolean isGuard) { + if(!isGuard) { + if (CharacterSkill.GetOwner(this) == null) { + Logger.error("owner not found for owner uuid : " + this.ownerUID); + this.baseAmount = 1; + this.modifiedAmount = 1; + return; + } - if (this.skillsBase == null) { - Logger.error("SkillsBase not found for skill " + this.getObjectUUID()); - this.baseAmount = 1; - this.modifiedAmount = 1; - return; + if (this.skillsBase == null) { + Logger.error("SkillsBase not found for skill " + this.getObjectUUID()); + this.baseAmount = 1; + this.modifiedAmount = 1; + return; + } } - //Get any rune bonus float bonus = 0f; //TODO SKILLS RUNES @@ -1066,14 +1068,15 @@ public class CharacterSkill extends AbstractGameObject { this.modifiedAmountBeforeMods = (int) (this.baseAmountBeforeMods + calculateAmountAfterTrains()); } - public void calculateModifiedAmount() { - if (CharacterSkill.GetOwner(this) == null || this.skillsBase == null) { - Logger.error("owner or SkillsBase not found for skill " + this.getObjectUUID()); - this.baseAmount = 1; - this.modifiedAmount = 1; - return; + public void calculateModifiedAmount(boolean isGuard) { + if(!isGuard) { + if (CharacterSkill.GetOwner(this) == null || this.skillsBase == null) { + Logger.error("owner or SkillsBase not found for skill " + this.getObjectUUID()); + this.baseAmount = 1; + this.modifiedAmount = 1; + return; + } } - //Get any rune bonus float bonus = 0f; if (CharacterSkill.GetOwner(this).getBonuses() != null) {