Files
Dune/game/kwisatz-display.ts
T
Quintine 66c41b2af5 Add Kwisatz Haderach component inspection
Connect an original companion face and enlarged rules to the private Atreides panel and battle composer, authorized full-plan inspection, public revealed plans and an internal reference topic. Private loss progress and availability come only from the existing owner projection; plan components receive only inclusion. Rules calculations, save shape, AI strategy and mode gates remain unchanged.

Add focused projection, sealed/revealed rendering, JSON restoration, private-status and asset regressions. All 4950 offline tests, types, lint and production build pass. Independent privacy/rules review found no material findings. Browser checks verify reference opening, loaded artwork, Escape/Close focus return, mobile bounds and keyboard scrolling to the final rule. The focusable scroll region has a documented narrow lint exception. Earlier image-convention and focusability lint failures are retained in private evidence. HTTP tests are unnecessary for this presentation-only change.

All 1373 rooms, 2883 seats and original auxiliary rows remain unchanged; SQLite integrity and foreign keys pass. Existing server reused without restart. Screenshot capture, complete live Advanced browser acceptance and final manufactured-component/art verification remain open. No rules gate is opened by this checkpoint.

Private evidence: 20260921-kwisatz-inspection.
Verified source tree: 1181471eed47b86390882999a2ffce0db6a44b1379c7e8f7fc406bef39a94179
2026-09-21 09:00:51 +10:00

38 lines
2.4 KiB
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.
/** Already-authorized private projection, never an authoritative game or player. */
export type KwisatzDisplayState = Readonly<{
active: boolean;
dead: boolean;
losses: number;
usedAt?: string;
}>;
export type KwisatzBattleContext = Readonly<{
territory: string;
blocked: boolean;
}>;
/** Explanatory text only. The server continues to validate every battle plan. */
export function kwisatzAvailability(
state: KwisatzDisplayState,
battle?: KwisatzBattleContext,
): string {
if (state.dead) return 'In the Tleilaxu Tanks. Revive before using in battle.';
if (!state.active) return 'Not yet available. Atreides must lose seven forces in battle.';
if (battle?.blocked) return 'Karama prevents the bonus and traitor protection in this battle.';
if (state.usedAt && battle && state.usedAt !== battle.territory)
return 'Already used in another territory this turn.';
if (state.usedAt)
return 'May be used again in the same territory this turn.';
return 'Awakened. May accompany a leader or Cheap Hero in battle.';
}
export const KWISATZ_RULES = [
'In the Advanced game, count Atreides forces lost in battles. After seven losses, Kwisatz Haderach becomes available for later battles. Storm and worm losses do not count.',
'Include the counter with a leader or Cheap Hero in a sealed battle plan. It adds two to the leader’s strength only if that leader or hero survives. The accompanying leader or hero cannot turn traitor.',
'Use it in only one territory per turn; it may join more than one battle in that territory. It cannot fight without an accompanying leader or hero.',
'An ordinary companion death removes the bonus but does not kill Kwisatz Haderach or add two to the leader’s death bounty. A played Kwisatz Haderach dies only when a lasgun–shield explosion actually resolves; a successful traitor result takes precedence.',
'Revive it separately from its accompanying leader. Normal revival costs two spice before discounts, requires the permitted Atreides leader revival cycle and uses the normal leader allowance. Ghola can revive it without that allowance and permits use in another territory that turn.',
'Stone Burner and Artillery can suppress its strength contribution in their battle comparisons. Traitor protection does not prevent a Face Dancer replacement.',
'A Karama cancellation removes both its extra strength and its traitor protection for that battle. Inspecting this component does not commit a battle plan.',
] as const;