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:
1 parent
3be49512f7
commit
28ba1618ba
266 files changed
+47680
-16851
No files matched your search
@@ -3,6 +3,10 @@ import {
|
||||
GuildAmbassadorContinuationError,
|
||||
} from './guild-ambassador-continuation';
|
||||
import type { Game, ResponseWindow } from './engine';
|
||||
import {
|
||||
homeworldMovementForesightBlock,
|
||||
homeworldSpiritualAdvisorAllowance,
|
||||
} from './homeworld-mobility';
|
||||
import {
|
||||
gameTerritories,
|
||||
location,
|
||||
@@ -64,6 +68,11 @@ export type TerminalCancellationContext = Pick<
|
||||
| 'choamCharity'
|
||||
| 'pendingAmbassador'
|
||||
| 'ecazAmbassadors'
|
||||
| 'homeworlds'
|
||||
| 'homeworldRevivalReturn'
|
||||
| 'homeworldRevivalProgress'
|
||||
| 'homeworldVictoryReinforcement'
|
||||
| 'lastBattleContext'
|
||||
>;
|
||||
const positive = (n: unknown): n is number =>
|
||||
Number.isSafeInteger(n) && (n as number) > 0;
|
||||
@@ -212,6 +221,10 @@ export function validateTerminalCancellation(
|
||||
return { kind: response.kind, owner: owner.id, known: false };
|
||||
case 'atreidesSpice':
|
||||
faction('atreides');
|
||||
requireTerminal(
|
||||
!homeworldMovementForesightBlock(g, owner.id),
|
||||
'Low-population Caladan has no Movement foresight opportunity to cancel.',
|
||||
);
|
||||
requireTerminal(
|
||||
g.phase === 5 && Array.isArray(g.spiceDeck) && g.spiceDeck.length > 0,
|
||||
'Canceled spice knowledge needs its existing lookahead opportunity.',
|
||||
@@ -254,6 +267,16 @@ export function validateTerminalCancellation(
|
||||
return { kind: response.kind, owner: owner.id };
|
||||
case 'advisor': {
|
||||
faction('beneGesserit');
|
||||
const destination = splitLocation(
|
||||
response.location ?? 'polar_sink:0',
|
||||
).territory;
|
||||
const advisorAmount = response.amount === undefined ? 1 : response.amount;
|
||||
requireTerminal(
|
||||
positive(advisorAmount) &&
|
||||
advisorAmount <=
|
||||
homeworldSpiritualAdvisorAllowance(g, owner.id, destination),
|
||||
'This spiritual advisor amount is unavailable at the current Homeworld population.',
|
||||
);
|
||||
if (response.advisorResume === 'ambassador') {
|
||||
try {
|
||||
const { order } = validateGuildAmbassadorArrivalContext(
|
||||
|
||||
Reference in new issue
Block a user