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

This commit is contained in:
Quintine committed 2026-10-29 18:08:04 +11:00
1 parent 15a4f3038a
commit b448144c52
15 files changed
+449 -35

No files matched your search

+21 -13
View File
@@ -9,7 +9,7 @@ import { parseBattleActionClaim } from '@/game/mixed-battle-question';
import { battlePowerOf, nativeBattlePowerOpportunity, type BattlePowerClaim } from '@/game/battle-power-question';
import { battleCardLabel, voiceChoices } from '@/game/battle-cards';
import { nativeStormDialOpportunity } from '@/game/storm-dial-question';
import { karamaBattleCancelOpportunity, WINDOW_CARD_EFFECTS, windowCardOpportunity, type WindowCardEffect } from '@/game/window-card-play';
import { karamaBattleCancelOpportunity, parseKaramaHarkonnenSpecialSource, WINDOW_CARD_EFFECTS, windowCardOpportunity, type WindowCardEffect } from '@/game/window-card-play';
import { parseTurnActionLeaf, TURN_ACTION_MAX_DEPTH, TURN_ACTION_MAX_LEAVES, type TurnActionLeaf } from '@/game/turn-action-promises';
import { BattleClaimFields } from './battle-promises';
import { MixedActionFields, mixedActionInputError, type MixedActionConfig } from './mixed-action-fields';
@@ -55,8 +55,17 @@ const windowRoleNames: Record<WindowCardEffect, string> = { weather: 'Weather Co
karamaAuction: 'Spend a printed Karama for this current ordinary lot',
karamaShipment: 'Spend a printed Karama for the current shipment-price opportunity',
karamaBattleCancel: 'Spend a printed Karama to cancel this Voice or Prescience',
karamaHarkonnenSpecial: 'Use Harkonnen’s special Karama during Bidding',
thumper: 'Play Thumper before this turn’s first spice reveal', amal: 'Play Amal in this original phase opening' };
const battleCancelOpportunity = karamaBattleCancelOpportunity;
/** Harkonnen is public; do not inspect that player's hand or target's cards. */
const windowOpportunity = (game: GameView, target: string, effect: WindowCardEffect) => {
if (effect === 'karamaBattleCancel') return battleCancelOpportunity(game, target);
const opportunity = windowCardOpportunity(game, effect);
if (effect === 'karamaHarkonnenSpecial' &&
(!opportunity || parseKaramaHarkonnenSpecialSource(opportunity.source)?.owner !== target)) return null;
return opportunity;
};
const config: MixedActionConfig<TurnActionLeaf> = {
prefix: 'turn-action',
legend: 'Current battle and this-turn action conditions, with optional current facts',
@@ -113,6 +122,8 @@ const config: MixedActionConfig<TurnActionLeaf> = {
Only spending a physical printed Karama to cancel that declaration after this answer counts.
Passing, another Karama role, Worthless conversion and a different battle or response do not count.
The condition closes when the original response ends; another player&apos;s cancellation can end the opportunity.
Harkonnen&apos;s special Karama condition counts its own printed special power during Bidding, not another Karama role.
The condition does not disclose the respondent&apos;s hand or the exchange target.
Thumper conditions count an actual accepted future printed play before this turn&apos;s original first spice reveal.
Earlier plays, disposal, other roles and recovery alone do not count. A later reveal is a different opportunity.
This condition closes when the actual first spice draw begins.
@@ -157,8 +168,7 @@ const config: MixedActionConfig<TurnActionLeaf> = {
throw new Error('Choose this player’s original native Voice or Prescience opportunity in the current battle.');
}
if (action.kind === 'windowCardPlay') {
const opportunity = action.effect === 'karamaBattleCancel' ? battleCancelOpportunity(game, target)
: windowCardOpportunity(game, action.effect);
const opportunity = windowOpportunity(game, target, action.effect);
if (!opportunity || opportunity.turn !== game.turn || action.source !== opportunity.source)
throw new Error('Choose an original current native window for this printed role, including an eligible battle response.');
}
@@ -168,8 +178,7 @@ const config: MixedActionConfig<TurnActionLeaf> = {
const choices = recipients(game, target), leaderChoices = leaders(game, target), lot = currentLot(game), partnerChoices = partners(game, target);
const currentPower = value.kind === 'battlePower' ? powerOpportunity(game, target, value.claim) : null;
const currentWindow = value.kind === 'windowCardPlay'
? value.effect === 'karamaBattleCancel' ? battleCancelOpportunity(game, target) : windowCardOpportunity(game, value.effect)
: null;
? windowOpportunity(game, target, value.effect) : null;
return <>
<label htmlFor={`${id}-action`}>Future action</label>
<select id={`${id}-action`} value={value.kind} disabled={disabled} onChange={event => {
@@ -184,8 +193,8 @@ const config: MixedActionConfig<TurnActionLeaf> = {
if (kind === 'windowCardPlay') {
const effect = battleCancelOpportunity(game, target) ? 'karamaBattleCancel'
: windowCardOpportunity(game, 'amal') ? 'amal'
: WINDOW_CARD_EFFECTS.find(effect => effect !== 'karamaBattleCancel' && windowCardOpportunity(game, effect)) ?? 'weather';
onChange({ kind, effect, source: windowCardOpportunity(game, effect)?.source ?? '' });
: WINDOW_CARD_EFFECTS.find(effect => effect !== 'karamaBattleCancel' && windowOpportunity(game, target, effect)) ?? 'weather';
onChange({ kind, effect, source: windowOpportunity(game, target, effect)?.source ?? '' });
}
if (kind === 'battlePower') {
const claim = newPowerClaim(game, target), opportunity = powerOpportunity(game, target, claim);
@@ -260,19 +269,17 @@ const config: MixedActionConfig<TurnActionLeaf> = {
<select id={`${id}-window-effect`} value={WINDOW_CARD_EFFECTS.includes(value.effect) ? value.effect : ''}
disabled={disabled} aria-invalid={!WINDOW_CARD_EFFECTS.includes(value.effect)} onChange={event => {
const effect = event.currentTarget.value;
if (effect === 'weather' || effect === 'atomics' || effect === 'harvester' || effect === 'karamaAuction' || effect === 'karamaShipment' || effect === 'karamaBattleCancel' || effect === 'thumper' || effect === 'amal')
onChange({ kind: 'windowCardPlay', effect, source: (effect === 'karamaBattleCancel'
? battleCancelOpportunity(game, target) : windowCardOpportunity(game, effect))?.source ?? '' });
if (effect === 'weather' || effect === 'atomics' || effect === 'harvester' || effect === 'karamaAuction' || effect === 'karamaShipment' || effect === 'karamaBattleCancel' || effect === 'karamaHarkonnenSpecial' || effect === 'thumper' || effect === 'amal')
onChange({ kind: 'windowCardPlay', effect, source: windowOpportunity(game, target, effect)?.source ?? '' });
}}>
<option value="">Choose a printed role</option>
{WINDOW_CARD_EFFECTS.filter(effect => effect !== 'karamaBattleCancel' || !!battleCancelOpportunity(game, target) || value.effect === effect)
{WINDOW_CARD_EFFECTS.filter(effect => (effect !== 'karamaBattleCancel' && effect !== 'karamaHarkonnenSpecial') || !!windowOpportunity(game, target, effect) || value.effect === effect)
.map(effect => <option key={effect} value={effect}>{windowRoleNames[effect]}</option>)}
</select>
<label htmlFor={`${id}-window-source`}>Original native window</label>
<select id={`${id}-window-source`} value={currentWindow?.source === value.source ? value.source : ''}
disabled={disabled} aria-invalid={!currentWindow || currentWindow.source !== value.source} onChange={event => {
const opportunity = value.effect === 'karamaBattleCancel' ? battleCancelOpportunity(game, target)
: windowCardOpportunity(game, value.effect);
const opportunity = windowOpportunity(game, target, value.effect);
if (event.currentTarget.value === '') onChange({ ...value, source: '' });
else if (opportunity?.source === event.currentTarget.value) onChange({ ...value, source: opportunity.source });
}}>
@@ -282,6 +289,7 @@ const config: MixedActionConfig<TurnActionLeaf> = {
: value.effect === 'karamaAuction' ? `Turn ${currentWindow.turn} · Ordinary lot ${game.bidPromiseLot?.lot}`
: value.effect === 'thumper' ? `Turn ${currentWindow.turn} · Before the original first spice reveal`
: value.effect === 'amal' ? `Turn ${currentWindow.turn} · Original ${PHASES[game.phase]} opening`
: value.effect === 'karamaHarkonnenSpecial' ? `Turn ${currentWindow.turn} · Harkonnen special Karama during Bidding`
: value.effect === 'karamaBattleCancel' ? `Turn ${currentWindow.turn} · ${game.response?.kind === 'voice' ? 'Voice' : 'Prescience'} declared by ${game.players.find(player => player.id === game.response?.owner)?.name ?? game.response?.owner} · ${game.combatLocations.find(location => location.id === game.battle?.territory)?.name ?? game.battle?.territory}`
: currentWindow.effect === 'karamaShipment' ? `Turn ${currentWindow.turn} · ${game.players.find(player => player.id === currentWindow.recipient)?.name ?? currentWindow.recipient}’s current native shipment price`
: `Turn ${currentWindow.turn} · Before this Storm movement`}</option>}