N3/P6c: a fight the whole party sits down for

`!fight` seats the expedition's roster instead of the one player who typed
it. Seat 0 is the leader, always: the session row is theirs, the lock is
theirs, and `!flee`, the fork, and `!extract` stay their call.

A monster that wins initiative now swings before anyone speaks. The session
layer used to park every new fight on a player_turn, which is true of the
hardcoded solo order and a lie about a party's -- the enemy would forfeit
round 1 and nobody would notice. `startPartyCombatSession` rolls the order
and sets the phase from it; `handleFightCmd` settles the round before it
announces, so the opening block narrates the hit rather than quietly
showing its damage.

Members were invisible to two commands that had no business ignoring them:
`!cast` queued a spell for "next combat" while its caster was standing in
one, and `!rest` healed a seated member to full mid boss fight. Both now
resolve through the party.

Nobody leaves without an answer. A downed member's `!fight` opens the
party's fight and tells them why they are not in it. The leader's `!extract`
reaches everyone it drags out of the dungeon, and everyone rolls for what
moved into their house while they were gone.

Supplies burn at 50% x N x 4/5 -- a party eats more than one and less than
N. The ratio is exact: 0.8 as a float truncates a party of three to 119%,
a permanent tax nobody would have found.

Solo is untouched, byte for byte. One seat means one build, one INSERT, no
participant rows, the same RNG draws in the same order -- the combat
characterization golden does not move, and neither does the balance corpus.
This commit is contained in:
prosolis
2026-07-09 23:23:17 -07:00
parent 1928f75c19
commit b333d05443
14 changed files with 806 additions and 68 deletions

View File

@@ -2,6 +2,7 @@ package plugin
import (
"fmt"
"log/slog"
"math/rand/v2"
"strings"
)
@@ -335,6 +336,45 @@ func applyDailyBurn(s ExpeditionSupplies, harshActive, siege bool) (ExpeditionSu
return applyDailyBurnP(s, harshActive, siege, phase5BDailyBurnRatePct)
}
// partyBurnEfficiency is the per-head discount a party gets on rations: three
// people eat 2.4 days' worth per day, not 3. Sharing a fire, a pot and a watch
// rota is worth something, and it is the one place C1 asked for a party to be
// mechanically better off than three solo runs.
//
// It is an exact ratio rather than the literal 0.8 because the rate is truncated
// to an int: float32(50*3) * 0.8 evaluates a hair under 120, and int() would
// round it to 119 — a silent, permanent tax on every party of three.
const (
partyBurnEfficiencyNum = 4
partyBurnEfficiencyDen = 5
)
// applyExpeditionDailyBurn is applyDailyBurn with the roster folded in: a party
// of N burns N × 0.8 days of supplies per day, against a pool that P6b's
// addSupplyPurchase has already grown by everyone's packs.
//
// A solo expedition — every expedition that has ever run, and everything the
// balance corpus measured — resolves to phase5BDailyBurnRatePct exactly, so this
// is a no-op for it down to the float. On a roster read error it burns the solo
// rate: undercharging a party is a bug, starving them on a SQLite hiccup is a
// lost expedition.
func applyExpeditionDailyBurn(e *Expedition, harshActive, siege bool) (ExpeditionSupplies, float32) {
return applyDailyBurnP(e.Supplies, harshActive, siege, expeditionBurnRatePct(e.ID))
}
func expeditionBurnRatePct(expeditionID string) int {
n, err := partySize(expeditionID)
if err != nil {
slog.Warn("expedition: party size read failed, burning at the solo rate",
"expedition", expeditionID, "err", err)
return phase5BDailyBurnRatePct
}
if n <= 1 {
return phase5BDailyBurnRatePct
}
return phase5BDailyBurnRatePct * n * partyBurnEfficiencyNum / partyBurnEfficiencyDen
}
// applyDailyBurnP is the rate-parameterized form used by the Phase 3-B
// sim harness lever sweep. burnRatePct == 0 means "use live" (100%);
// any positive value scales the final per-day burn by that percent