From f832a84343c6c506afaabb18605d6c7418ff4fae Mon Sep 17 00:00:00 2001 From: Samantha Sullivan Date: Sun, 10 Sep 2023 13:30:49 +1000 Subject: [PATCH] will only activate shoot task if target is attackable --- .../com/csse3200/game/components/tasks/MobAttackTask.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java b/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java index 703fccf29..4d7ac4690 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java @@ -180,7 +180,7 @@ public int getPriority() { * @return (int) active priority if a target is visible, -1 otherwise */ private int getActivePriority() { - if ((startTime + delay) < timeSource.getTime() && isTargetVisible()) { + if ((startTime + delay) < timeSource.getTime() && isTargetVisible() && this.meleeOrProjectile() != null) { return priority; } return -1; @@ -191,7 +191,7 @@ private int getActivePriority() { * @return (int) -1 if a target is not visible, active priority otherwise */ private int getInactivePriority() { - if ((startTime + delay) < timeSource.getTime() && isTargetVisible()) { + if ((startTime + delay) < timeSource.getTime() && isTargetVisible() && this.meleeOrProjectile() != null) { return priority; } return -1;