Files
Dune/game/homeworld-alliance.ts
T
Quintine 28ba1618ba 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.
2026-09-10 08:12:26 +10:00

18 lines
825 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { homeworldForceGroups, type HomeworldCustody, type HomeworldCustodyContext } from './homeworld-custody';
/** E3 alliance restriction uses present foreign forces, independently of any
* saved turn entitlement to an occupied card's benefits. */
export function homeworldAllianceBlock(
context: HomeworldCustodyContext,
custody: HomeworldCustody,
first: string,
second: string,
): string | null {
const occupied = homeworldForceGroups(context, custody).some((world) => {
const visitor = world.native === first ? second : world.native === second ? first : null;
const forces = visitor ? world.forces[visitor] : undefined;
return !!forces && forces.normal + forces.elite > 0;
});
return occupied ? 'An alliance cannot form while either faction has forces on the other’s Homeworld.' : null;
}