From 177175cc1dae9ff5ee6f3221dee8d2b4d8dc108f Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 15 Mar 2023 11:59:41 -0400 Subject: [PATCH] Conditionals simplified and comment added to method. --- src/engine/ai/MobileFSM.java | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index 8952bdc4..274a6276 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -1627,20 +1627,22 @@ public class MobileFSM { MovementUtilities.moveToLocation(aiAgent, aiAgent.getCombatTarget().getLoc(), aiAgent.getRange()); } 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; - } - if(mob.mobPowers.isEmpty() == true){ + + if(mob.mobPowers.isEmpty()) return false; - } - if(mob.nextCastTime == 0){ + + if(mob.nextCastTime == 0) mob.nextCastTime = System.currentTimeMillis(); - } - if (mob.nextCastTime > System.currentTimeMillis()) { - return false; - } - return true; + + return mob.nextCastTime <= System.currentTimeMillis(); } + public static boolean MobCast(Mob mob) { // Method picks a random spell from a mobile's list of powers