From b32705ce56c2b4897c1aacbeb8aea1e06a79ac55 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 30 Jun 2023 20:33:41 -0500 Subject: [PATCH 1/2] mob casting will now check for and properly check against hit roll requirements --- src/engine/ai/MobileFSM.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index d4d2f6f7..b57d909b 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -233,6 +233,7 @@ public class MobileFSM { // Method picks a random spell from a mobile's list of powers // and casts it on the current target (or itself). Validation // (including empty lists) is done previously within canCast(); + ArrayList powerTokens; ArrayList purgeTokens; PlayerCharacter target = (PlayerCharacter) mob.getCombatTarget(); @@ -259,6 +260,21 @@ public class MobileFSM { int powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size())); int powerRank = mob.mobPowers.get(powerToken); PowersBase mobPower = PowersManager.getPowerByToken(powerToken); + //check for hit-roll + if(mobPower.requiresHitRoll) { + if (CombatUtilities.triggerDefense(mob, mob.getCombatTarget())) { + return false; + } + if (CombatUtilities.triggerDodge(mob, mob.getCombatTarget())) { + return false; + } + if (CombatUtilities.triggerBlock(mob, mob.getCombatTarget())) { + return false; + } + if (CombatUtilities.triggerParry(mob, mob.getCombatTarget())) { + return false; + } + } // Cast the spell if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mobPower.getRange())) { PowersManager.useMobPower(mob, (AbstractCharacter) mob.getCombatTarget(), mobPower, powerRank); From 761adca2efe1b76d21e93021b491d5bb3ee5f51c Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 30 Jun 2023 21:02:51 -0500 Subject: [PATCH 2/2] guards no longer recall when player aggro map is empty --- src/engine/ai/MobileFSM.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index b57d909b..34a357ee 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -521,7 +521,7 @@ public class MobileFSM { } if (mob.isPlayerGuard() && !mob.despawned) { City current = ZoneManager.getCityAtLocation(mob.getLoc()); - if (current == null || current.equals(mob.getGuild().getOwnedCity()) == false || mob.playerAgroMap.isEmpty()) { + if (current == null || current.equals(mob.getGuild().getOwnedCity()) == false) { PowersBase recall = PowersManager.getPowerByToken(-1994153779); PowersManager.useMobPower(mob, mob, recall, 40); mob.setCombatTarget(null);