mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6873] [MERGED] Game Mode: ammunition and reloading for weapons in ruleset fights #7363
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7363
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6873
Author: @kolacheee
Created: 9/29/2026
Status: ✅ Merged
Merged: 9/29/2026
Merged by: @kolacheee
Base:
staging← Head:feat/ruleset-items-ammo📝 Commits (2)
f1f00affeat(rulesets): ammunition and reloading for weapons in ruleset fights (#6871)78549f9fix(rulesets): an empty weapon strikes nobody in passing, and a fight writes only to its own bag (#6871)📊 Changes
34 files changed (+1943 additions, -35 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
docs/development/game-rulesets-and-sheets-implementation.md(+52 -0)📝
docs/examples/rulesets/ember-roads.json(+9 -2)📝
docs/examples/rulesets/gravewatch.json(+36 -2)📝
docs/extending/ruleset.schema.json(+65 -0)📝
docs/extending/writing-rulesets.md(+24 -5)➕
e2e/game-ruleset-ammo.e2e.ts(+316 -0)📝
packages/client/src/components/game/GameInventory.tsx(+22 -2)📝
packages/client/src/components/game/RulesetItemPicker.tsx(+11 -1)📝
packages/client/src/lib/ruleset-combat-log.ts(+21 -0)📝
packages/client/src/lib/ruleset-combat-menu.ts(+20 -1)📝
packages/client/src/localization/locales/en.json(+14 -0)📝
packages/server/src/routes/combat-director.routes.ts(+14 -0)📝
packages/server/src/services/capability-packages/package-manager.service.ts(+16 -0)➕
packages/shared/src/features/ruleset-combat/ammo.ts(+205 -0)📝
packages/shared/src/features/ruleset-combat/encounter.ts(+24 -0)📝
packages/shared/src/features/ruleset-combat/grid.ts(+3 -0)📝
packages/shared/src/features/ruleset-combat/index.ts(+7 -0)📝
packages/shared/src/features/ruleset-combat/options.ts(+5 -0)📝
packages/shared/src/features/ruleset-combat/resolve.ts(+13 -0)...and 14 more files
📄 Description
Linked issue
Closes #6871
Why this change
What changed
attackmay haveammo: one of the ruleset's item tags,perAttack(1 by default) andrecover(a share from 0 to 1). Each attack takes that many of the items with the tag its holder carries, first stack first, and the weapon is offered only while they carry enough. After a fight the party wins,recoverof what each of them shot comes back to the stack it came from, added up over the fight and rounded down once for each stack; a lost or fled fight gives nothing back.clip(max, written down or read off a number stat of the item, andreload, a budget). Attacks spend what is loaded, and a Reload option on the fight menu spendsreloadand fills it, out of the bag where the weapon hasammo, in full where it has none. The count is kept on the weapon's inventory stack (a stack of one item only), so a pistol emptied in one fight is still empty in the next; a weapon nobody has fired yet is loaded.recoverbeside a clip (refused: loaded rounds are not picked up), and an attack that would shoot more than its clip holds. A ruleset with no combat block reads none of it. The install gate asks for 1.57 in the ruleset file and in catalog files.3 to shootor0 of 1 loaded, a Reload group names the weapon (Reload Watch pistol, with3 to load), and the log says every shot, reload and pickup ("Hunting bow: 1 left to shoot.", "Ada loads 1 into Watch pistol: 1 of 1 loaded.", "Juno picks up 1 of their Arrows after the fight."). The item's details sayAmmunition: Arrow, 1 an attack, 50% picked up after a won fightandHolds 1, reload (Act), and a weapon's details say what it has loaded; the Game Master's inventory line ends withammunition Arrow (1 an attack, 50% picked up after a won fight)orholds 1, reload (Act). The combat AI weighs a reload as any action that targets nobody, and since an empty weapon is off the menu, a party member the Engine plays reloads it and then fires it.arrowtag and its hunting bow shoots them, half picked up. Gravewatch gains ashottag, apowdercategory, a watch pistol (a clip of one, reloaded with the act) and shot and powder.docs/extending/writing-rulesets.md(whose line saying ammunition and reloading come later is corrected), the 1.57 record indocs/development/game-rulesets-and-sheets-implementation.md, the regenerated JSON schema and a CHANGELOG entry.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Run by the agent on this branch at
f1f00afd7(one commit on staging82d8d68f2):pnpm checkexits 0,pnpm localization:checkexits 0,pnpm regressionpasses 466/466, andpnpm smoke:uipasses 7/7.--project=desktop-chromium, the ruleset, inventory, game dice and combat director specs (e2e/game-ruleset-*.e2e.ts,e2e/ruleset-*.e2e.ts,e2e/game-inventory-*.e2e.ts,e2e/game-native-dice.e2e.ts,e2e/game-one-request-dice.e2e.ts,e2e/game-combat-director.e2e.ts) pass 29/29, and the game ruleset specs pass 10/10 on--project=mobile-chromium.e2e/game-ruleset-ammo.e2e.tswere run again and pass.Lanes:
game-ruleset-ammo.regression.ts: every import refusal and the lenient no-combat case; the 1.57 gate (the ammunition and a clip on its own, and a catalog file); shooting from one stack and from two, more than one an attack, an empty weapon off the menu and refused as "insufficient"; recovery after a won fight (rounded down once for each stack, so six tenths of one arrow is none) and none after a lost one; a clip spent, reloaded out of the bag or for free, filled with less than it holds when the bag runs short, what the stack kept read at the start, and a clip read off a stat the item does not give; the write-back by stack id (the player's bag and a companion's, removal at none, a stack made again, a gone or short stack or another item under its id refused, a pistol's loaded count); the loaded count kept only on a stack of one and forgotten when stacks are poured together; item facts and the Game Master's line; a bow the Game Master invents with nothing to start from fighting as the hunting bow, arrows and all, and one made like the pistol keeping its clip; and an AI-played party member with an empty pistol reloading and then firing, through the real director.ruleset-combat-screen-client.regression.ts: the three new log lines, the Reload label, the menu's cost text and the new menu group.e2e/game-ruleset-ammo.e2e.ts: in Ember Roads, the bow's details say what it shoots, a ruleset fight offers it with3 to shoot, a shot of two drops the moth, and the saved inventory holds 2 arrows afterwards (two shot, one picked up); in Gravewatch, the emptied pistol's details say0 of 1 loaded, it is off the fight menu,Reload Watch pistolsays0 of 1 loaded · 3 to load, and reloading leaves the saved pistol loaded and one less shot and powder.Sixty-one deliberate breaks, across the import checks, the gate, building the actions, counting shots and loads, recovery, the write-back, the menu, the stacks, the facts and the client's lines, were each caught: 60 by the lanes, and removing the director's inventory write by
e2e/game-ruleset-ammo.e2e.ts.Local CodeRabbit (
coderabbit review --agent --base staging): three passes. Fixed: the write-back now refuses a stack that holds another item under the fight's stack id (with a lane case), and the author guide says recovery is rounded down once for each stack rather than once for the fight. Declined: changing "1 an attack" to "1 per attack" in the item details (raised in all three passes; the wording is correct as it is), and writing a stack's loaded count only on a stack of one at write time (only a worn weapon has a clip in a fight, a worn stack is always one item, and reading the inventory already drops a count on a larger stack).GitHub CodeRabbit, first review: fixed in
78549f91a, a strike at somebody walking away is no longer made with an empty weapon (rulesetOpportunityAttackkeeps its own availability check and now asks about shots), and the write-back refuses a stack that is now in another party member's bag under the same id; both with lane cases and caught deliberate breaks. Declined: the "per attack" wording and the write-time loaded check, for the reasons above. After that commit,pnpm regressionpassed 466/466 again ande2e/game-ruleset-ammo.e2e.tspasses.No Game Master turn was run on a local model for this slice: the only thing the model sees differently is the weapon's line in the inventory, and what an invented weapon gets is pinned by the lane above.
Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Docs touched:
docs/extending/writing-rulesets.mdanddocs/development/game-rulesets-and-sheets-implementation.md(both carried bydocs-i18n),CHANGELOG.md, the generateddocs/extending/ruleset.schema.jsonand the two example rulesets. Translations: #6813 is the items arc's follow-up; this PR is added to it there.UI evidence (if applicable)
In an Ember Roads game where Juno holds a hunting bow, its details read "Ammunition: Arrow, 2 an attack, 50% picked up after a won fight" (the e2e's bow shoots two), and in a Gravewatch fight Ada's emptied watch pistol offers "Reload Watch pistol · Spends Act · 0 of 1 loaded · 3 to load", and reloading logs "Ada loads 1 into Watch pistol: 1 of 1 loaded." (captured by
e2e/game-ruleset-ammo.e2e.tsasruleset-ammo-details.png,ruleset-ammo-shot.png,ruleset-ammo-empty.pngandruleset-ammo-reload.png).Summary by CodeRabbit
New Features
Documentation
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.