Browse Source

Conditionals simplified and comment added to method.

master
MagicBot 2 years ago
parent
commit
177175cc1d
  1. 22
      src/engine/ai/MobileFSM.java

22
src/engine/ai/MobileFSM.java

@ -1627,20 +1627,22 @@ public class MobileFSM {
MovementUtilities.moveToLocation(aiAgent, aiAgent.getCombatTarget().getLoc(), aiAgent.getRange()); MovementUtilities.moveToLocation(aiAgent, aiAgent.getCombatTarget().getLoc(), aiAgent.getRange());
} }
public static boolean canCast(Mob mob) { public static boolean canCast(Mob mob) {
if(mob == null){
// Performs validation to determine if a
// mobile in the proper state to cast.
if(mob == null)
return false; return false;
}
if(mob.mobPowers.isEmpty() == true){ if(mob.mobPowers.isEmpty())
return false; return false;
}
if(mob.nextCastTime == 0){ if(mob.nextCastTime == 0)
mob.nextCastTime = System.currentTimeMillis(); mob.nextCastTime = System.currentTimeMillis();
}
if (mob.nextCastTime > System.currentTimeMillis()) { return mob.nextCastTime <= System.currentTimeMillis();
return false;
}
return true;
} }
public static boolean MobCast(Mob mob) { public static boolean MobCast(Mob mob) {
// Method picks a random spell from a mobile's list of powers // Method picks a random spell from a mobile's list of powers

Loading…
Cancel
Save