[PR #1741] [MERGED] feat(gacha-forge): Back Row steps up when a Front Row unit falls (1.24.5) #1946

Closed
opened 2026-11-07 16:38:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/1741
Author: @SpicyMarinara
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/gacha-forge-formation-step-up


📝 Commits (3)

  • de52cb6 feat(gacha-forge): Back Row steps up when a Front Row unit falls (1.24.5)
  • ef053ca fix(gacha-forge): keep step-up seats through shuffles; barrier-aware heirs (1.24.5)
  • 48a952c test(gacha-forge): expect the stepped-up Caster in the Formation plan proof

📊 Changes

22 files changed (+860 additions, -122 deletions)

View changed files

➕ artifacts/gacha-forge-1.24.5.zip (+0 -0)
📝 catalog/catalog.json (+16 -16)
📝 catalog/notes.json (+6 -6)
📝 catalog/v2/catalog.json (+16 -16)
📝 catalog/v2/notes.json (+6 -6)
📝 catalog/v3/catalog.json (+16 -16)
📝 catalog/v3/notes.json (+6 -6)
📝 packages/gacha-forge/CHANGELOG.md (+4 -0)
📝 packages/gacha-forge/README.md (+1 -1)
📝 packages/gacha-forge/bundle-patches.json (+28 -0)
📝 packages/gacha-forge/client.js (+82 -8)
📝 packages/gacha-forge/docs/formation-combat.md (+3 -3)
📝 packages/gacha-forge/manifest.json (+13 -13)
📝 packages/gacha-forge/server.mjs (+65 -10)
📝 packages/gacha-forge/src/formation-combat-client.mjs (+19 -0)
📝 packages/gacha-forge/src/formation-combat-en.mjs (+1 -1)
📝 packages/gacha-forge/src/formation-combat-server.mjs (+4 -4)
📝 packages/gacha-forge/src/formation-combat-shared.mjs (+60 -5)
📝 tests/gacha-forge-formation-balance.regression.mjs (+23 -3)
📝 tests/gacha-forge-formation-combat.regression.mjs (+406 -6)

...and 2 more files

📄 Description

Linked issue

Closes #1740

Why this change

In Formation, a battle ended as soon as a side had no living Front Row fighter, even with Back Row supports still alive. Mari reported that when the enemy Front Row dies, the fight stops instead of the enemies in the back moving up to fill the empty spots. Mari chose these rules for the fix:

  • Every empty seat: each time a Front Row unit falls, a Back Row unit on its side takes the seat.
  • Both sides: the player's supports step up just like the enemy's.
  • End of fight: a fight ends only when one side has nobody left.

What changed

  • Engine (src/formation-combat-shared.mjs)
    • When a non-token Front Row unit dies, kill() steps exactly one living support into the free seat. This happens after the death's own on_death/on_kill/ally_death triggers. It goes through the existing enterRow, so the row event lands in the death's own step and enter_front fires.
    • The arriving unit has entered = turn, so it acts from its side's next turn.
    • A revive that refills the seat means no step-up. An Echo token is dismissed when it holds the last seat.
    • The heir is chosen deterministically:
      1. the next unit in the defeat order;
      2. otherwise a support whose Normal or Ultimate deals damage, or that prefers the front;
      3. otherwise the first in seat order.
    • Voluntary moves and retreats never pull a support forward, so solo-front play keeps its choice.
    • collapse() is unchanged. Step-up keeps the front filled while anyone is left. The balance test now asserts that a beaten side has nobody left.
  • Revisions and replay
    • FORGE_FORMATION_RULES goes from 2 to 3, so a tab left open from 1.24.4 is refused at preview/start and asked to reload.
    • FORGE_FORMATION_ENGINE and FORGE_FORMATION_KIT_PROMPT are unchanged. There are no kit remakes and no model calls; the migration suite passes.
    • New fights are stamped formationRevision: 3 in the server snapshot, and the claim replay passes the stamp through.
    • An unstamped fight, one started before this update and claimed after it, replays under the old rule. Without the stamp, an old client's win could be replayed as a loss. On 400 seeded fights, an unstamped replay matches the real 1.24.4 engine exactly.
  • Client (src/formation-combat-client.mjs)
    • The arriving card takes the fallen card's slot, and the fallen card is hidden while dead. A revive brings it back.
    • The Front Row never shows more than three cards.
    • Classic's .no-front FRONT relabel no longer fires in Formation.
  • Text
    • Updated the combat guide, the model rules text for kit and encounter prompts, docs/formation-combat.md and the README.
    • "Back Row units cannot be attacked" is still true and stays.
  • Release: Gacha Forge 1.24.5, with manifest, ledger append, rebuilt bundles, catalog lanes and artifacts/gacha-forge-1.24.5.zip. The 1.24.0–1.24.4 archives are untouched.

Classic combat and formation-combat-legacy.mjs are not changed.

Balance (400 seeded Auto-vs-Auto fights)

Before After
Wins 217 218
Stalls (40-round cap) 1 5 (1.25%, limit under 2%)
Median rounds 9 11
p95 rounds 21 27
Fights ending with the loser still alive 254 0

Fights now continue past the old win point, so the p95 threshold moves from under 25 to under 28. A ponytail: comment cites the rule change and these numbers. The stall and no-hit limits are unchanged.

Validation

  • npm run check: passed.
  • All 65 tests/gacha-forge-*.regression.mjs files passed: 475 tests, 0 failed.
  • Catalog validation, catalog lanes, package locales and the release-notes regression: passed.
  • New regressions:
    • enemy and ally step-up, one per death;
    • the row event in the death's step;
    • entered timing, both on the opponent's turn and for a dot death at the dying side's own turn start;
    • a Back Row ally_death passive firing before the step-up;
    • a revive refilling the seat;
    • an Echo dismissed to free the seat;
    • heir preferences;
    • the fight ending only when nobody is left;
    • the unstamped old rule, and a client run matching the server replay for stamped and unstamped fights;
    • a 1.24.4 tab refused with no remake job written.
  • Turning off the gate, the heir order, the refill check or the entered timing each makes a new test fail.
  • A new browser test, "a support steps into the seat of a fallen fighter", could not run locally because the local Engine checkout does not open Gacha Forge. CI runs it.

Manual verification

  • In a Formation fight, kill an enemy Front Row unit while it has supports. Confirm a support steps into that seat and the fight continues until every enemy is down.
  • Let one of your own Front Row units fall with supports alive. Confirm a support steps up, can be planned on your next turn, and the fight is lost only when your whole team is down.
  • On a phone in portrait and landscape, confirm the Front Row shows at most three cards after a step-up.
  • Confirm the in-game What's-new shows 1.24.5.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Agents/pull/1741 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/gacha-forge-formation-step-up` --- ### 📝 Commits (3) - [`de52cb6`](https://github.com/Pasta-Devs/Marinara-Agents/commit/de52cb69767960bff39b5e1482b556129bcaed75) feat(gacha-forge): Back Row steps up when a Front Row unit falls (1.24.5) - [`ef053ca`](https://github.com/Pasta-Devs/Marinara-Agents/commit/ef053caa6e5cd06fe3e3ec17f1bb10234d6bc933) fix(gacha-forge): keep step-up seats through shuffles; barrier-aware heirs (1.24.5) - [`48a952c`](https://github.com/Pasta-Devs/Marinara-Agents/commit/48a952ca84780c0fc1644c9b1bc5c75aaed6abde) test(gacha-forge): expect the stepped-up Caster in the Formation plan proof ### 📊 Changes **22 files changed** (+860 additions, -122 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/gacha-forge-1.24.5.zip` (+0 -0) 📝 `catalog/catalog.json` (+16 -16) 📝 `catalog/notes.json` (+6 -6) 📝 `catalog/v2/catalog.json` (+16 -16) 📝 `catalog/v2/notes.json` (+6 -6) 📝 `catalog/v3/catalog.json` (+16 -16) 📝 `catalog/v3/notes.json` (+6 -6) 📝 `packages/gacha-forge/CHANGELOG.md` (+4 -0) 📝 `packages/gacha-forge/README.md` (+1 -1) 📝 `packages/gacha-forge/bundle-patches.json` (+28 -0) 📝 `packages/gacha-forge/client.js` (+82 -8) 📝 `packages/gacha-forge/docs/formation-combat.md` (+3 -3) 📝 `packages/gacha-forge/manifest.json` (+13 -13) 📝 `packages/gacha-forge/server.mjs` (+65 -10) 📝 `packages/gacha-forge/src/formation-combat-client.mjs` (+19 -0) 📝 `packages/gacha-forge/src/formation-combat-en.mjs` (+1 -1) 📝 `packages/gacha-forge/src/formation-combat-server.mjs` (+4 -4) 📝 `packages/gacha-forge/src/formation-combat-shared.mjs` (+60 -5) 📝 `tests/gacha-forge-formation-balance.regression.mjs` (+23 -3) 📝 `tests/gacha-forge-formation-combat.regression.mjs` (+406 -6) _...and 2 more files_ </details> ### 📄 Description ## Linked issue Closes #1740 ## Why this change In Formation, a battle ended as soon as a side had no living Front Row fighter, even with Back Row supports still alive. Mari reported that when the enemy Front Row dies, the fight stops instead of the enemies in the back moving up to fill the empty spots. Mari chose these rules for the fix: - **Every empty seat:** each time a Front Row unit falls, a Back Row unit on its side takes the seat. - **Both sides:** the player's supports step up just like the enemy's. - **End of fight:** a fight ends only when one side has nobody left. ## What changed - **Engine** (`src/formation-combat-shared.mjs`) - When a non-token Front Row unit dies, `kill()` steps exactly one living support into the free seat. This happens after the death's own `on_death`/`on_kill`/`ally_death` triggers. It goes through the existing `enterRow`, so the `row` event lands in the death's own step and `enter_front` fires. - The arriving unit has `entered = turn`, so it acts from its side's next turn. - A revive that refills the seat means no step-up. An Echo token is dismissed when it holds the last seat. - The heir is chosen deterministically: 1. the next unit in the defeat order; 2. otherwise a support whose Normal or Ultimate deals damage, or that prefers the front; 3. otherwise the first in seat order. - Voluntary moves and retreats never pull a support forward, so solo-front play keeps its choice. - `collapse()` is unchanged. Step-up keeps the front filled while anyone is left. The balance test now asserts that a beaten side has nobody left. - **Revisions and replay** - `FORGE_FORMATION_RULES` goes from 2 to 3, so a tab left open from 1.24.4 is refused at preview/start and asked to reload. - `FORGE_FORMATION_ENGINE` and `FORGE_FORMATION_KIT_PROMPT` are unchanged. There are no kit remakes and no model calls; the migration suite passes. - New fights are stamped `formationRevision: 3` in the server snapshot, and the claim replay passes the stamp through. - An unstamped fight, one started before this update and claimed after it, replays under the old rule. Without the stamp, an old client's win could be replayed as a loss. On 400 seeded fights, an unstamped replay matches the real 1.24.4 engine exactly. - **Client** (`src/formation-combat-client.mjs`) - The arriving card takes the fallen card's slot, and the fallen card is hidden while dead. A revive brings it back. - The Front Row never shows more than three cards. - Classic's `.no-front` FRONT relabel no longer fires in Formation. - **Text** - Updated the combat guide, the model rules text for kit and encounter prompts, `docs/formation-combat.md` and the README. - "Back Row units cannot be attacked" is still true and stays. - **Release:** Gacha Forge 1.24.5, with manifest, ledger append, rebuilt bundles, catalog lanes and `artifacts/gacha-forge-1.24.5.zip`. The 1.24.0–1.24.4 archives are untouched. Classic combat and `formation-combat-legacy.mjs` are not changed. ## Balance (400 seeded Auto-vs-Auto fights) | | Before | After | |---|---|---| | Wins | 217 | 218 | | Stalls (40-round cap) | 1 | 5 (1.25%, limit under 2%) | | Median rounds | 9 | 11 | | p95 rounds | 21 | 27 | | Fights ending with the loser still alive | 254 | 0 | Fights now continue past the old win point, so the p95 threshold moves from under 25 to under 28. A `ponytail:` comment cites the rule change and these numbers. The stall and no-hit limits are unchanged. ## Validation - `npm run check`: passed. - All 65 `tests/gacha-forge-*.regression.mjs` files passed: 475 tests, 0 failed. - Catalog validation, catalog lanes, package locales and the release-notes regression: passed. - **New regressions:** - enemy and ally step-up, one per death; - the row event in the death's step; - `entered` timing, both on the opponent's turn and for a dot death at the dying side's own turn start; - a Back Row `ally_death` passive firing before the step-up; - a revive refilling the seat; - an Echo dismissed to free the seat; - heir preferences; - the fight ending only when nobody is left; - the unstamped old rule, and a client run matching the server replay for stamped and unstamped fights; - a 1.24.4 tab refused with no remake job written. - Turning off the gate, the heir order, the refill check or the `entered` timing each makes a new test fail. - A new browser test, "a support steps into the seat of a fallen fighter", could not run locally because the local Engine checkout does not open Gacha Forge. CI runs it. ### Manual verification - [ ] In a Formation fight, kill an enemy Front Row unit while it has supports. Confirm a support steps into that seat and the fight continues until every enemy is down. - [ ] Let one of your own Front Row units fall with supports alive. Confirm a support steps up, can be planned on your next turn, and the fight is lost only when your whole team is down. - [ ] On a phone in portrait and landscape, confirm the Front Row shows at most three cards after a step-up. - [ ] Confirm the in-game What's-new shows 1.24.5. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:38:14 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Agents#1946
No description provided.