Allow bribes during native Basic response windows
This commit is contained in:
1 parent
de7fe7d64a
commit
812fe9d6e0
10 files changed
+346
-2
No files matched your search
@@ -1,5 +1,19 @@
|
||||
# Ordinary bribe controls
|
||||
|
||||
## Basic disaster, battle-power and paid-shipment responses — 20 November 2026
|
||||
|
||||
**Prototyped / Partial.** In supported clean Basic games, a direct nonallied
|
||||
bribe can interrupt the native Fremen worm-survival response, Voice or
|
||||
Prescience response, and Guild income following a paid ordinary shipment. The
|
||||
original response and passes, battle, committed shipment and its waiting arrival
|
||||
continue unchanged. The recipient cannot spend the bribe before Mentat. Existing
|
||||
uncommitted-spice restrictions remain, while live battle promises, competing
|
||||
pending transactions and optional modules remain guarded. These interruption
|
||||
priorities are provisional online interpretations of the source below, not a
|
||||
publisher timing ruling. Runtime smoke uses a natural worm, a native Prescience
|
||||
battle and an actual paid shipment. Other response families and full games
|
||||
remain open.
|
||||
|
||||
## Basic worm ride and winner-card decisions — 16 November 2026
|
||||
|
||||
**Prototyped / Partial.** In supported clean Basic classic and selected native
|
||||
|
||||
@@ -17,6 +17,13 @@ open mode gates.
|
||||
|
||||
## Current checkpoint and work
|
||||
|
||||
**Bribes during three native response families — 20 November. Prototyped /
|
||||
Partial.** Supported clean Basic games can pay a direct ordinary bribe during
|
||||
Fremen worm survival, Voice/Prescience or Guild income after a paid shipment,
|
||||
preserving the original response and deferred recipient ledger. Other pending
|
||||
responses, competing commitments, full games and deployment remain open.
|
||||
[Scope](BRIBE_CONTROLS.md#basic-disaster-battle-power-and-paid-shipment-responses--20-november-2026).
|
||||
|
||||
**Bribes during worm rides and winner-card decisions — 16 November.
|
||||
Prototyped / Partial.** Supported clean Basic games can pay a direct ordinary
|
||||
bribe while a Fremen worm ride or winner card-retention decision waits; the
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# Rule decision index
|
||||
|
||||
## Bribes during Basic native responses — 20 November 2026
|
||||
|
||||
The existing provisional online timing permits supported direct bribes during
|
||||
the native worm-survival and Voice/Prescience responses, or the Guild's income
|
||||
response after a paid ordinary shipment. The publisher's base rules p. 12 and
|
||||
November 2020 FAQ p. 9 establish bribes and deferred collection, but do not
|
||||
specify this digital interruption priority.
|
||||
[Scope](BRIBE_CONTROLS.md#basic-disaster-battle-power-and-paid-shipment-responses--20-november-2026).
|
||||
|
||||
## Bribes during worm rides and winner-card decisions — 16 November 2026
|
||||
|
||||
The existing provisional digital ordering for ordinary nonallied bribes now
|
||||
|
||||
@@ -118,7 +118,7 @@ export function cardPresentation(card: VisibleCard): CardPresentation {
|
||||
guidance: ecaz.summary,
|
||||
gameplay: ecaz.gameplay,
|
||||
availability: ecaz.card.effect === 'recruits'
|
||||
? 'Recruits has Revival controls in classic and selected Ix/CHOAM Basic/Advanced Worlds, optionally retaining original Tech3+ and Advanced Strongholds2+. Double current native free rates within the ordinary seven-force total; native unlimited allowances, typed deposits and special-force caps stay. Axlotl keeps its original once-per-phase trigger and delayed payout. Prior paid returns keep payment under the provisional no-refund policy. Pending transactions, unknown ledgers, later Fremen grants and replay remain guarded.'
|
||||
? 'Play during Revival to double current free revival rates and raise the ordinary force limit to seven. Unlimited faction allowances and special-force caps remain. If the physical card is recovered, it can be played again; each play provisionally doubles the rate again. A later Fremen allied grant can still be made. Earlier paid returns keep their payment; finish any pending transaction before playing.'
|
||||
: ecaz.card.effect === 'harassWithdraw'
|
||||
? 'Harass & Withdraw uses either battle-card slot and exact physical allocation after reveal, including classic and selected Ix/CHOAM Worlds with original Tech3+ and Advanced Strongholds2+. Return actual native types: Advanced Emperor normal to Kaitain/Sardaukar to Salusa; other natives to their original primary World. Never withdraw on any own World. Original commitment/support stays. Returns are not free revival or shipment. Own No-Field provisionally materializes first; Stone keeps its separate profile/allocation guards.'
|
||||
: 'Reinforcements uses either slot, including classic and selected Ix/CHOAM Basic/Advanced Worlds with original Tech3+ and Advanced Strongholds2+. Pay three original own reserves normal-first for +2 normal score, not support or physical tokens. Exact native sources seal when ambiguous; an own-World fee cannot also fund its dial, while original traits/face stay. Own No-Field must leave three before payment, including native World reserves; future Harass cannot fund it. Earned bank subsidy pays only actual support. Remaining profile guards and cost/order interpretations stay provisional.',
|
||||
|
||||
+44
-1
@@ -18243,12 +18243,19 @@ function bribePaymentPreservesPromises(g: Game, p: Player, recipient: string, am
|
||||
* advancing their pending state. Existing whole-promise planners retain their
|
||||
* original timing boundary until those compositions are implemented. */
|
||||
function basicBribeInterrupt(g: Game, p: Player): boolean {
|
||||
const battlePowerResponse = !!g.battle &&
|
||||
(g.response?.kind === 'voice' || g.response?.kind === 'prescience') &&
|
||||
// A mixed answer may or may not have a private residual promise. The
|
||||
// public interruption must not reveal which case its private fact created.
|
||||
!(g.mixedBattleQuestions ?? []).some(question => question.turn === g.turn && question.battle === g.battle?.event) &&
|
||||
!g.battle.truthPromises?.some(promise => !promise.released) &&
|
||||
!g.battle.traitorDecisionPromises?.length;
|
||||
if (g.status !== 'playing' || g.advanced ||
|
||||
g.inflation?.side === 'double' || g.techTokens || g.strongholdCards || g.leaderSkills ||
|
||||
g.homeworlds || g.nexusCards || g.discoveryEnabled || g.discoveries || g.discoveryStash || g.greatMaker || g.coalitionState ||
|
||||
g.ecazTreachery || g.semutaRecruitsPreview || g.truthtrance ||
|
||||
g.pendingKarama || g.pendingKull || g.pendingTreacheryDiscard || g.pendingNullentropy ||
|
||||
g.bureaucratPayments?.pending || g.battle || g.pendingRicheseGift || g.pendingShipment ||
|
||||
g.bureaucratPayments?.pending || g.battle && !battlePowerResponse || g.pendingRicheseGift || g.pendingShipment ||
|
||||
g.pendingGuildTransport || g.pendingArrivalOverlap || g.pendingAmbassador || g.pendingEmperorAuctionGift ||
|
||||
liveShipmentPromises(g.shipmentPromises ?? [], p.id, g.turn).length ||
|
||||
liveTravelPromises(g.travelPromises ?? [], p.id, g.turn).length ||
|
||||
@@ -18271,6 +18278,42 @@ function basicBribeInterrupt(g: Game, p: Player): boolean {
|
||||
const classic = ['atreides', 'beneGesserit', 'emperor', 'fremen', 'guild', 'harkonnen'];
|
||||
const nativeRoster = !g.expansions.length
|
||||
? g.players.every(seat => classic.includes(seat.faction)) : selectedPhaseModuleRoster(g);
|
||||
// These responses have no outstanding invoice: the original battle power
|
||||
// has been declared, the worm awaits its native outcome, or the shipment
|
||||
// was already paid before the Guild's income response opened. Keep the
|
||||
// original response, its passes and any committed arrival in place.
|
||||
const response = g.response;
|
||||
if (nativeRoster && !g.phaseOpening && !g.choamMarket && !g.ixAuction && response && !g.decision &&
|
||||
Array.isArray(response.passed) && new Set(response.passed).size === response.passed.length &&
|
||||
response.passed.every(id => g.players.some(seat => seat.id === id))) {
|
||||
const pending = Object.entries(g).filter(([key, value]) => key.startsWith('pending') &&
|
||||
(Array.isArray(value) ? value.length > 0 : value !== null && value !== undefined && value !== false));
|
||||
const owner = g.players.find(seat => seat.id === response.owner);
|
||||
if (battlePowerResponse && !pending.length && g.phase === 6 &&
|
||||
Object.keys(response).sort().join(',') === 'kind,owner,passed') {
|
||||
try {
|
||||
currentCombatResponseQuote(g, {kind:'response', response:{kind:response.kind as 'voice' | 'prescience',
|
||||
owner:response.owner}, canceled:false});
|
||||
return true;
|
||||
} catch (error) { if (error instanceof RuleError) return false; throw error; }
|
||||
}
|
||||
if (response.kind === 'wormSurvival' && !pending.length && !g.battle && g.phase === 1 &&
|
||||
owner?.faction === 'fremen' && !!response.location && at(owner, response.location) > 0 &&
|
||||
Object.keys(response).every(key => ['kind','owner','passed','location','recipient'].includes(key)))
|
||||
return true;
|
||||
const arrivals = g.pendingArrivalReaction;
|
||||
if (response.kind === 'guildIncome' && !g.battle && g.phase === 5 && owner?.faction === 'guild' &&
|
||||
Object.keys(response).sort().join(',') === 'amount,kind,owner,passed' &&
|
||||
Number.isSafeInteger(response.amount) && response.amount! > 0 &&
|
||||
pending.length === 1 && pending[0][0] === 'pendingArrivalReaction' && arrivals?.length === 1) {
|
||||
const arrival = arrivals[0], entrant = g.players.find(seat => seat.id === arrival.entrant);
|
||||
return arrival.turn === g.turn && arrival.phase === 5 && arrival.cause === 'shipment' &&
|
||||
arrival.resume === 'none' && arrival.entrant === g.active && !!entrant &&
|
||||
(entrant.forces[location(arrival.territory,arrival.sector)] ?? 0) >= arrival.amount &&
|
||||
arrival.amount > 0 && arrival.elite >= 0 && arrival.elite <= arrival.amount &&
|
||||
Object.keys(arrival).every(key => ['entrant','territory','sector','amount','elite','cause','resume','turn','phase'].includes(key));
|
||||
}
|
||||
}
|
||||
if (nativeRoster && !g.phaseOpening && !g.choamMarket && !g.ixAuction && basicPendingMovement(g)) return true;
|
||||
if (nativeRoster && !g.phaseOpening && !g.choamMarket && !g.ixAuction &&
|
||||
!Object.entries(g).some(([key, value]) => key.startsWith('pending') &&
|
||||
|
||||
@@ -302,6 +302,7 @@ export const RULE_TOPICS: RuleTopic[] = [
|
||||
'In supported classic Advanced games, the Emperor may share spice before a pending Guild shipment-rate response continues. Allowing or canceling the gift returns to the same rate decision and shipment.',
|
||||
'You may pay out of turn when no decision or response is pending, including during Mentat after opening collection. In supported Basic games with classic or selected native expansion factions, direct bribes can also interrupt a normal auction-payment decision, Atreides auction inspection, Fremen allied-revival grant, ordinary Fremen or Ixian movement response, or CHOAM movement decision. Supported Basic Ix and Moritani games also allow payments during the Amal opening or an Extortion choice. The original parent and its passes remain pending. You cannot bribe yourself or your ally, or while Inflation shows Double. Emperor gifts to allies use their own power controls.',
|
||||
'Supported clean Basic games also permit a direct bribe while a Fremen worm-ride choice or winner’s optional battle-card decision is pending. The decision and physical pieces remain in place, and the recipient collects the bribe at the original Mentat opening. Other interruption families and optional combinations remain partial.',
|
||||
'In supported clean Basic games, direct bribes can also interrupt Fremen worm survival, Voice or Prescience, or the Guild income response after an already-paid ordinary shipment. The original response, battle or shipment and its waiting arrival remain intact. Live battle promises and other pending combinations remain limited.',
|
||||
'Your payment limit excludes reserved spending and preserves binding Truthtrance answers. If an alliance, pending decision or available supply changes, recheck the recipient and amount. A rejected payment does not change the game.',
|
||||
'In the Basic group preview, group allies are excluded from ordinary bribes and nonallied deals. Existing agreements remain recorded and can be released; a deferred bribe to a newly allied recipient stays pending while it is unavailable, subject to its original deadline.',
|
||||
'A qualifying Bureaucrat may divert two spice to the Bank without reducing the payer’s cost. The remainder stays deferred. Unsupported combinations remain unavailable and do not imply an official rule prohibition.',
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { viewGame, type Game } from '../game/engine';
|
||||
import { truthFactAnswer } from '../game/truthtrance';
|
||||
import {
|
||||
actTruthMixedBattle as act,
|
||||
bindTruthMixedBattle as bind,
|
||||
createTruthMixedBattleFixture as fixture,
|
||||
truthMixedBattleAction as action,
|
||||
truthMixedBattleFact as fact,
|
||||
truthMixedBattleGroup as group,
|
||||
truthMixedBattleInventory as inventory,
|
||||
truthMixedBattlePlayer as player,
|
||||
} from './fixture-truth-mixed-battle';
|
||||
|
||||
/** The native setup, movement, physical battle and Prescience opportunity are
|
||||
* real. Place one existing Karama from the unopened deck in Emperor's hand in
|
||||
* both branches so the actual Prescience response stays open. The residual
|
||||
* branch swaps Emperor's original projectile for an existing shield; both
|
||||
* branches have the same public hand count and conserved physical inventory. */
|
||||
function sources() {
|
||||
const f = fixture({window:'preparation'});
|
||||
const constant = structuredClone(f.game);
|
||||
const hand = player(constant,f.target).hand;
|
||||
const karama = constant.deck.findIndex(card => card.effect === 'karama');
|
||||
assert.ok(karama >= 0);
|
||||
hand.push(...constant.deck.splice(karama,1));
|
||||
const residual = structuredClone(constant), differentHand = player(residual,f.target).hand;
|
||||
const projectile = differentHand.findIndex(card => card.id === f.ordinary);
|
||||
const shield = residual.deck.findIndex(card => card.kind === 'shield');
|
||||
assert.ok(projectile >= 0 && shield >= 0);
|
||||
[differentHand[projectile],residual.deck[shield]] = [residual.deck[shield],differentHand[projectile]];
|
||||
assert.deepEqual(inventory(constant),f.originalCards);
|
||||
assert.deepEqual(inventory(residual),f.originalCards);
|
||||
assert.equal(player(constant,f.target).hand.length,player(residual,f.target).hand.length);
|
||||
assert.equal(truthFactAnswer(player(constant,f.target),f.heldFact),'yes');
|
||||
assert.equal(truthFactAnswer(player(residual,f.target),f.heldFact),'no');
|
||||
return {f,constant,residual};
|
||||
}
|
||||
|
||||
void test('a hidden mixed battle fact cannot change public bribe availability during Prescience', () => {
|
||||
const {f,constant,residual} = sources();
|
||||
// Same announced question and Yes answer: a held projectile makes the OR
|
||||
// already true; without it, the native unarmed plan satisfies the answer.
|
||||
const mixed = group('or',fact(f.heldFact),action({kind:'weapon',name:null}));
|
||||
const build = (source: Game) => {
|
||||
let game = bind(f,'yes',mixed,source).game;
|
||||
assert.equal(game.battle?.preparation?.kind,'prescience');
|
||||
game = act(game,f.asker,{type:'prescience',field:'weapon'});
|
||||
assert.equal(game.response?.kind,'prescience');
|
||||
return game;
|
||||
};
|
||||
const a = build(constant), b = build(residual);
|
||||
assert.equal(a.mixedBattleQuestions?.at(-1)?.binding,false);
|
||||
assert.equal(b.mixedBattleQuestions?.at(-1)?.binding,true);
|
||||
assert.equal(a.battle?.truthPromises?.length ?? 0,0);
|
||||
assert.equal(b.battle?.truthPromises?.length,1);
|
||||
assert.deepEqual(viewGame(a,f.asker).truthHistory,viewGame(b,f.asker).truthHistory);
|
||||
assert.deepEqual(a.response,b.response);
|
||||
for (const seat of a.players) {
|
||||
const aView = viewGame(a,seat.id), bView = viewGame(b,seat.id);
|
||||
assert.equal(aView.bribeOptions.blocked,bView.bribeOptions.blocked,
|
||||
`${seat.id} must not infer the private fact from bribe availability`);
|
||||
assert.ok(aView.bribeOptions.blocked,'Mixed answers remain outside this interruption prototype');
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,150 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { applyAction, createGame, joinGame, newPlayer, viewGame, type Action, type Game } from '../game/engine';
|
||||
import { nextStrongholdFactionsNativeStep } from './fixture-stronghold-factions';
|
||||
import {
|
||||
actFremenRevivalGrant as actBattle, advanceFremenRevivalGrant as advanceBattle,
|
||||
createFremenRevivalGrantFixture, fremenRevivalGrantPlayer as battlePlayer,
|
||||
fremenRevivalGrantInventory as battleInventory,
|
||||
} from './fixture-fremen-revival-grant';
|
||||
import {
|
||||
actSemutaDisasterWorm as actWorm, allowSemutaDisasterWorm,
|
||||
createSemutaDisasterWormFixture, semutaDisasterWormPlayer as wormPlayer,
|
||||
semutaDisasterWormInventory as wormInventory,
|
||||
} from './fixture-semuta-disaster-worm';
|
||||
|
||||
const player = (game: Game, id: string) => {
|
||||
const seat = game.players.find(candidate => candidate.id === id); assert.ok(seat); return seat;
|
||||
};
|
||||
const clean = (game: Game) => !game.phaseOpening && !game.response && !game.decision &&
|
||||
!game.pendingTreacheryDiscard && !game.truthtrance;
|
||||
function reject(game: Game, act: (game: Game, id: string, action: Action) => Game, id: string, action: Action) {
|
||||
const before = structuredClone(game);
|
||||
assert.throws(() => act(game, id, action));
|
||||
assert.deepEqual(game, before, 'A rejected payment must not mutate its input or pending parent');
|
||||
}
|
||||
function expectEscrow(before: Game, after: Game, payer: string, recipient: string, amount: number) {
|
||||
assert.equal(player(after, payer).spice, player(before, payer).spice - amount);
|
||||
assert.equal(player(after, recipient).spice, player(before, recipient).spice);
|
||||
assert.equal(player(after, recipient).bribes, player(before, recipient).bribes + amount);
|
||||
}
|
||||
|
||||
/** Genuine public Basic Atreides/Guild/Emperor setup and native phase controls.
|
||||
* Only unopened Treachery and Spice card positions are selected. Atreides pays
|
||||
* to ship one real reserve into Polar Sink; Emperor's original dealt Karama
|
||||
* keeps the native Guild-income response open. No game state is installed. */
|
||||
function guildIncomeSource() {
|
||||
let game = createGame('BRIBEGUILDINCOME', newPlayer('atreides', 'Atreides', 'atreides'), false);
|
||||
joinGame(game, newPlayer('guild', 'Guild', 'guild'));
|
||||
joinGame(game, newPlayer('emperor', 'Emperor', 'emperor'));
|
||||
for (const seat of game.players) game = applyAction(game, seat.id, { type: 'ready' });
|
||||
game = applyAction(game, game.host, { type: 'start' });
|
||||
assert.equal(game.status, 'setup');
|
||||
const ordinary = game.deck.filter(card => ['projectile', 'poison', 'shield', 'snooper'].includes(card.kind)).slice(0, 2);
|
||||
const karama = game.deck.find(card => card.effect === 'karama');
|
||||
assert.equal(ordinary.length, 2); assert.ok(karama);
|
||||
for (const [position, card] of [...ordinary, karama].entries()) {
|
||||
const from = game.deck.findIndex(candidate => candidate.id === card.id); assert.ok(from >= position);
|
||||
[game.deck[position], game.deck[from]] = [game.deck[from], game.deck[position]];
|
||||
}
|
||||
const reach = (until: (game: Game) => boolean) => {
|
||||
for (let count = 0; count < 1200 && !until(game); count++) {
|
||||
const step = nextStrongholdFactionsNativeStep(game); assert.ok(step);
|
||||
game = applyAction(game, step.actor, step.action);
|
||||
}
|
||||
assert.ok(until(game), 'The original Basic game must reach its native source');
|
||||
};
|
||||
reach(state => state.status === 'playing');
|
||||
assert.ok(player(game, 'emperor').hand.some(card => card.id === karama.id));
|
||||
for (const position of [0, 1]) {
|
||||
const from = game.spiceDeck.findIndex((card, index) => index >= position && 'territory' in card);
|
||||
assert.ok(from >= position);
|
||||
[game.spiceDeck[position], game.spiceDeck[from]] = [game.spiceDeck[from], game.spiceDeck[position]];
|
||||
}
|
||||
reach(state => state.phase === 5 && state.active === 'atreides' && clean(state));
|
||||
game = applyAction(game, 'atreides', {type:'ship', territory:'polar_sink', sector:0, amount:1, elite:0, allyPayment:0});
|
||||
assert.equal(game.response?.kind, 'guildIncome');
|
||||
assert.equal(game.response?.owner, 'guild');
|
||||
return game;
|
||||
}
|
||||
|
||||
void test('a Basic paid Guild shipment preserves its income response while a nonparticipant pays a bribe', () => {
|
||||
const source = guildIncomeSource(), payer = 'emperor', recipient = 'atreides';
|
||||
const response = structuredClone(source.response), active = source.active;
|
||||
const shipmentForces = structuredClone(player(source, recipient).forces);
|
||||
const pendingShipment = structuredClone(source.pendingShipment), aid = structuredClone(source.aid);
|
||||
const auction = structuredClone(source.auction);
|
||||
assert.equal(viewGame(source, payer).bribeOptions.blocked, null);
|
||||
reject(source, applyAction, payer, {type:'bribe', target:payer, amount:1});
|
||||
reject(source, applyAction, payer, {type:'bribe', target:recipient, amount:player(source, payer).spice + 1});
|
||||
const paid = applyAction(source, payer, {type:'bribe', target:recipient, amount:1});
|
||||
assert.deepEqual(paid.response, response);
|
||||
assert.equal(paid.active, active);
|
||||
assert.deepEqual(paid.pendingShipment, pendingShipment);
|
||||
assert.deepEqual(paid.aid, aid, 'Prepaid ally credit must not be rewritten');
|
||||
assert.deepEqual(paid.auction, auction, 'Any original reserved lot and bid stay in place');
|
||||
assert.deepEqual(player(paid, recipient).forces, shipmentForces);
|
||||
expectEscrow(source, paid, payer, recipient, 1);
|
||||
const control = applyAction(source, payer, {type:'passResponse'});
|
||||
const continued = applyAction(paid, payer, {type:'passResponse'});
|
||||
assert.deepEqual(continued.response, control.response);
|
||||
assert.equal(player(continued, 'guild').spice, player(control, 'guild').spice);
|
||||
assert.deepEqual(player(continued, recipient).forces, player(control, recipient).forces);
|
||||
assert.equal(player(continued, recipient).bribes, player(source, recipient).bribes + 1);
|
||||
});
|
||||
|
||||
/** Original classic Fremen/Atreides/Emperor paid Tabr battle. Atreides uses
|
||||
* its native Prescience against Fremen, with Emperor's originally dealt Karama
|
||||
* retaining the original cancellation opportunity. */
|
||||
function prescienceSource() {
|
||||
const fixture = createFremenRevivalGrantFixture();
|
||||
let game = actBattle(fixture.beforeBattle, fixture.battleStep.actor, fixture.battleStep.action);
|
||||
game = advanceBattle(game, state => !!state.battle && !state.phaseOpening && !state.response && !state.decision &&
|
||||
state.battle.preparation?.kind === 'prescience' && state.battle.preparation.owner === fixture.ally);
|
||||
game = actBattle(game, fixture.ally, {type:'prescience', field:'weapon'});
|
||||
assert.equal(game.response?.kind, 'prescience');
|
||||
return {fixture, game};
|
||||
}
|
||||
|
||||
void test('Basic Prescience keeps its original battle and response while another faction pays a bribe', () => {
|
||||
const {fixture:f, game:source} = prescienceSource(), payer = f.observer, recipient = f.fremen;
|
||||
const response = structuredClone(source.response), battle = structuredClone(source.battle);
|
||||
const cards = battleInventory(source);
|
||||
assert.equal(viewGame(source, payer).bribeOptions.blocked, null);
|
||||
const paid = actBattle(source, payer, {type:'bribe', target:recipient, amount:1});
|
||||
assert.deepEqual(paid.response, response);
|
||||
assert.deepEqual(paid.battle, battle);
|
||||
assert.deepEqual(battleInventory(paid), cards);
|
||||
expectEscrow(source, paid, payer, recipient, 1);
|
||||
const control = actBattle(source, payer, {type:'passResponse'});
|
||||
const continued = actBattle(paid, payer, {type:'passResponse'});
|
||||
assert.deepEqual(continued.response, control.response);
|
||||
assert.deepEqual(continued.battle, control.battle);
|
||||
assert.equal(battlePlayer(continued, recipient).bribes, battlePlayer(source, recipient).bribes + 1);
|
||||
assert.deepEqual(battleInventory(continued), cards);
|
||||
});
|
||||
|
||||
/** Public Basic selected-CHOAM setup and actual paid cache, native second-turn
|
||||
* Spice draw and natural Fremen protection response. The original fixture only
|
||||
* selects unopened card positions and original lotteries. */
|
||||
void test('Basic worm survival keeps its natural source and outcome through an out-of-turn bribe', () => {
|
||||
const f = createSemutaDisasterWormFixture({advanced:false, kind:'wormSurvival'});
|
||||
const source = f.game, payer = f.spender, recipient = f.guild;
|
||||
assert.equal(source.response?.kind, 'wormSurvival');
|
||||
const response = structuredClone(source.response), cards = wormInventory(source);
|
||||
assert.equal(viewGame(source, payer).bribeOptions.blocked, null);
|
||||
const paid = actWorm(source, payer, {type:'bribe', target:recipient, amount:1});
|
||||
assert.deepEqual(paid.response, response);
|
||||
assert.deepEqual(paid.spiceSequence, source.spiceSequence);
|
||||
assert.deepEqual(paid.wormRides, source.wormRides);
|
||||
assert.deepEqual(wormInventory(paid), cards);
|
||||
expectEscrow(source, paid, payer, recipient, 1);
|
||||
const control = allowSemutaDisasterWorm(source);
|
||||
const continued = allowSemutaDisasterWorm(paid);
|
||||
assert.deepEqual(continued.response, control.response);
|
||||
assert.deepEqual(continued.decision, control.decision);
|
||||
assert.deepEqual(continued.wormRides, control.wormRides);
|
||||
assert.deepEqual(wormPlayer(continued, f.owner).forces, wormPlayer(control, f.owner).forces);
|
||||
assert.equal(wormPlayer(continued, recipient).bribes, wormPlayer(source, recipient).bribes + 1);
|
||||
assert.deepEqual(wormInventory(continued), cards);
|
||||
});
|
||||
@@ -0,0 +1,52 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { applyAction, viewGame, type Action } from '../game/engine';
|
||||
import {
|
||||
createTruthTurnPowerFixture, truthTurnPowerInventory, truthTurnPowerPlayer,
|
||||
} from './fixture-truth-turn-power';
|
||||
|
||||
/** Public Basic setup and a paid shipment produce the native Arrakeen battle;
|
||||
* Emperor buys its original Karama in an ordinary auction. The source fixture
|
||||
* selects unopened draw order but does not assign a battle, hand or purse. */
|
||||
void test('a Basic combatant may bribe while Voice awaits its native Karama response', () => {
|
||||
const f = createTruthTurnPowerFixture({power: 'voice', remote: false});
|
||||
let game = applyAction(f.game, f.bg, {type: 'voice', kind: 'shield', must: false});
|
||||
assert.equal(game.response?.kind, 'voice');
|
||||
assert.ok(game.battle && [game.battle.attacker, game.battle.defender].includes(f.atreides));
|
||||
assert.ok(truthTurnPowerPlayer(game, f.emperor).hand.some(card => card.id === f.karama));
|
||||
const payer = truthTurnPowerPlayer(game, f.atreides);
|
||||
const recipient = truthTurnPowerPlayer(game, f.emperor);
|
||||
assert.ok(payer.spice > 0);
|
||||
assert.notEqual(payer.ally, recipient.id);
|
||||
const options = viewGame(game, payer.id).bribeOptions;
|
||||
assert.equal(options.blocked, null);
|
||||
const limit = options.targets.find(target => target.id === recipient.id)?.maximum;
|
||||
assert.ok(limit && limit >= 1);
|
||||
const illegal: Action = {type: 'bribe', target: recipient.id, amount: limit + 1};
|
||||
const unchanged = structuredClone(game);
|
||||
assert.throws(() => applyAction(game, payer.id, illegal));
|
||||
assert.deepEqual(game, unchanged, 'An over-limit payment cannot alter the declared Voice or response');
|
||||
|
||||
const originalBattle = structuredClone(game.battle), originalResponse = structuredClone(game.response);
|
||||
const originalCards = truthTurnPowerInventory(game);
|
||||
const amount = 1, balance = payer.spice, income = recipient.bribes;
|
||||
const paid = applyAction(game, payer.id, {type: 'bribe', target: recipient.id, amount});
|
||||
assert.deepEqual(paid.response, originalResponse);
|
||||
assert.deepEqual(paid.battle, originalBattle);
|
||||
assert.equal(truthTurnPowerPlayer(paid, payer.id).spice, balance - amount);
|
||||
assert.equal(truthTurnPowerPlayer(paid, recipient.id).spice, recipient.spice);
|
||||
assert.equal(truthTurnPowerPlayer(paid, recipient.id).bribes, income + amount);
|
||||
assert.deepEqual(truthTurnPowerInventory(paid), originalCards);
|
||||
|
||||
// The same physical Karama must cancel the original declared Voice once;
|
||||
// the payment neither spends that card nor grants the recipient its escrow.
|
||||
const cancel: Action = {type: 'card', card: f.karama, mode: 'cancel'};
|
||||
const expected = applyAction(game, f.emperor, cancel);
|
||||
game = applyAction(paid, f.emperor, cancel);
|
||||
assert.equal(game.battle?.voice, undefined);
|
||||
assert.deepEqual(game.battle, expected.battle);
|
||||
assert.deepEqual(game.response, expected.response);
|
||||
assert.equal(game.discard.filter(card => card.id === f.karama).length, 1);
|
||||
assert.equal(truthTurnPowerPlayer(game, recipient.id).bribes, income + amount);
|
||||
assert.deepEqual(truthTurnPowerInventory(game), originalCards);
|
||||
});
|
||||
@@ -48,6 +48,8 @@ void test('Recruits owner has an accessible physical-card action; rivals cannot
|
||||
assert.equal(viewGame(g, 'fr').recruitsPreview?.play, null);
|
||||
const card = g.players[0].hand.find((c) => c.id === 'ecaz-recruits')!;
|
||||
assert.ok(cardPresentation(card).topics.some((topic) => topic.id === 'card-recruits'));
|
||||
assert.match(cardPresentation(card).availability ?? '', /recovered.*played again/);
|
||||
assert.doesNotMatch(cardPresentation(card).availability ?? '', /replay remain guarded|Fremen grants.*guarded/);
|
||||
});
|
||||
|
||||
void test('late-paid controls allow provisional Recruits without refunding prior paid returns', () => {
|
||||
|
||||
Reference in new issue
Block a user