0.2.6-dev: port PR #552 by IceCodeNew — an optional 「弹药数量」 setting (default off: the official HUD has no such number, the maintainer's decision of 2026-10-13) shows an ammo skill's rounds left / magazine under its bar, from the exact b.snap ammo counts; sanitised with the other settings, applied by the field view live, all four language packs, the diagnostics line; the simplified board has no ammo bar; DESIGN §31.9; golden: unchanged

This commit is contained in:
sganggs committed 2026-10-13 04:43:39 +08:00
1 parent 231da0efbc
commit 461a7747e1
16 files changed
+244 -17

No files matched your search

+28
View File
@@ -176,3 +176,31 @@ the files, the limiter keys, volume and mute), `test/render/playtest6-promote.te
check `test/ui/deploy-replay.e2e.test.js` (`SP_E2E=1`, mock harness: SETTLE → 回合开始 replays the board in deployment order
about 50 ms apart with one sound each, once per round and again the next round; in the 休整期 a purchase lands, a move
within its Start sounds nothing more, a later move lands, a turn in place does not). Golden: unchanged (client only).
### 31.9 Optional ammo count (PR #552)
PR #552 by @IceCodeNew.
**Seen.** While an ammo skill runs, the SP bar is the yellow magazine (one cell per round, 0.2.2) with no number. A
magazine whose cells are under 2 px draws no cuts between them (`AMMO_BAR.minCell`), so a large one (240 rounds) cannot be
counted. The PR draws `remaining/capacity` under the bar.
**Decision.** The official client shows no such number. The maintainer's decision of 2026-10-13: an optional setting, off
by default, like 「官方伤害数字」 (§30.20).
**Now.** 设置 →「弹药数量」 (`ammoCount`) is sanitised with the other settings: a missing or non-boolean saved value is off.
Its hint says the official interface has no such number. The field view takes the value at creation and live
(`setSettings`). `UnitView._updateAmmoCount` draws `left/magazine` from the exact b.snap `ammo` counts (拉特兰's extra
rounds and refills included), centred under the ammo bar in its yellow at 10–16 px by the zoom, and moves the rows under
the bars (狼影 pips, the purse, the element gauge) down by its height. It hides with the magazine (the skill's end, an
older snapshot without the row), in the prep view, after death and for enemies; while the option is off nothing is built.
The simplified 2D board has no ammo bar (its SP bar reads the tuple's SP), so it shows no count. The diagnostics' settings
line names `ammo count` when it is on. Display only: the sim, the protocol and the data are unchanged. The PR's last commit
inlined the readout into `_updateHud`; here it is a method like the purse's (`_updateCoins`), behind the setting.
**[ASSUMED]** Nothing new: the font, size and place are the PR's.
**Tests.** `test/render/hud-readouts.test.js` (off: nothing drawn and the rows below unmoved; on: the exact count through
spending, refills, capacity changes and dense magazines, hidden at the skill's end, in the prep view, after death and for
enemies, the live toggle), `test/ui/ammo-count.test.js` (normalisation, the toggle and its hint in every language pack, the
view's live setting, the diagnostics line), `test/ui/gameLogic.test.js` (sanitizeSettings). Golden: unchanged.