Browse Source

players will not auto attack others in stealth anymore

lakebane-recovery
FatBoy-DOTC 4 days ago
parent
commit
3d50093e86
  1. 12
      src/engine/jobs/AttackJob.java

12
src/engine/jobs/AttackJob.java

@ -9,9 +9,11 @@
package engine.jobs; package engine.jobs;
import engine.Enum;
import engine.gameManager.CombatManager; import engine.gameManager.CombatManager;
import engine.job.AbstractJob; import engine.job.AbstractJob;
import engine.objects.AbstractCharacter; import engine.objects.AbstractCharacter;
import engine.objects.PlayerCharacter;
public class AttackJob extends AbstractJob { public class AttackJob extends AbstractJob {
@ -28,6 +30,16 @@ public class AttackJob extends AbstractJob {
@Override @Override
public void doJob() { 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); CombatManager.doCombat(this.source, slot);
} }

Loading…
Cancel
Save