if(n.getX() == p.getX()) {
/* Same column */
if(n.getY() > p.getY()) {
/* NPC is above the player */
if(n.getFacing() == Direction.Up && n.canSee(p)) {
NpcBattleLauncher l = new NpcBattleLauncher(n, p);
l.start();
return true;
}
} else {
/* NPC is below the player */
if(n.getFacing() == Direction.Down && n.canSee(p)) {
NpcBattleLauncher l = new NpcBattleLauncher(n, p);
l.start();
return true;
}
}
} else if(n.getY() == p.getY()) {
/* Same row */
if(n.getX() > p.getX()) {
/* NPC is right of the player */
if(n.getFacing() == Direction.Left && n.canSee(p)) {
NpcBattleLauncher l = new NpcBattleLauncher(n, p);
l.start();
return true;
}
} else {
/* NPC is left of the player */
if(n.getFacing() == Direction.Right && n.canSee(p)) {
NpcBattleLauncher l = new NpcBattleLauncher(n, p);
l.start();
return true;
}
}
}
}