Made mobs check if they can see the player
This commit is contained in:
@ -42,7 +42,9 @@ class Monster(FightingEntity):
|
||||
# that targets the player.
|
||||
# If they can not move and are already close to the player,
|
||||
# they hit.
|
||||
if target and (self.y, self.x) in target.paths:
|
||||
if target and (self.y, self.x) in target.paths and \
|
||||
self.map.is_visible_from(self.y, self.x,
|
||||
target.y, target.x, 5):
|
||||
# Moves to target player by choosing the best available path
|
||||
for next_y, next_x in target.paths[(self.y, self.x)]:
|
||||
moved = self.check_move(next_y, next_x, True)
|
||||
|
Reference in New Issue
Block a user