Implement Homeworld mechanics through Caladan reinforcement checkpoint

Connect typed Homeworld custody, transport, battle, income, revival and Caladan reinforcement flows with private multiplayer recovery and controls. Preserve the optimized test workflow and keep unfinished rules modes gated. Verified with 3682 offline tests, typecheck, lint, production build and 40 HTTP tests; existing saved games remain unchanged.
This commit is contained in:
Quintine committed 2026-09-10 08:12:26 +10:00
1 parent 3be49512f7
commit 28ba1618ba
266 files changed
+47680 -16851

No files matched your search

+20 -7
View File
@@ -1,4 +1,5 @@
import type { Game, Player } from './engine';
import { homeworldLowBonus } from './homeworld-benefits';
export type Inflation = {
side: 'double' | 'cancel';
@@ -13,14 +14,26 @@ export function charityMultiplier(g: Pick<Game, 'turn' | 'inflation'>) {
return g.inflation.side === 'double' ? 2 : 0;
}
/** Inflation doubles the ordinary amount received, not the wealth threshold. */
export function charityAmount(
g: Pick<Game, 'advanced' | 'turn' | 'inflation'>,
p: Pick<Player, 'spice' | 'faction'>,
) {
const amount =
/** Separate ordinary funding from the Homeworld addition paid by the bank.
* Inflation changes both eligible portions, never the ordinary wealth threshold.
* This quote does not claim, pay, or resolve a Bene Gesserit power response. */
export function charityQuote(
g: Pick<Game, 'advanced' | 'turn' | 'inflation' | 'players' | 'homeworlds'>,
p: Pick<Player, 'id' | 'spice' | 'faction'>,
): { ordinary: number; homeworld: number; total: number } {
const eligible =
g.advanced && p.faction === 'beneGesserit' ? 2 : Math.max(0, 2 - p.spice);
return amount * charityMultiplier(g);
const multiplier = charityMultiplier(g);
const ordinary = eligible * multiplier;
const homeworld = eligible > 0 ? homeworldLowBonus(g, p.id) * multiplier : 0;
return { ordinary, homeworld, total: ordinary + homeworld };
}
export function charityAmount(
g: Pick<Game, 'advanced' | 'turn' | 'inflation' | 'players' | 'homeworlds'>,
p: Pick<Player, 'id' | 'spice' | 'faction'>,
) {
return charityQuote(g, p).total;
}
export function charityPayer(