Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Comment on lines 1200 to +1202

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Bug: World-boss test missing closing }) breaks whole suite

The test('the world boss animates powers with real field damage', ...) block opened at line 1120 is never closed: line 1201 ends with a t.is(...) assertion and line 1202 immediately starts the next test(...) with no intervening }). node --check test/index.js fails with SyntaxError: Unexpected end of input, so the file cannot be parsed and no tests in the suite run. Add the missing }) after line 1201 to close the arrow callback and the test( call.

Close the world-boss test callback before the next test declaration.:

  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) => {
  • Apply fix

Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎

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'
)
})
Loading