From c304a59d95d351e598dae561e8e23d441d182e0c Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 17 Mar 2024 16:17:33 -0500 Subject: [PATCH] See Invis Bug Addressed --- src/engine/mobileAI/MobAI.java | 16 +++++++++++++--- src/engine/objects/PlayerCharacter.java | 4 +++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index f4d47bce..748ca798 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -48,7 +48,12 @@ public class MobAI { mob.setCombatTarget(null); return; } - + if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter){ + if(((PlayerCharacter)target).getHidden() > 0){ + mob.setCombatTarget(null); + return; + } + } if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter && canCast(mob)) { if (mob.isPlayerGuard() == false && MobCast(mob)) { @@ -736,7 +741,7 @@ public class MobAI { //Player is Dead, Mob no longer needs to attempt to aggro. Remove them from aggro map. - if (!loadedPlayer.isAlive()) { + if (!loadedPlayer.isAlive() || loadedPlayer.getHidden() > 0) { loadedPlayers.remove(playerID); continue; } @@ -978,7 +983,12 @@ public class MobAI { private static void chaseTarget(Mob mob) { try { - + if (mob.combatTarget.getObjectType() == Enum.GameObjectType.PlayerCharacter){ + if(((PlayerCharacter)mob.combatTarget).getHidden() > 0){ + mob.setCombatTarget(null); + return; + } + } float rangeSquared = mob.getRange() * mob.getRange(); float distanceSquared = mob.getLoc().distanceSquared2D(mob.getCombatTarget().getLoc()); diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 6687683a..9db242d2 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -3324,7 +3324,9 @@ public class PlayerCharacter extends AbstractCharacter { if (this.equals(tar)) return true; - + if(this.getSeeInvis() >= 20){ + return !tar.safemodeInvis(); + } return this.getSeeInvis() >= tar.hidden && !tar.safemodeInvis(); }