From 0b4873a522d8116721ebfa95587e5609f16c7672 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 5 Apr 2024 08:44:59 -0400 Subject: [PATCH] refactored out dependency --- src/engine/mbEnums.java | 2 +- .../mobileAI/utilities/MovementUtilities.java | 2 +- src/engine/objects/MobBase.java | 17 ++++++++--------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/engine/mbEnums.java b/src/engine/mbEnums.java index 2a2a4e0e..e80cd8aa 100644 --- a/src/engine/mbEnums.java +++ b/src/engine/mbEnums.java @@ -121,7 +121,7 @@ public class mbEnums { } - public enum MobFlagType implements EnumBitSetHelper { + public enum MobFlagType { AGGRESSIVE, CANROAM, CALLSFORHELP, diff --git a/src/engine/mobileAI/utilities/MovementUtilities.java b/src/engine/mobileAI/utilities/MovementUtilities.java index 0e91800a..999a74ed 100644 --- a/src/engine/mobileAI/utilities/MovementUtilities.java +++ b/src/engine/mobileAI/utilities/MovementUtilities.java @@ -166,7 +166,7 @@ public class MovementUtilities { public static boolean canMove(Mob agent) { - if (agent.getMobBase() != null && mbEnums.MobFlagType.SENTINEL.elementOf(agent.getMobBase().getFlags())) + if (agent.getMobBase() != null && agent.getMobBase().getFlags().contains(mbEnums.MobFlagType.SENTINEL)) return false; return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.CannotMove, SourceType.None)); diff --git a/src/engine/objects/MobBase.java b/src/engine/objects/MobBase.java index 0d68794b..fe573a4a 100644 --- a/src/engine/objects/MobBase.java +++ b/src/engine/objects/MobBase.java @@ -9,7 +9,6 @@ package engine.objects; -import ch.claude_martin.enumbitset.EnumBitSet; import engine.gameManager.DbManager; import engine.gameManager.LootManager; import engine.loot.BootySetEntry; @@ -39,7 +38,7 @@ public class MobBase extends AbstractGameObject { private float damageMin; private float damageMax; private float hitBoxRadius; - private EnumBitSet flags; + private EnumSet flags; private int mask; private int goldMod; private int seeInvis; @@ -77,7 +76,7 @@ public class MobBase extends AbstractGameObject { this.fsm = mbEnums.MobBehaviourType.valueOf(rs.getString("fsm")); - this.flags = EnumBitSet.asEnumBitSet(rs.getLong("flags"), mbEnums.MobFlagType.class); + this.flags = mbEnums.fromLong(rs.getLong("flags"), mbEnums.MobFlagType.class); this.notEnemy = mbEnums.fromLong(rs.getLong("notEnemy"), mbEnums.MonsterType.class); this.enemy = mbEnums.fromLong(rs.getLong("enemy"), mbEnums.MonsterType.class); @@ -89,19 +88,19 @@ public class MobBase extends AbstractGameObject { if (this.getObjectUUID() == 12021 || this.getObjectUUID() == 12022) this.isNecroPet = true; - if (mbEnums.MobFlagType.HUMANOID.elementOf(this.flags)) + if (this.flags.contains(mbEnums.MobFlagType.HUMANOID)) this.mask += MBServerStatics.MASK_HUMANOID; - if (mbEnums.MobFlagType.UNDEAD.elementOf(this.flags)) + if (this.flags.contains(mbEnums.MobFlagType.UNDEAD)) this.mask += MBServerStatics.MASK_UNDEAD; - if (mbEnums.MobFlagType.BEAST.elementOf(this.flags)) + if (this.flags.contains(mbEnums.MobFlagType.BEAST)) this.mask += MBServerStatics.MASK_BEAST; - if (mbEnums.MobFlagType.DRAGON.elementOf(this.flags)) + if (this.flags.contains(mbEnums.MobFlagType.DRAGON)) this.mask += MBServerStatics.MASK_DRAGON; - if (mbEnums.MobFlagType.RAT.elementOf(this.flags)) + if (this.flags.contains(mbEnums.MobFlagType.RAT)) this.mask += MBServerStatics.MASK_RAT; this.mobBaseStats = DbManager.MobBaseQueries.LOAD_STATS(this.loadID); @@ -204,7 +203,7 @@ public class MobBase extends AbstractGameObject { return this.defenseRating; } - public EnumBitSet getFlags() { + public EnumSet getFlags() { return this.flags; }