Prototype Tleilaxu special Karama Truthtrance
Verify and publish checkpoint container / container (push) Successful in 11m6s

This commit is contained in:
Quintine committed 2026-10-29 18:35:24 +11:00
1 parent 5b8d510470
commit cfccfe5acb
15 files changed
+391 -20

No files matched your search

+24 -2
View File
@@ -1,12 +1,13 @@
import { harvesterAvailable } from './cards';
export const WINDOW_CARD_EFFECTS = ['weather', 'atomics', 'harvester', 'karamaAuction', 'karamaShipment', 'karamaBattleCancel', 'karamaHarkonnenSpecial', 'karamaEmperorSpecial', 'karamaAtreidesSpecial', 'karamaFremenSpecial', 'thumper', 'amal'] as const;
export const WINDOW_CARD_EFFECTS = ['weather', 'atomics', 'harvester', 'karamaAuction', 'karamaShipment', 'karamaBattleCancel', 'karamaHarkonnenSpecial', 'karamaEmperorSpecial', 'karamaAtreidesSpecial', 'karamaFremenSpecial', 'karamaTleilaxuSpecial', 'thumper', 'amal'] as const;
export type WindowCardEffect = typeof WINDOW_CARD_EFFECTS[number];
export function windowCardNativeEffect(effect: WindowCardEffect): 'weather' | 'atomics' | 'harvester' | 'karama' | 'thumper' | 'amal' {
return effect === 'karamaAuction' || effect === 'karamaShipment' || effect === 'karamaBattleCancel' || effect === 'karamaHarkonnenSpecial' || effect === 'karamaEmperorSpecial' || effect === 'karamaAtreidesSpecial' || effect === 'karamaFremenSpecial' ? 'karama' : effect;
return effect === 'karamaAuction' || effect === 'karamaShipment' || effect === 'karamaBattleCancel' || effect === 'karamaHarkonnenSpecial' || effect === 'karamaEmperorSpecial' || effect === 'karamaAtreidesSpecial' || effect === 'karamaFremenSpecial' || effect === 'karamaTleilaxuSpecial' ? 'karama' : effect;
}
export type KaramaHarkonnenSpecialSource = { turn: number; owner: string };
export type KaramaEmperorSpecialSource = { turn: number; owner: string };
export type KaramaTleilaxuSpecialSource = { turn: number; owner: string };
export type KaramaFremenSpecialSource = { turn: number; owner: string };
export type KaramaAtreidesSpecialSource = { turn: number; owner: string; battle: string; territory: string };
export type KaramaBattleCancelSource = {
@@ -90,6 +91,16 @@ export function parseKaramaEmperorSpecialSource(source: unknown): KaramaEmperorS
return { turn: tuple[1], owner: tuple[2] };
}
/** Decode the public owner and turn even after the special power is spent. */
export function parseKaramaTleilaxuSpecialSource(source: unknown): KaramaTleilaxuSpecialSource | null {
if (!identifier(source)) return null;
let tuple: unknown;
try { tuple = JSON.parse(source); } catch { return null; }
if (!Array.isArray(tuple) || tuple.length !== 3 || tuple[0] !== 'karamaTleilaxuSpecial' ||
!whole(tuple[1]) || tuple[1] < 1 || !identifier(tuple[2]) || JSON.stringify(tuple) !== source) return null;
return { turn: tuple[1], owner: tuple[2] };
}
/** Decode the public phase window even after the special power is spent. */
export function parseKaramaFremenSpecialSource(source: unknown): KaramaFremenSpecialSource | null {
if (!identifier(source)) return null;
@@ -225,6 +236,17 @@ function globalWindowCardOpportunity(game: WindowCardGame, effect: WindowCardEff
if (owners.length !== 1 || owners[0].specialKaramaUsed === true) return null;
return { effect, turn: game.turn, source: JSON.stringify([effect, game.turn, owners[0].id]) };
}
if (effect === 'karamaTleilaxuSpecial') {
const players = game.players;
if (game.advanced !== true || game.phase !== 4 || !Array.isArray(players) || !players.length ||
!players.every(player => object(player) && identifier(player.id) &&
typeof player.faction === 'string' && (player.specialKaramaUsed === undefined ||
typeof player.specialKaramaUsed === 'boolean')) ||
new Set(players.map(player => player.id)).size !== players.length) return null;
const owners = players.filter(player => player.faction === 'tleilaxu');
if (owners.length !== 1 || owners[0].specialKaramaUsed === true) return null;
return { effect, turn: game.turn, source: JSON.stringify([effect, game.turn, owners[0].id]) };
}
if (effect === 'karamaFremenSpecial') {
const players = game.players;
if (game.advanced !== true || game.phase !== 1 || !Array.isArray(players) || !players.length ||