From 92ceaed4f0de99ea7af1099df2739a22fcf1a5d4 Mon Sep 17 00:00:00 2001 From: byblik Date: Tue, 25 Aug 2026 04:23:15 +0300 Subject: [PATCH] fix: e interacts from the distance the header promises (#8) view() offers e hablar from two cells away via nearbyNpc(2), but enter() listened with the default range of 1, so pressing e at the advertised distance answered aca no hay nada. Both sides now use the same range. --- lib/game.js | 5 ++++- test/index.js | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/game.js b/lib/game.js index c4402ae..691fe96 100644 --- a/lib/game.js +++ b/lib/game.js @@ -1176,7 +1176,10 @@ class Runa { const action = this.walker.action() if (!action) { - const npc = this.nearbyNpc() + // The map screen header offers `e hablar` from two cells away + // (see view(), nearbyNpc(2)), so pressing `e` must reach the same + // resident from the same distance, or the promise is a lie (#8). + const npc = this.nearbyNpc(2) if (npc) { this.interactNpc(npc) return diff --git a/test/index.js b/test/index.js index 7be3ead..c6a692d 100644 --- a/test/index.js +++ b/test/index.js @@ -1199,4 +1199,21 @@ test('the world boss animates powers with real field damage', (t) => { game.field.player.y = incoming.y game.drain(game.field.boss.touch(game.field.player, game.field.time + 20)) t.is(game.player.hp, life - 6, 'field contact updates the persistent character sheet') +test('e reaches the resident the header promises, two cells away (#8)', (t) => { + const game = new Runa({ presence: false }) + startGame(game) + + // The residents sit far apart, so a spot exactly two cells away belongs to + // this one NPC alone. That is the distance from which view() advertises + // `e hablar` in the header. + const npc = MAPS.city.npcs[0] + game.walker.placeAt('city', npc.x + 2, npc.y) + + t.is(game.nearbyNpc(2) && game.nearbyNpc(2).name, npc.name, 'the header range spots the resident') + + press(game, 'e') + t.ok( + !game.log.some((line) => String(line).includes('aca no hay nada')), + 'pressing e interacts instead of denying the promised resident' + ) })