Browse Source

Need to preserver order of hashmap insertion.

master
MagicBot 1 year ago
parent
commit
9f0fb26e1f
  1. 4
      src/engine/mobileAI/MobAI.java
  2. 3
      src/engine/objects/Mob.java

4
src/engine/mobileAI/MobAI.java

@ -474,6 +474,7 @@ public class MobAI { @@ -474,6 +474,7 @@ public class MobAI {
if (powerTokens.isEmpty())
return false;
int powerToken = 0;
int nukeRoll = ThreadLocalRandom.current().nextInt(1,100);
@ -488,6 +489,7 @@ public class MobAI { @@ -488,6 +489,7 @@ public class MobAI {
}
int powerRank = 1;
switch(mob.getRank()){
case 1:
powerRank = 10;
@ -511,6 +513,7 @@ public class MobAI { @@ -511,6 +513,7 @@ public class MobAI {
powerRank = 40;
break;
}
PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
//check for hit-roll
@ -542,6 +545,7 @@ public class MobAI { @@ -542,6 +545,7 @@ public class MobAI {
msg.setUnknown04(2);
PowersManager.finishUseMobPower(msg, mob, 0, 0);
long randomCooldown = (long)((ThreadLocalRandom.current().nextInt(10,15) * 1000) * MobAIThread.AI_CAST_FREQUENCY);
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
return true;

3
src/engine/objects/Mob.java

@ -39,6 +39,7 @@ import java.sql.SQLException; @@ -39,6 +39,7 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@ -61,7 +62,7 @@ public class Mob extends AbstractIntelligenceAgent { @@ -61,7 +62,7 @@ public class Mob extends AbstractIntelligenceAgent {
public boolean despawned = false;
public Vector3fImmutable destination = Vector3fImmutable.ZERO;
public Vector3fImmutable localLoc = Vector3fImmutable.ZERO;
public HashMap<Integer, Integer> mobPowers = new HashMap<>();
public LinkedHashMap<Integer, Integer> mobPowers = new LinkedHashMap<>();
public MobBase mobBase;
public int spawnTime;
public Zone parentZone;

Loading…
Cancel
Save