Skip to content

RPG R4: stacking items, equipment slots, statuses; dungeon-crawl 1.1 - #72

Merged
luoxin9510 merged 5 commits into
mainfrom
rpg-r4-items
Nov 10, 2026
Merged

luoxin9510 merged 5 commits into
mainfrom
rpg-r4-items

Conversation

@luoxin9510

@luoxin9510 luoxin9510 commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

RPG R4 (docs/rpg-engine-prd.md §4.2–4.3): counted items, equipment slots and statuses.

Engine

  • Stacks: stack: true items have a count in <id>_n. give(arrow, 3), take(arrow, 1) (returns how many it took) and inv_count(arrow) take list items as arguments, so a misspelt name is a compile error. An item is in inv while its count is above 0. A character's starting counts are written counts: { arrow: 12 }.
  • Slots: slots: lists the slots and an item names one with slot:. equip(item) swaps out the other item of that slot; unequip(item) takes it off; the worn items are in VAR equipped. A slotted item's modifiers count only while it is equipped. Slots are for the character only for now.
  • Statuses: statuses: (name, desc, modifiers, rest). They are kept in one store, who|id|turns;…, read and written by pure bound EXTERNALs (src/game/statuses.ts). The wrappers are add_status(who, id, turns), has_status, status_turns, clear_status, tick_statuses, rest_statuses. who is an entity or member id, or "me" for the character. Without the engine nothing takes hold. The character's own statuses add their modifiers.
  • Problems: itemSlot, statusSkill, countItem. The new ink names are reserved only when the game uses them.

Display and checks

  • Panel: stack counts (×n), worn items marked ◆, statuses as tags on the character row, party cards and entity cards. The web page shows the same in its status lines.
  • check-ink --random reports each stack's count at the end and how often each status was put on.
  • Coverage no longer reports generated functions a story never calls (e.g. unequip).

dungeon-crawl 1.1

  • Arrows: a ranged hero spends one per shot and strikes at -2 without one.
  • Cave spiders and ghouls poison the heroes they wound: 3 turns, -1 life a turn. Shrines and potions cure it.
  • Fixed-strategy bot: 63% wins (68% before).

Verified in Obsidian

  • The plugin build in the vault matches this branch: same length as a local build.
  • In the 10.4 example the panel shows "匕首 ◆ 长矛 解毒剂 ×2" and a "祝福 2" status tag with its turns in the tooltip. The might check counted only the equipped spear.
  • dev:errors is clean.
  • Vault content added: tutorial 10.4 and its example (api.simulate 200 runs, no errors). The 10.3 example's engine was regenerated on pack 1.1 (200 runs, no errors). 目录 and the vault CLAUDE.md are updated.
  • Also fixed after review: despawn, or a remove stat taking an entity out, now clears its statuses.

Tests: 591 pass; lint is clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_015vdVgYTb9jm7MRdePSgs8B

luoxin9510 and others added 4 commits November 10, 2026 19:49
Items with stack: true have a count (<id>_n): give(item, n), take(item, n)
(gives back how many it took), inv_count(item); the item is in the inventory
while its count is above 0. A character's counts: set starting counts.
slots: and an item's slot: make equip(item)/unequip(item) on the equipped
list; such an item's modifiers count only while equipped. statuses: (name,
desc, modifiers, rest) are kept in one store (src/game/statuses.ts, pure)
read and written by bound EXTERNALs: add_status(who, id, turns),
has_status, status_turns, clear_status, tick_statuses, rest_statuses; who is
an entity or member id, or "me". The HUD shows counts, what is worn and
each one's statuses; the character's own statuses add their modifiers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vdVgYTb9jm7MRdePSgs8B
…eon-crawl 1.1

Panel: a stack's count (×n), a worn item marked (◆, its slot in the tooltip),
statuses as tags on the character's row, party cards and entity cards. The web
page writes the same in its status lines. Random runs (check-ink --random,
api.simulate) spread each stack's count at the end like a resource and count
how often each status was put on and in how many runs.

dungeon-crawl 1.1: arrows (a ranged hero spends one a shot, -2 without),
venomous foes (cave spiders, ghouls) poison whom they wound for 3 turns
(-1 life a turn); a battle round and a room are each a turn; a shrine and a
potion cure poison. Fixed-strategy bot: 63% wins (was 68%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vdVgYTb9jm7MRdePSgs8B
A generated function the story never calls (unequip, say) was reported as a
place never reached.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vdVgYTb9jm7MRdePSgs8B
@claude

claude Bot commented Nov 10, 2026

Copy link
Copy Markdown

Review (read the status/stack/slot code, i18n and config validation; I did not run the tests or lint or check the pack balance numbers).

No blocking problems found. The new problem codes (itemSlot, statusSkill, countItem) have both zh and en strings. The status functions are pure and bound lookahead-safe. I saw no Node APIs or innerHTML in src/.

Minor:

  • despawn doesn't appear to clear the entity's rows in the status store. Ids are never reused, so this is harmless apart from the store growing and tick_statuses keeping dead entries. A clear_status(id, "") inside despawn would fix it.
  • The PR body says the Obsidian/vault verification is not done. CLAUDE.md asks for a screenshot and dev:errors check on UI wiring (status.ts) before merge.

I would merge once CI is green and the vault check is done.

despawn, and set_stat when the kind's remove stat takes the entity out, clear
its statuses (only in games with statuses), so the store does not keep the
dead. Review follow-up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vdVgYTb9jm7MRdePSgs8B
@claude

claude Bot commented Nov 10, 2026

Copy link
Copy Markdown

Review of RPG R4 (stacks, slots, statuses). I read the source diff; I did not run the tests or lint.

I found no blocking bugs. The status store functions are pure and bound lookahead-safe, and the config problems and UI strings all have zh and en. src/game/statuses.ts has its own tests.

Two minor points, neither blocking:

  • take() removes an item from the inventory when its count reaches 0, but leaves it in equipped. If the stack is given again, it counts as worn without equip() being called. take could also -= it from equipped.
  • collectModifiers and hud().statuses identify the character by the reserved who-id me (zh 我). A party member or entity template with that id would share the character's statuses. validateConfig doesn't check for this, because self is in the unused set. It may be worth reserving the name or reporting a duplicate.

I would merge as is, provided CI passes.

@luoxin9510
luoxin9510 merged commit f087511 into main Nov 10, 2026
2 checks passed
@luoxin9510
luoxin9510 deleted the rpg-r4-items branch November 10, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant