Support Atreides special Karama truth commitments
Verify and publish checkpoint container / container (push) Successful in 10m46s

This commit is contained in:
Quintine committed 2026-10-29 18:17:14 +11:00
1 parent add8e1d51a
commit 5079ab556f
16 files changed
+408 -19

No files matched your search

+36 -4
View File
@@ -19001,7 +19001,8 @@ function karamaSpendingBlock(g: Game, p: Player, card: Card, purpose?: KullPurpo
required.effect === 'karamaBattleCancel' && !!g.response &&
purpose === karamaUsePurpose(g, { kind: 'cancel', response: g.response }) ||
required.effect === 'karamaHarkonnenSpecial' && purpose === 'special:harkonnen' ||
required.effect === 'karamaEmperorSpecial' && purpose === 'special:emperor') &&
required.effect === 'karamaEmperorSpecial' && purpose === 'special:emperor' ||
required.effect === 'karamaAtreidesSpecial' && purpose === 'special:atreides') &&
windowCardOpportunity(g, required.effect)?.source === required.source))
return 'Retain this opportunity without a forbidden printed Karama cost.';
const kullBlock = kullKaramaBlock(g, p, purpose);
@@ -20493,7 +20494,7 @@ function spendKarama(g: Game, p: Player, card: Card, use: KaramaUse, kullOffered
// still-open Harkonnen special promise before a foreign response can park
// the shared reconciler.
if (card.kind === 'special' && card.effect === 'karama' && auctionRows.some(row => {
return (['karamaHarkonnenSpecial', 'karamaEmperorSpecial'] as const).some(effect => {
return (['karamaHarkonnenSpecial', 'karamaEmperorSpecial', 'karamaAtreidesSpecial'] as const).some(effect => {
const stage = row.windowCards?.[effect];
return stage && !stage.closed && windowCardOpportunity(g, effect, stage.source)?.source === stage.source;
});
@@ -22387,6 +22388,18 @@ function quotedAmalReady(g: Game, actor: string): boolean {
function* nativeWindowCardActions(g: Game, actor: string, effect: WindowCardEffect): Generator<Action> {
if (!windowCardOpportunity(g, effect)) return;
const player = getPlayer(g, actor);
if (effect === 'karamaAtreidesSpecial') {
if (player.faction !== 'atreides' || g.kullPreview || g.pendingKull || g.semutaPreview ||
g.semutaRecruitsPreview || g.semutaAdvancedOrdinaryPreview || g.truthtrance || g.response ||
g.decision || g.phaseOpening || g.pendingKarama || g.pendingTreacheryDiscard || g.pendingNullentropy || !g.battle) return;
for (const card of player.hand.filter(card => card.kind === 'special' && card.effect === 'karama'))
for (const target of [g.battle.attacker, g.battle.defender]) {
const action: Action = { type: 'card', mode: 'special', card: card.id, target };
try { if (prepareSpecialKaramaIntent(g, actor, action).kind === 'atreides') yield action; }
catch (error) { if (!(error instanceof RuleError)) throw error; }
}
return;
}
if (effect === 'karamaEmperorSpecial') {
if (player.faction !== 'emperor' || g.kullPreview || g.pendingKull || g.semutaPreview ||
g.semutaRecruitsPreview || g.semutaAdvancedOrdinaryPreview || g.truthtrance ||
@@ -22505,7 +22518,17 @@ function* turnActionWindowCardSeeds(source: Game, actor: string, requirements: r
for (const action of nativeWindowCardActions(state, actor, required.effect)) {
try {
let next: Game;
if (required.effect === 'karamaHarkonnenSpecial') {
if (required.effect === 'karamaAtreidesSpecial') {
// Quote the cost and public target-first obligation without
// inspecting or sampling the opponent's sealed battle plan.
next = structuredClone(state);
const intent = prepareSpecialKaramaIntent(next, actor, action);
requireRule(intent.kind === 'atreides' && next.battle, 'Retain the original Atreides special battle.');
const owner = getPlayer(next, actor);
discard(next, owner, intent.card);
owner.specialKaramaUsed = true;
next.battle.fullPlan = { owner: actor, target: intent.target };
} else if (required.effect === 'karamaHarkonnenSpecial') {
// An opaque legal witness returns the unseen drawn cards to the
// target. It spends the actual card but never samples, copies or
// derives a benefit from another player's private hand.
@@ -23761,7 +23784,11 @@ function projectedTurnActionGuide(g: Game, player: Player): { event: string; act
: action.type === 'move' ? player.hand.find(card => card.id === action.movementCard) : undefined;
const printedWindow = held?.kind === 'special' && held.effect === 'karama' && action.mode === 'purchase'
? 'karamaAuction' : held?.kind === 'special' && held.effect === 'karama' && action.mode === 'shipment'
? 'karamaShipment' : isWindowCardEffect(held?.effect) ? held.effect : null;
? 'karamaShipment' : held?.kind === 'special' && held.effect === 'karama' && action.mode === 'special'
? player.faction === 'harkonnen' ? 'karamaHarkonnenSpecial'
: player.faction === 'emperor' ? 'karamaEmperorSpecial'
: player.faction === 'atreides' ? 'karamaAtreidesSpecial' : null
: isWindowCardEffect(held?.effect) ? held.effect : null;
const windows: WindowCardEffect[] = printedWindow ? [printedWindow]
: action.type === 'decision' && action.karama === true ? ['karamaAuction']
: action.type === 'ready' || held?.effect === 'nullentropyBox' ? [...WINDOW_CARD_EFFECTS] : [];
@@ -42773,7 +42800,12 @@ function resolveSpecialKaramaEffect(g: Game, p: Player, card: Card, intent: Spec
} else if (intent.kind === 'atreides') {
const b = g.battle!,
target = intent.target;
const opportunity = windowCardOpportunity(g, 'karamaAtreidesSpecial');
if (opportunity && card.kind === 'special' && card.effect === 'karama')
recordNativeTurnActionWindowCard(g, p.id, 'karamaAtreidesSpecial', opportunity.source);
p.specialKaramaUsed = true;
if (liveTurnActionPromises(g.turnActionPromises ?? [], p.id, g.turn).length)
guardTurnActionPrintedCardCost(g, p, card);
b.fullPlan = { owner: p.id, target };
g.decision = null;
log(
+1
View File
@@ -3366,6 +3366,7 @@ export const RULE_TOPICS: RuleTopic[] = [
'A current-lot Karama condition counts a future physical printed Karama cost for this original ordinary auction card, either immediate purchase or its winning invoice. Bidding alone, another Karama role, a converted Worthless card, an earlier play, recovery or a later lot does not count. A bid-and-Karama answer must retain the real bid before the purchase; free acquisition still uses the original native controls and hand limit. A whole No shares its payment and bid funding without assuming a forbidden free invoice. Unseen future auction cards cannot fund another promised card play; actual owned knowledge remains usable.',
'In a quiet Advanced Bidding window, a whole answer can name Harkonnen’s successful once-game special Karama. The original owner and Bidding turn bind the interval across lots. Only a future actual physical printed Karama used for that special counts; ordinary roles and failed use do not. No and native hand-exchange timing remain authoritative. The shared witness returns unseen drawn cards without sampling their faces; Kull, Semuta and other faction special powers remain outside this prototype.',
'A separate Emperor special-Karama condition covers quiet Advanced Revival. It names an actual physical printed Karama activation and its real free leader or force return, preserving the existing return-before-cost order. Kull, Semuta and broader interactions remain outside the bounded profile.',
'A separate Atreides special-Karama condition covers a clean Advanced battle before plans reveal. It binds the original public battle, and the private witness pays the real card without reading an opposing sealed plan. Actual inspection and target-first sequencing remain native; Kull, Semuta and broader interactions remain outside the bounded profile. Guides select the actual special-use promise even when another answer was recorded first.',
'A printed Karama shipment-price clause names the current beneficiary’s unused native shipment. The giver spends the physical printed card; the beneficiary still pays the native bank tariff, such as two spice becoming one. Playing that cost counts even if its price is unused. The source remains while that original recipient is entitled, including another actor’s turn; a different beneficiary or a Cunning second opportunity has its own interval. Own shipping or ending must preserve the whole answer before a foreign counter, while foreign actions retain their rights.',
'A Thumper condition counts an actual printed play after answering before this turn’s original first Spice reveal. Its cost counts even when the existing first-turn rule ignores the encounter or waiting Sandtrout suppresses it. Own acceptance must retain the whole answer. Known card effects enter the quote; the next hidden Spice Card does not. A forced later draw can release genuine impossibility, while choosing known casualties cannot evade an earlier answer.',
'A printed Amal clause names the original phase opening and counts a future printed play after this answer. The actual available-spice reduction occurs before ordinary payments become possible; known Mentat bribe receipts arrive afterward. Definite answers reopen your own opening pass. Own cost or acceptance must retain a completion, while a foreign Amal can release genuine impossibility before another player takes the last pass. Later openings keep separate intervals.',
+7 -1
View File
@@ -5,7 +5,7 @@ import { parseTravelActionClaim, type TravelClaim } from './travel-expression-pr
import { parseTurnActionLeaf, TURN_ACTION_MAX_DEPTH, TURN_ACTION_MAX_LEAVES,
turnActionPromiseModeSupported, type TurnActionClaim } from './turn-action-promises';
import { battlePowerOf, nativeBattlePowerOpportunity } from './battle-power-question';
import { parseKaramaShipmentSource, parseKaramaBattleCancelSource, parseKaramaHarkonnenSpecialSource, parseKaramaEmperorSpecialSource, karamaBattleCancelOpportunity, windowCardOpportunity } from './window-card-play';
import { parseKaramaShipmentSource, parseKaramaBattleCancelSource, parseKaramaHarkonnenSpecialSource, parseKaramaEmperorSpecialSource, parseKaramaAtreidesSpecialSource, karamaBattleCancelOpportunity, windowCardOpportunity } from './window-card-play';
import { nativeStormDialOpportunity } from './storm-dial-question';
import { parseTraitorActionClaim, type MixedTraitorClaim } from './mixed-traitor-question';
import { parseBattleActionClaim, MIXED_BATTLE_MAX_NODES, MIXED_BATTLE_MAX_TERMS, MIXED_BATTLE_MAX_DEPTH,
@@ -511,6 +511,10 @@ function parseQuestion(g: Game, asker: string, value: unknown): TruthQuestion {
check(parseKaramaEmperorSpecialSource(action.source)?.owner === respondent.id &&
!g.kullPreview && !g.semutaPreview && !g.semutaRecruitsPreview && !g.semutaAdvancedOrdinaryPreview,
'Choose Emperor’s own special Karama in a supported clean Revival profile.');
if (action.effect === 'karamaAtreidesSpecial')
check(parseKaramaAtreidesSpecialSource(action.source)?.owner === respondent.id &&
!g.kullPreview && !g.semutaPreview && !g.semutaRecruitsPreview && !g.semutaAdvancedOrdinaryPreview,
'Choose Atreides’ own special Karama in a supported clean battle profile.');
}
if (action.kind === 'battlePlan' || action.kind === 'traitorCall' || action.kind === 'battlePower') {
const battle = g.battle;
@@ -915,6 +919,8 @@ export function truthQuestionText(
return 'you use Harkonnen’s special Karama after this answer during Bidding';
if (action.effect === 'karamaEmperorSpecial')
return 'you use Emperor’s special Karama after this answer during Revival';
if (action.effect === 'karamaAtreidesSpecial')
return 'you use Atreides’ special Karama after this answer in this battle';
if (action.effect === 'karamaBattleCancel') {
const response = parseKaramaBattleCancelSource(action.source);
return `you spend a printed Karama after this answer to cancel ${response?.kind === 'voice' ? 'Voice' : 'Prescience'} in this original battle response`;
+8 -1
View File
@@ -7,7 +7,7 @@ import { RevivalExpressionPromiseError, type RevivalExpressionReturn } from './r
import { parseBattleActionClaim, type MixedBattleActionClaim } from './mixed-battle-question';
import { PlanClaimError } from './battle-promises';
import { PRINTED_CARD_EFFECTS, type PrintedCardEffect } from './printed-card-play';
import { WINDOW_CARD_EFFECTS, parseKaramaHarkonnenSpecialSource, parseKaramaEmperorSpecialSource, type WindowCardEffect } from './window-card-play';
import { WINDOW_CARD_EFFECTS, parseKaramaHarkonnenSpecialSource, parseKaramaEmperorSpecialSource, parseKaramaAtreidesSpecialSource, type WindowCardEffect } from './window-card-play';
import { StormDialQuestionError, parseStormDialClaim, parseStormDialSource, stormDialMatches, type StormDialClaim } from './storm-dial-question';
import { nativePromiseScopeSupported, type NativePromiseScope } from './native-promise-scope';
import { BattlePowerQuestionError, battlePowerMatches, battlePowerOf, parseBattlePowerClaim,
@@ -171,6 +171,8 @@ export function parseTurnActionLeaf(value: unknown): TurnActionLeaf {
'Retain the original Harkonnen special Karama Bidding window.');
if (value.effect === 'karamaEmperorSpecial') check(!!parseKaramaEmperorSpecialSource(value.source),
'Retain the original Emperor special Karama Revival window.');
if (value.effect === 'karamaAtreidesSpecial') check(!!parseKaramaAtreidesSpecialSource(value.source),
'Retain the original Atreides special Karama battle window.');
return { kind: 'windowCardPlay', effect: value.effect, source: value.source };
}
if (value.kind === 'battlePower') {
@@ -377,6 +379,11 @@ function readPromise(promise: TurnActionPromise): CompiledMixedAction<TurnAction
check(binding && binding.turn === promise.turn && binding.owner === promise.player,
'Retain the respondent’s original Emperor special Karama Revival window.');
}
for (const source of windowSources.get('karamaAtreidesSpecial') ?? []) {
const binding = parseKaramaAtreidesSpecialSource(source);
check(binding && binding.turn === promise.turn && binding.owner === promise.player,
'Retain the respondent’s original Atreides special Karama battle window.');
}
if ('windowCards' in promise) {
check(object(promise.windowCards) && keys(promise.windowCards, [...windowSources.keys()].sort().join(',')),
'Retain exactly the original named window-card effects.');
+27 -2
View File
@@ -1,12 +1,13 @@
import { harvesterAvailable } from './cards';
export const WINDOW_CARD_EFFECTS = ['weather', 'atomics', 'harvester', 'karamaAuction', 'karamaShipment', 'karamaBattleCancel', 'karamaHarkonnenSpecial', 'karamaEmperorSpecial', 'thumper', 'amal'] as const;
export const WINDOW_CARD_EFFECTS = ['weather', 'atomics', 'harvester', 'karamaAuction', 'karamaShipment', 'karamaBattleCancel', 'karamaHarkonnenSpecial', 'karamaEmperorSpecial', 'karamaAtreidesSpecial', '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' ? 'karama' : effect;
return effect === 'karamaAuction' || effect === 'karamaShipment' || effect === 'karamaBattleCancel' || effect === 'karamaHarkonnenSpecial' || effect === 'karamaEmperorSpecial' || effect === 'karamaAtreidesSpecial' ? 'karama' : effect;
}
export type KaramaHarkonnenSpecialSource = { turn: number; owner: string };
export type KaramaEmperorSpecialSource = { turn: number; owner: string };
export type KaramaAtreidesSpecialSource = { turn: number; owner: string; battle: string; territory: string };
export type KaramaBattleCancelSource = {
turn: number;
battle: string;
@@ -88,6 +89,17 @@ export function parseKaramaEmperorSpecialSource(source: unknown): KaramaEmperorS
return { turn: tuple[1], owner: tuple[2] };
}
/** Decode the public battle window even after the inspection closes. */
export function parseKaramaAtreidesSpecialSource(source: unknown): KaramaAtreidesSpecialSource | null {
if (!identifier(source)) return null;
let tuple: unknown;
try { tuple = JSON.parse(source); } catch { return null; }
if (!Array.isArray(tuple) || tuple.length !== 5 || tuple[0] !== 'karamaAtreidesSpecial' ||
!whole(tuple[1]) || tuple[1] < 1 || !identifier(tuple[2]) || !identifier(tuple[3]) ||
!identifier(tuple[4]) || JSON.stringify(tuple) !== source) return null;
return { turn: tuple[1], owner: tuple[2], battle: tuple[3], territory: tuple[4] };
}
/** Source decoding remains available after the actual grant closes its window. */
export function parseKaramaShipmentSource(source: unknown): KaramaShipmentSource | null {
if (!identifier(source)) return null;
@@ -202,6 +214,19 @@ 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 === 'karamaAtreidesSpecial') {
const players = game.players, battle = game.battle;
if (game.advanced !== true || game.phase !== 6 || !battle || battle.revealed !== false ||
!identifier(battle.event) || !identifier(battle.territory) ||
!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 === 'atreides');
if (owners.length !== 1 || owners[0].specialKaramaUsed === true) return null;
return { effect, turn: game.turn, source: JSON.stringify([effect, game.turn, owners[0].id, battle.event, battle.territory]) };
}
if (effect === 'karamaBattleCancel') {
const battle = game.battle, response = game.response, players = game.players;
if (game.advanced !== false || game.phase !== 6 || !battle || !identifier(battle.event) ||