Browse Source

skill loading bypass for guards

combat-2
FatBoy-DOTC 1 year ago
parent
commit
1ff0238b6e
  1. 31
      src/engine/objects/CharacterSkill.java

31
src/engine/objects/CharacterSkill.java

@ -223,7 +223,7 @@ public class CharacterSkill extends AbstractGameObject {
this.numTrains.set(0); this.numTrains.set(0);
this.ownerUID = pc.getObjectUUID(); this.ownerUID = pc.getObjectUUID();
calculateBaseAmount(); calculateBaseAmount();
calculateModifiedAmount(); calculateModifiedAmount(false);
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken()); this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
} }
@ -238,7 +238,7 @@ public class CharacterSkill extends AbstractGameObject {
this.ownerUID = pc.getObjectUUID(); this.ownerUID = pc.getObjectUUID();
this.trained = true; this.trained = true;
calculateBaseAmount(); calculateBaseAmount();
calculateModifiedAmount(); calculateModifiedAmount(false);
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken()); this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
} }
@ -254,7 +254,7 @@ public class CharacterSkill extends AbstractGameObject {
this.numTrains.set(rs.getShort("trains")); this.numTrains.set(rs.getShort("trains"));
this.ownerUID = pc.getObjectUUID(); this.ownerUID = pc.getObjectUUID();
calculateBaseAmount(); calculateBaseAmount();
calculateModifiedAmount(); calculateModifiedAmount(false);
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken()); this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
} }
@ -264,8 +264,9 @@ public class CharacterSkill extends AbstractGameObject {
this.numTrains.set(trains); this.numTrains.set(trains);
this.ownerUID = mob.getObjectUUID(); this.ownerUID = mob.getObjectUUID();
this.isMobOwner = true; this.isMobOwner = true;
calculateMobBaseAmount(); boolean isGuard = mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) || mob.agentType.equals(Enum.AIAgentType.GUARDMINION);
calculateModifiedAmount(); calculateMobBaseAmount(isGuard);
calculateModifiedAmount(isGuard);
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken()); this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
} }
@ -277,7 +278,7 @@ public class CharacterSkill extends AbstractGameObject {
this.ownerUID = rs.getInt("CharacterID"); this.ownerUID = rs.getInt("CharacterID");
// this.owner = DbManager.PlayerCharacterQueries.GET_PLAYER_CHARACTER(rs.getInt("CharacterID")); // this.owner = DbManager.PlayerCharacterQueries.GET_PLAYER_CHARACTER(rs.getInt("CharacterID"));
calculateBaseAmount(); calculateBaseAmount();
calculateModifiedAmount(); calculateModifiedAmount(false);
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken()); this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
} }
@ -370,7 +371,7 @@ public class CharacterSkill extends AbstractGameObject {
String name = it.next(); String name = it.next();
CharacterSkill cs = skills.get(name); CharacterSkill cs = skills.get(name);
if (cs != null) if (cs != null)
cs.calculateModifiedAmount(); cs.calculateModifiedAmount(false);
} }
@ -756,7 +757,7 @@ public class CharacterSkill extends AbstractGameObject {
//recalculate this skill //recalculate this skill
calculateBaseAmount(); calculateBaseAmount();
calculateModifiedAmount(); calculateModifiedAmount(false);
//see if any new skills or powers granted //see if any new skills or powers granted
pc.calculateSkills(); pc.calculateSkills();
@ -848,7 +849,7 @@ public class CharacterSkill extends AbstractGameObject {
if (recalculate) { if (recalculate) {
//recalculate this skill //recalculate this skill
calculateBaseAmount(); calculateBaseAmount();
calculateModifiedAmount(); calculateModifiedAmount(false);
//see if any skills or powers removed //see if any skills or powers removed
pc.calculateSkills(); pc.calculateSkills();
@ -887,7 +888,7 @@ public class CharacterSkill extends AbstractGameObject {
if (recalculate) { if (recalculate) {
//recalculate this skill //recalculate this skill
calculateBaseAmount(); calculateBaseAmount();
calculateModifiedAmount(); calculateModifiedAmount(false);
//see if any skills or powers removed //see if any skills or powers removed
pc.calculateSkills(); pc.calculateSkills();
@ -1016,7 +1017,8 @@ public class CharacterSkill extends AbstractGameObject {
this.modifiedAmountBeforeMods = Math.round(this.baseAmountBeforeMods + calculateAmountAfterTrains()); this.modifiedAmountBeforeMods = Math.round(this.baseAmountBeforeMods + calculateAmountAfterTrains());
} }
public void calculateMobBaseAmount() { public void calculateMobBaseAmount(boolean isGuard) {
if(!isGuard) {
if (CharacterSkill.GetOwner(this) == null) { if (CharacterSkill.GetOwner(this) == null) {
Logger.error("owner not found for owner uuid : " + this.ownerUID); Logger.error("owner not found for owner uuid : " + this.ownerUID);
this.baseAmount = 1; this.baseAmount = 1;
@ -1030,7 +1032,7 @@ public class CharacterSkill extends AbstractGameObject {
this.modifiedAmount = 1; this.modifiedAmount = 1;
return; return;
} }
}
//Get any rune bonus //Get any rune bonus
float bonus = 0f; float bonus = 0f;
//TODO SKILLS RUNES //TODO SKILLS RUNES
@ -1066,14 +1068,15 @@ public class CharacterSkill extends AbstractGameObject {
this.modifiedAmountBeforeMods = (int) (this.baseAmountBeforeMods + calculateAmountAfterTrains()); this.modifiedAmountBeforeMods = (int) (this.baseAmountBeforeMods + calculateAmountAfterTrains());
} }
public void calculateModifiedAmount() { public void calculateModifiedAmount(boolean isGuard) {
if(!isGuard) {
if (CharacterSkill.GetOwner(this) == null || this.skillsBase == null) { if (CharacterSkill.GetOwner(this) == null || this.skillsBase == null) {
Logger.error("owner or SkillsBase not found for skill " + this.getObjectUUID()); Logger.error("owner or SkillsBase not found for skill " + this.getObjectUUID());
this.baseAmount = 1; this.baseAmount = 1;
this.modifiedAmount = 1; this.modifiedAmount = 1;
return; return;
} }
}
//Get any rune bonus //Get any rune bonus
float bonus = 0f; float bonus = 0f;
if (CharacterSkill.GetOwner(this).getBonuses() != null) { if (CharacterSkill.GetOwner(this).getBonuses() != null) {

Loading…
Cancel
Save