Browse Source

refactored out dependency

combat-2
MagicBot 7 months ago
parent
commit
d3d1227d6c
  1. 3
      src/engine/mbEnums.java
  2. 6
      src/engine/objects/AbstractIntelligenceAgent.java
  3. 5
      src/engine/objects/Mob.java
  4. 9
      src/engine/objects/MobBase.java

3
src/engine/mbEnums.java

@ -76,7 +76,6 @@ public class mbEnums {
return enumSet; return enumSet;
} }
public static <E extends Enum<E>> String asString(EnumSet<E> enumSet) { public static <E extends Enum<E>> String asString(EnumSet<E> enumSet) {
if (enumSet == null || enumSet.isEmpty()) if (enumSet == null || enumSet.isEmpty())
@ -135,7 +134,7 @@ public class mbEnums {
SENTINEL, SENTINEL,
} }
public enum MonsterType implements EnumBitSetHelper<MonsterType> { public enum MonsterType {
Aelfborn, Aelfborn,
All, All,
Animal, Animal,

6
src/engine/objects/AbstractIntelligenceAgent.java

@ -9,7 +9,6 @@
package engine.objects; package engine.objects;
import ch.claude_martin.enumbitset.EnumBitSet;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
@ -26,6 +25,7 @@ import engine.server.MBServerStatics;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet;
public abstract class AbstractIntelligenceAgent extends AbstractCharacter { public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
@ -34,8 +34,8 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
public mbEnums.AIAgentType agentType = mbEnums.AIAgentType.MOBILE; public mbEnums.AIAgentType agentType = mbEnums.AIAgentType.MOBILE;
public AbstractCharacter guardCaptain; public AbstractCharacter guardCaptain;
public EnumBitSet<mbEnums.MonsterType> notEnemy = EnumBitSet.noneOf(mbEnums.MonsterType.class); public EnumSet<mbEnums.MonsterType> notEnemy = EnumSet.noneOf(mbEnums.MonsterType.class);
public EnumBitSet<mbEnums.MonsterType> enemy = EnumBitSet.noneOf(mbEnums.MonsterType.class); public EnumSet<mbEnums.MonsterType> enemy = EnumSet.noneOf(mbEnums.MonsterType.class);
; ;
public mbEnums.MobBehaviourType behaviourType; public mbEnums.MobBehaviourType behaviourType;
public ArrayList<Vector3fImmutable> patrolPoints; public ArrayList<Vector3fImmutable> patrolPoints;

5
src/engine/objects/Mob.java

@ -9,7 +9,6 @@
package engine.objects; package engine.objects;
import ch.claude_martin.enumbitset.EnumBitSet;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.exception.SerializationException; import engine.exception.SerializationException;
import engine.gameManager.*; import engine.gameManager.*;
@ -144,8 +143,8 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
this.runeSet = rs.getInt("runeSet"); this.runeSet = rs.getInt("runeSet");
this.bootySet = rs.getInt("bootySet"); this.bootySet = rs.getInt("bootySet");
this.notEnemy = EnumBitSet.asEnumBitSet(rs.getLong("notEnemy"), mbEnums.MonsterType.class); this.notEnemy = mbEnums.fromLong(rs.getLong("notEnemy"), mbEnums.MonsterType.class);
this.enemy = EnumBitSet.asEnumBitSet(rs.getLong("enemy"), mbEnums.MonsterType.class); this.enemy = mbEnums.fromLong(rs.getLong("enemy"), mbEnums.MonsterType.class);
this.firstName = rs.getString("mob_name"); this.firstName = rs.getString("mob_name");
if (rs.getString("fsm").length() > 1) if (rs.getString("fsm").length() > 1)

9
src/engine/objects/MobBase.java

@ -19,6 +19,7 @@ import engine.server.MBServerStatics;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public class MobBase extends AbstractGameObject { public class MobBase extends AbstractGameObject {
@ -30,8 +31,8 @@ public class MobBase extends AbstractGameObject {
public final ArrayList<MobBaseEffects> effectsList; public final ArrayList<MobBaseEffects> effectsList;
public int bootySet; public int bootySet;
public mbEnums.MobBehaviourType fsm; public mbEnums.MobBehaviourType fsm;
public EnumBitSet<mbEnums.MonsterType> notEnemy; public EnumSet<mbEnums.MonsterType> notEnemy;
public EnumBitSet<mbEnums.MonsterType> enemy; public EnumSet<mbEnums.MonsterType> enemy;
private float healthMax; private float healthMax;
private int attackRating; private int attackRating;
private int defenseRating; private int defenseRating;
@ -77,8 +78,8 @@ public class MobBase extends AbstractGameObject {
this.fsm = mbEnums.MobBehaviourType.valueOf(rs.getString("fsm")); this.fsm = mbEnums.MobBehaviourType.valueOf(rs.getString("fsm"));
this.flags = EnumBitSet.asEnumBitSet(rs.getLong("flags"), mbEnums.MobFlagType.class); this.flags = EnumBitSet.asEnumBitSet(rs.getLong("flags"), mbEnums.MobFlagType.class);
this.notEnemy = EnumBitSet.asEnumBitSet(rs.getLong("notEnemy"), mbEnums.MonsterType.class); this.notEnemy = mbEnums.fromLong(rs.getLong("notEnemy"), mbEnums.MonsterType.class);
this.enemy = EnumBitSet.asEnumBitSet(rs.getLong("enemy"), mbEnums.MonsterType.class); this.enemy = mbEnums.fromLong(rs.getLong("enemy"), mbEnums.MonsterType.class);
this.seeInvis = rs.getInt("seeInvis"); this.seeInvis = rs.getInt("seeInvis");
this.scale = rs.getFloat("scale"); this.scale = rs.getFloat("scale");

Loading…
Cancel
Save