Browse Source

null checks

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

24
src/engine/objects/CharacterSkill.java

@ -265,6 +265,9 @@ public class CharacterSkill extends AbstractGameObject { @@ -265,6 +265,9 @@ public class CharacterSkill extends AbstractGameObject {
this.ownerUID = mob.getObjectUUID();
this.isMobOwner = true;
boolean isGuard = mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) || mob.agentType.equals(Enum.AIAgentType.GUARDMINION);
if(isGuard) {
boolean poop = true;
}
calculateMobBaseAmount(isGuard);
calculateModifiedAmount(isGuard);
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
@ -1036,15 +1039,15 @@ public class CharacterSkill extends AbstractGameObject { @@ -1036,15 +1039,15 @@ public class CharacterSkill extends AbstractGameObject {
//Get any rune bonus
float bonus = 0f;
//TODO SKILLS RUNES
float base = 7f;
float statMod = 0.5f;
if (CharacterSkill.GetOwner(this) != null && CharacterSkill.GetOwner(this).getBonuses() != null) {
//Get bonuses from runes
bonus = CharacterSkill.GetOwner(this).getBonuses().getSkillBonus(this.skillsBase.sourceType);
}
//Get Base skill for unmodified stats
float base = 7f;
float statMod = 0.5f;
if (this.skillsBase.getStrMod() > 0)
statMod += (float) this.skillsBase.getStrMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseStr() / 100f;
if (this.skillsBase.getDexMod() > 0)
@ -1059,6 +1062,7 @@ public class CharacterSkill extends AbstractGameObject { @@ -1059,6 +1062,7 @@ public class CharacterSkill extends AbstractGameObject {
statMod = 1f;
else if (statMod > 600)
statMod = 600f;
}
base += CharacterSkill.baseSkillValues[(int) statMod];
if (base + bonus < 1f)
@ -1079,15 +1083,16 @@ public class CharacterSkill extends AbstractGameObject { @@ -1079,15 +1083,16 @@ public class CharacterSkill extends AbstractGameObject {
}
//Get any rune bonus
float bonus = 0f;
float base = 7f;
float statMod = 0.5f;
if (CharacterSkill.GetOwner(this) != null && CharacterSkill.GetOwner(this).getBonuses() != null) {
//Get bonuses from runes
bonus = CharacterSkill.GetOwner(this).getBonuses().getSkillBonus(this.skillsBase.sourceType);
}
//Get Base skill for modified stats
//TODO this fomula needs verified
float base = 7f;
float statMod = 0.5f;
if (this.skillsBase.getStrMod() > 0)
statMod += (float) this.skillsBase.getStrMod() * (float) CharacterSkill.GetOwner(this).getStatStrCurrent() / 100f;
if (this.skillsBase.getDexMod() > 0)
@ -1102,12 +1107,13 @@ public class CharacterSkill extends AbstractGameObject { @@ -1102,12 +1107,13 @@ public class CharacterSkill extends AbstractGameObject {
statMod = 1f;
else if (statMod > 600)
statMod = 600f;
}
base += CharacterSkill.baseSkillValues[(int) statMod];
SourceType sourceType = SourceType.GetSourceType(this.skillsBase.getNameNoSpace());
//Get any rune, effect and item bonus
if (CharacterSkill.GetOwner(this).getBonuses() != null) {
if (CharacterSkill.GetOwner(this) != null && CharacterSkill.GetOwner(this).getBonuses() != null) {
//add bonuses from effects/items and runes
base += bonus + CharacterSkill.GetOwner(this).getBonuses().getFloat(ModType.Skill, sourceType);
}
@ -1119,7 +1125,7 @@ public class CharacterSkill extends AbstractGameObject { @@ -1119,7 +1125,7 @@ public class CharacterSkill extends AbstractGameObject {
float modAmount = this.baseAmount + calculateAmountAfterTrains();
if (CharacterSkill.GetOwner(this).getBonuses() != null) {
if (CharacterSkill.GetOwner(this) != null && CharacterSkill.GetOwner(this).getBonuses() != null) {
//Multiply any percent bonuses
modAmount *= (1 + CharacterSkill.GetOwner(this).getBonuses().getFloatPercentAll(ModType.Skill, sourceType));
}

Loading…
Cancel
Save