From 4462e34ca4c1138c75edb809633dd287d2c38605 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 23 Apr 2023 12:03:46 -0400 Subject: [PATCH] mobbase.fsm should never be blank. --- src/engine/Enum.java | 10 +--------- src/engine/objects/MobBase.java | 3 ++- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 89b0f995..180ecbda 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -2793,6 +2793,7 @@ public class Enum { } public enum MobBehaviourType { + None(null, false, false, false, false, false), //Power Power(null, false, true, true, true, false), PowerHelpee(Power, false, true, true, false, true), @@ -2821,7 +2822,6 @@ public class Enum { Simple(null, false, false, true, false, false), Helpee(null, false, true, true, false, true), HelpeeWimpy(null, true, false, true, false, false), - None(null, false, false, false, false, false), GuardCaptain(null, false, true, true, true, false), GuardMinion(GuardCaptain, false, true, true, false, true), GuardWallArcher(null, false, true, false, false, false), @@ -2846,13 +2846,5 @@ public class Enum { this.respondsToCallForHelp = respondstocallforhelp; } - public static MobBehaviourType getByName(String name) { - for (MobBehaviourType behaviourType : values()) { - if (behaviourType.name().equalsIgnoreCase(name)) { - return behaviourType; - } - } - return MobBehaviourType.None; - } } } diff --git a/src/engine/objects/MobBase.java b/src/engine/objects/MobBase.java index c6219f71..b1686a5e 100644 --- a/src/engine/objects/MobBase.java +++ b/src/engine/objects/MobBase.java @@ -89,7 +89,8 @@ public class MobBase extends AbstractGameObject { this.defenseRating = rs.getInt("defense"); this.attackRange = rs.getFloat("attackRange"); this.bootySet = rs.getInt("bootySet"); - this.fsm = Enum.MobBehaviourType.getByName(rs.getString("fsm")); + + this.fsm = Enum.MobBehaviourType.valueOf(rs.getString("fsm")); if (MobbaseGoldEntry.MobbaseGoldMap.containsKey(this.loadID)){ MobbaseGoldEntry goldEntry = MobbaseGoldEntry.MobbaseGoldMap.get(this.loadID);