-
Notifications
You must be signed in to change notification settings - Fork 3
feat: give the ruins residents and a straight east wall (#10) #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
blippip69
wants to merge
1
commit into
Bitcoindefi:main
Choose a base branch
from
blippip69:feat/dungeon-content
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| const { test } = require('brittle') | ||
| const { Runa } = require('../lib/game.js') | ||
| const M = require('../lib/map.js') | ||
|
|
||
| function press(game, name) { | ||
| return game.onKey({ type: 'key', is: (...keys) => keys.includes(name) }) | ||
| } | ||
|
|
||
| function startGame(game, name = 'Tomas') { | ||
| press(game, 'enter') | ||
| for (const ch of String(name)) { | ||
| game.onKey({ type: 'key', sequence: ch, ctrl: false, meta: false, is: () => false }) | ||
| } | ||
| press(game, 'enter') | ||
| } | ||
|
|
||
| test('the ruins host three residents on walkable ground (#10)', (t) => { | ||
| const npcs = M.MAPS.dungeon.npcs | ||
| t.ok(Array.isArray(npcs) && npcs.length >= 3, 'dungeon defines its own residents') | ||
| for (const n of npcs) { | ||
| t.ok(!M.isSolid(M.MAPS.dungeon, n.x, n.y), `${n.name} stands on open floor at ${n.x},${n.y}`) | ||
| } | ||
| }) | ||
|
|
||
| test('the east wall of the ruins is one straight line now (#10)', (t) => { | ||
| const city = M.MAPS.dungeon | ||
| const w = city.width | ||
| let aligned = true | ||
| for (let y = 0; y < city.height; y++) { | ||
| if (city.rows[y].length !== w || city.rows[y][w - 1] !== '#') aligned = false | ||
| if (!M.isSolid(city, w - 1, y)) aligned = false | ||
| } | ||
| t.is(w, 61, 'normalized to a single declared width') | ||
| t.ok(aligned, 'column 60 is wall on every row - no more jagged mouth') | ||
| }) | ||
|
|
||
| test('talking inside the ruins reaches a resident instead of void (#10)', (t) => { | ||
| const game = new Runa({ presence: false }) | ||
| startGame(game) | ||
|
|
||
| const npc = M.MAPS.dungeon.npcs[0] | ||
| game.walker.placeAt('dungeon', npc.x + 1, npc.y) | ||
| press(game, 'e') | ||
|
|
||
| t.ok( | ||
| !game.log.some((line) => String(line).includes('aca no hay nada')), | ||
| 'the resident answers instead of the void' | ||
| ) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Quality: Row normalization still hides ragged art from the check
.map((row) => (row + '###').slice(0, 60) + '#')forces every dungeon row to exactly 61 chars, sodefineMap()'s rectangularity check can never throw for the dungeon — the same masking behavior the comment criticizes about the oldpadEnd, not a fix for it. It also silently drops the rightmost column of any row longer than 61 (rows here are 62 wide, so their real east-wall column is discarded), and 60-wide rows gain a redundant double wall, leaving the interior right edge jagged by one cell despite the 'straight east wall' claim. Consider fixing the source art to a uniform width and lettingdefineMap()validate it, rather than reshaping rows at load time.Was this helpful? React with 👍 / 👎