From f95913b6d814f9da2d4e45fe183461c2ba43d61c Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Sat, 12 Dec 2020 20:24:28 -0700 Subject: [PATCH] Teeth chase the player's apparent position --- js/tiletypes.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/js/tiletypes.js b/js/tiletypes.js index 69767d4..4a5dc3f 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -93,17 +93,12 @@ function player_visual_state(me) { // Logic for chasing after the player (or running away); shared by both teeth and mimics function pursue_player(me, level) { let player = level.player; - let target_cell = player.cell; - // CC2 behavior (not Lynx (TODO compat?)): pursue the cell the player is leaving, if - // they're still mostly in it - if (player.previous_cell && player.movement_speed && - player.movement_cooldown >= player.movement_speed / 2) - { - target_cell = player.previous_cell; - } + // CC2 behavior (not Lynx (TODO compat?)): pursue the player's apparent position, not just the + // cell they're in + let [px, py] = player.visual_position(); - let dx = me.cell.x - target_cell.x; - let dy = me.cell.y - target_cell.y; + let dx = me.cell.x - px; + let dy = me.cell.y - py; let preferred_horizontal, preferred_vertical; if (dx > 0) { preferred_horizontal = 'west';