diff --git a/src/engine/jobs/AttackJob.java b/src/engine/jobs/AttackJob.java index 02c3d5f0..1ad0475d 100644 --- a/src/engine/jobs/AttackJob.java +++ b/src/engine/jobs/AttackJob.java @@ -9,9 +9,11 @@ package engine.jobs; +import engine.Enum; import engine.gameManager.CombatManager; import engine.job.AbstractJob; import engine.objects.AbstractCharacter; +import engine.objects.PlayerCharacter; public class AttackJob extends AbstractJob { @@ -28,6 +30,16 @@ public class AttackJob extends AbstractJob { @Override public void doJob() { + + if(this.source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){ + PlayerCharacter pc = (PlayerCharacter)source; + if(pc.combatTarget != null && pc.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){ + PlayerCharacter target = (PlayerCharacter)pc.combatTarget; + if(!pc.canSee(target)) { + return; + } + } + } CombatManager.doCombat(this.source, slot); }