Conditionals simplified and comment added to method.

This commit is contained in:
2023-03-15 11:59:41 -04:00
parent 5ddc40db3b
commit 177175cc1d
+12 -10
View File
@@ -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