Admit genuine Basic Tleilaxu/base setup with the full fourteen-skill deck, Ix card inventories and native three Face Dancers. Share public profile guards across existing skill effects while retaining public-start and Advanced gates. Record native own-leader skill offers at successful revival commitment so automatic Tleilaxu response chains preserve the optional private draw. Connect Rihani to unrevealed Face Dancer exchange with exact physical/status custody, private controls and existing legal AI choices. Release completed Rihani's live snapshot only after validated Face Dance admission; keep signed history and current census checks. Zoal Smuggler uses opposing printed disc value at reveal, excluding opposing skill bonuses and his separate revival value. Add genuine setup, response/cancellation, private choice, custody, Face Dance reset, Zoal, legal AI and authenticated concurrent recovery regressions. Add a reproducible two-through-six-player sample profile and saved continuation. Preserve unresolved skill effects, foreign-ghola boundaries and delayed AI tuning. Validation: types, lint, 5,058 offline tests and production build passed. Five full games completed with zero rejected actions and 74 JSON restores. Browser QA CRY4DD4J used genuine setup and an explicitly conserved staged battle; real Rihani draw/exchange and same-state refresh passed on mobile and desktop. Screenshot capture timed out; full visual acceptance remains open. No HTTP endpoint/auth/storage implementation changed; authenticated SQLite recovery was verified. All 1,581 prior rooms, 3,349 seats and auxiliary records were preserved. One new QA room/seat remains. No server restart, database reset or automation.
83 lines
2.4 KiB
TypeScript
83 lines
2.4 KiB
TypeScript
import { basicExpansionLeaderSkillsProfile, noOtherLeaderSkillModules, type LeaderSkillProfile } from './leader-skill-profile';
|
|
export type BureaucratPaymentKind = 'auction' | 'shipment' | 'bribe';
|
|
export type BureaucratPaymentSource = {
|
|
event: string;
|
|
turn: number;
|
|
phase: number;
|
|
kind: BureaucratPaymentKind;
|
|
payer: string;
|
|
payee: string;
|
|
amount: number;
|
|
signature: string;
|
|
};
|
|
/** The one physical skill card's use survives death, redraw and controller changes. */
|
|
export type BureaucratPaymentUse = {
|
|
event: string;
|
|
owner: string;
|
|
turn: number;
|
|
phase: number;
|
|
signature: string;
|
|
};
|
|
export type BureaucratPaymentView = {
|
|
pending: null | {
|
|
event: string;
|
|
owner: string;
|
|
payer: string;
|
|
payee: string;
|
|
amount: number;
|
|
kind: BureaucratPaymentKind;
|
|
redirect: 2;
|
|
};
|
|
usedThisPhase: boolean;
|
|
};
|
|
export class BureaucratPaymentError extends Error {}
|
|
export function bureaucratPaymentSignature(value: object): string {
|
|
return JSON.stringify({ ...value, signature: undefined });
|
|
}
|
|
export function bureaucratPaymentModeSupported(game: LeaderSkillProfile): boolean {
|
|
return noOtherLeaderSkillModules(game) &&
|
|
(!game.expansions.length ||
|
|
(game.expansions.length === 1 && game.expansions[0] === 'choam') ||
|
|
basicExpansionLeaderSkillsProfile(game));
|
|
}
|
|
export function bureaucratUsed(
|
|
used: readonly BureaucratPaymentUse[],
|
|
turn: number,
|
|
phase: number,
|
|
): boolean {
|
|
return used.some((use) => use.turn === turn && use.phase === phase);
|
|
}
|
|
/** Caller supplies only a living face-up native trainer and actual player payees. */
|
|
export function quoteBureaucratPayment(input: {
|
|
owner: string | null;
|
|
payer: string;
|
|
payee: string;
|
|
amount: number;
|
|
turn: number;
|
|
phase: number;
|
|
used: readonly BureaucratPaymentUse[];
|
|
}): { redirect: 2; income: number } | null {
|
|
if (
|
|
!Number.isSafeInteger(input.amount) ||
|
|
input.amount < 0 ||
|
|
!Number.isSafeInteger(input.turn) ||
|
|
input.turn < 1 ||
|
|
!Number.isSafeInteger(input.phase) ||
|
|
input.phase < 0 ||
|
|
input.phase > 8 ||
|
|
!input.payer ||
|
|
!input.payee
|
|
)
|
|
throw new BureaucratPaymentError(
|
|
'Bureaucrat needs a valid actual player payment.',
|
|
);
|
|
return input.owner &&
|
|
input.owner !== input.payer &&
|
|
input.owner !== input.payee &&
|
|
input.payer !== input.payee &&
|
|
input.amount >= 5 &&
|
|
!bureaucratUsed(input.used, input.turn, input.phase)
|
|
? { redirect: 2, income: input.amount - 2 }
|
|
: null;
|
|
}
|