Support alliance answers with Richese Semuta
Verify and publish checkpoint container / container (push) Successful in 10m15s
Verify and publish checkpoint container / container (push) Successful in 10m15s
This commit is contained in:
1 parent
4dfdd500e0
commit
d6ddb7cb5c
15 files changed
+476
-19
No files matched your search
@@ -16,6 +16,11 @@ void test('printed Kull admission reuses the supported Basic CHOAM envelope', ()
|
||||
assert.equal(supported({ ...basic, players: [{ faction: 'emperor' }, { faction: 'guild' }] }), false);
|
||||
assert.equal(supported({ ...basic, players: [...basic.players, { faction: 'guild' }] }), false);
|
||||
assert.equal(supported({ ...basic, kullPreview: false }), true);
|
||||
const richese = { ...basic, players: [...basic.players, { faction: 'richese' }], semutaPreview: true };
|
||||
assert.equal(supported(richese), true);
|
||||
assert.equal(supported({ ...richese, kullPreview: false }), true);
|
||||
assert.equal(supported({ ...richese, advanced: true }), false);
|
||||
assert.equal(supported({ ...richese, nexusCards: true }), false);
|
||||
for (const flag of ['semutaPreview', 'nexusKullPreview', 'richeseBetrayalPreview',
|
||||
'guildBetrayalPreview', 'nexusIxianReplacementPreview', 'nexusIxianBetrayalPreview',
|
||||
'nexusHarkonnenBetrayalPreview', 'moritaniAssassinatePreview', 'nexusCards', 'homeworlds',
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { botActions } from '../game/bots';
|
||||
import { DIFFICULTIES } from '../game/bot-profiles';
|
||||
import { handLimit, viewGame, type Game } from '../game/engine';
|
||||
import type { TruthQuestion } from '../game/truthtrance';
|
||||
import { beforeIxSpiceDraw, orderIxSpiceCards } from './fixture-ix-spice-cards';
|
||||
import { nextKullPurposeStep } from './fixture-kull-purpose';
|
||||
import { act, advance, clean, createKullRicheseSemutaFixture, inventory, player } from './fixture-kull-richese-semuta';
|
||||
|
||||
/** The inherited native Basic game buys Semuta through the real Richese cache.
|
||||
* Only one original Truthtrance is moved from a physical zone to Harkonnen;
|
||||
* a later unopened Worm and replacement are selected before the Spice draw. */
|
||||
let initial: ReturnType<typeof createKullRicheseSemutaFixture> | undefined;
|
||||
function source(kull = true) {
|
||||
const f = initial ??= createKullRicheseSemutaFixture();
|
||||
let game = structuredClone(f.game);
|
||||
if (!kull) game.kullPreview = false;
|
||||
const zones = [game.deck, game.discard, ...(game.richeseCache ? [game.richeseCache] : []),
|
||||
...(game.richeseRemoved ? [game.richeseRemoved] : []), ...game.players.map(seat => seat.hand)];
|
||||
const zone = zones.find(cards => cards.some(card => card.effect === 'truthtrance')); assert.ok(zone);
|
||||
const [truth] = zone.splice(zone.findIndex(card => card.effect === 'truthtrance'), 1);
|
||||
assert.ok(player(game, 'harkonnen').hand.length < handLimit(player(game, 'harkonnen')));
|
||||
player(game, 'harkonnen').hand.push(truth);
|
||||
assert.deepEqual(inventory(game), f.originalCards);
|
||||
game = advance(game, state => state.turn === 2 && beforeIxSpiceDraw(state));
|
||||
orderIxSpiceCards(game, ['worm', 'land']);
|
||||
game = advance(game, state => state.phase === 1 && state.nexus && clean(state) && !state.spiceWindow && !state.spiceResolution);
|
||||
game = act(game, 'richese', {type:'alliance', target:'emperor'});
|
||||
return {...f, game, truth:truth.id};
|
||||
}
|
||||
function react(game:Game, card:string, claim:boolean):Game {
|
||||
const pending=game.pendingTreacheryDiscard; assert.ok(pending);
|
||||
assert.equal(pending.reaction?.stage,'offer');
|
||||
assert.ok(pending.batch.entries.some(entry => entry.card.id === card));
|
||||
const event=pending.batch.event;
|
||||
if (claim) {
|
||||
assert.equal(viewGame(game,'richese').semutaReaction?.canCommit,true);
|
||||
game=act(game,'richese',{type:'semutaCommit',event});
|
||||
if (game.pendingTreacheryDiscard?.reaction?.stage==='select')
|
||||
game=act(game,'richese',{type:'semutaSelect',event,card});
|
||||
} else {
|
||||
for (let count=0;game.pendingTreacheryDiscard?.batch.event===event && count<game.players.length;count++) {
|
||||
const response=game.pendingTreacheryDiscard!.reaction; assert.ok(response?.stage==='offer');
|
||||
const seat=game.players.find(player=>!response.passed.includes(player.id)); assert.ok(seat);
|
||||
game=act(game,seat.id,{type:'semutaPass',event});
|
||||
}
|
||||
}
|
||||
assert.notEqual(game.pendingTreacheryDiscard?.batch.event,event);
|
||||
return game;
|
||||
}
|
||||
type Kind = 'alliance' | 'allianceExpression' | 'mixedAlliance';
|
||||
function question(game:Game,kind:Kind):TruthQuestion {
|
||||
const partner = 'richese';
|
||||
if (kind === 'alliance') return {kind,target:'emperor',turn:game.turn,partner};
|
||||
if (kind === 'allianceExpression') return {kind,target:'emperor',turn:game.turn,
|
||||
claim:{kind:'partner',partner}};
|
||||
return {kind,target:'emperor',turn:game.turn,mixed:{kind:'and',terms:[
|
||||
{kind:'fact',fact:{kind:'spice',compare:'gte',value:0}},
|
||||
{kind:'action',action:{partner}},
|
||||
]}};
|
||||
}
|
||||
function ask(game:Game,truth:string,kind:Kind,answer:'yes'|'no'):Game {
|
||||
game=act(game,'harkonnen',{type:'card',card:truth});
|
||||
while (game.truthtrance?.stage==='priority') {
|
||||
const seat=game.players.find(player=>!game.truthtrance!.passed.includes(player.id)); assert.ok(seat);
|
||||
game=act(game,seat.id,{type:'truthPass'});
|
||||
}
|
||||
game=act(game,'harkonnen',{type:'truthAsk',question:question(game,kind)});
|
||||
const view=viewGame(game,'emperor');
|
||||
const answers=kind==='alliance'?view.truthAllianceAnswers:
|
||||
kind==='allianceExpression'?view.truthAllianceExpressionAnswers:view.truthMixedAllianceAnswers;
|
||||
assert.ok(answers,`${kind}: answer controls`);
|
||||
assert.ok(answers.includes(answer),`${kind}: ${answer}`);
|
||||
for (const difficulty of DIFFICULTIES) {
|
||||
const bot=viewGame(game,'emperor'); bot.players.find(player=>player.id==='emperor')!.bot=difficulty;
|
||||
const action=botActions(bot)[0]; assert.ok(action,difficulty);
|
||||
assert.equal(action.type,'truthAnswer',difficulty);
|
||||
assert.ok(answers.includes(action.answer as 'yes'|'no'|'unknown'),difficulty);
|
||||
assert.doesNotThrow(()=>act(game,'emperor',action),difficulty);
|
||||
}
|
||||
return act(game,'emperor',{type:'truthAnswer',answer});
|
||||
}
|
||||
function close(game:Game):Game {
|
||||
for (let count=0;count<300 && game.nexus;count++) {
|
||||
const row=game.players.map(p=>({p,guide:viewGame(game,p.id).alliancePromiseGuide})).find(entry=>entry.guide);
|
||||
const step=row ? {actor:row.p.id,action:row.guide!.action} : nextKullPurposeStep(game);
|
||||
assert.ok(step,'The ordinary Nexus must retain an owned continuation');
|
||||
game=act(game,step.actor,step.action);
|
||||
}
|
||||
assert.equal(game.nexus,false); return game;
|
||||
}
|
||||
/** Later Richese auctions choose an actual remaining cache card; Semuta was
|
||||
* purchased in turn one and cannot be selected from the cache again. */
|
||||
function advanceLater(game:Game, until:(game:Game)=>boolean):Game {
|
||||
for (let count=0;count<1800;count++) {
|
||||
if (until(game)) return game;
|
||||
if (!game.phaseOpening && !game.response && game.decision?.kind==='richeseCache') {
|
||||
const card=game.richeseCache?.[0]; assert.ok(card);
|
||||
game=act(game,game.decision.player,{type:'decision',event:game.richeseBidding!.event,card:card.id,method:'silent'});
|
||||
continue;
|
||||
}
|
||||
const lot=game.richeseAuction;
|
||||
if (lot && !lot.outcome && !game.phaseOpening && !game.response && !game.decision) {
|
||||
assert.equal(lot.method,'silent');
|
||||
const seat=lot.eligible.find(id=>!Object.hasOwn(lot.sealed,id)); assert.ok(seat);
|
||||
game=act(game,seat,{type:'richeseBid',event:lot.event,amount:seat==='richese'?1:0,allyPayment:0});
|
||||
continue;
|
||||
}
|
||||
const step=nextKullPurposeStep(game); assert.ok(step);
|
||||
game=act(game,step.actor,step.action);
|
||||
}
|
||||
throw Error('The native programme did not reach its requested window');
|
||||
}
|
||||
function answerRows(game:Game,kind:Kind) {
|
||||
const view=viewGame(game,'emperor');
|
||||
return kind==='alliance' ? view.alliancePromises :
|
||||
kind==='allianceExpression' ? view.allianceExpressionPromises : view.mixedAlliancePromises;
|
||||
}
|
||||
for (const kull of [false,true]) for (const kind of ['alliance','allianceExpression','mixedAlliance'] as const)
|
||||
for (const claim of [false,true]) void test(`${kull?'Kull':'non-Kull'} ${kind} answer survives Semuta ${claim?'claim':'pass'} of Truthtrance`,()=>{
|
||||
const f=source(kull); let game=ask(f.game,f.truth,kind,'yes');
|
||||
game=react(game,f.truth,claim);
|
||||
const guide=viewGame(game,'emperor').alliancePromiseGuide; assert.ok(guide);
|
||||
assert.equal(guide.action.type,'alliance'); assert.equal(guide.action.target,'richese');
|
||||
game=act(game,'emperor',guide.action);
|
||||
assert.equal(player(game,'emperor').ally,'richese');
|
||||
game=close(game);
|
||||
assert.ok(answerRows(game,kind).some(row=>row.fulfilled && !row.released));
|
||||
assert.equal(player(game,'richese').hand.some(card=>card.id===f.truth),claim);
|
||||
assert.deepEqual(inventory(game),f.originalCards);
|
||||
});
|
||||
void test('a No survives the Truth discard and requires a temporary alliance to end before Nexus close',()=>{
|
||||
const f=source(); let game=ask(f.game,f.truth,'alliance','no');
|
||||
game=react(game,f.truth,false);
|
||||
game=act(game,'emperor',{type:'alliance',target:'richese'});
|
||||
const before=structuredClone(game);
|
||||
assert.throws(()=>act(game,'emperor',{type:'ready'}));
|
||||
assert.deepEqual(game,before);
|
||||
const guide=viewGame(game,'emperor').alliancePromiseGuide; assert.ok(guide);
|
||||
assert.equal(guide.action.type,'alliance'); assert.equal(guide.action.target,null);
|
||||
game=act(game,'emperor',guide.action);
|
||||
game=close(game);
|
||||
assert.equal(player(game,'emperor').ally,null);
|
||||
assert.ok(answerRows(game,'alliance').some(row=>row.fulfilled && !row.released));
|
||||
});
|
||||
for (const counter of [false,true]) for (const claim of [false,true])
|
||||
void test(`completed alliance answer remains after later Kull ${counter?'counter':'success'} and Semuta ${claim?'claim':'pass'}`,()=>{
|
||||
const f=source(); let game=ask(f.game,f.truth,'alliance','yes');
|
||||
game=react(game,f.truth,false);
|
||||
const guide=viewGame(game,'emperor').alliancePromiseGuide; assert.ok(guide);
|
||||
game=act(game,'emperor',guide.action); game=close(game);
|
||||
const original=structuredClone(game.alliancePromises);
|
||||
game=advanceLater(game,state=>state.phase===5 && state.active==='emperor' && clean(state) &&
|
||||
!player(state,'emperor').shipped);
|
||||
game=act(game,'emperor',{type:'card',mode:'shipment',card:f.karama,target:'emperor'});
|
||||
const reaction=viewGame(game,'choam').kullReaction; assert.ok(reaction);
|
||||
game=act(game,'choam',{type:'kullDecision',event:reaction.event,source:'printed',card:f.kull});
|
||||
if (counter) game=act(game,'harkonnen',{type:'card',mode:'cancel',card:f.counter});
|
||||
else game=advance(game,state=>!!state.pendingTreacheryDiscard);
|
||||
game=react(game,counter?f.counter:f.kull,claim);
|
||||
game=advance(game,clean);
|
||||
assert.deepEqual(game.alliancePromises,original);
|
||||
assert.ok(answerRows(game,'alliance').some(row=>row.fulfilled && !row.released));
|
||||
assert.deepEqual(inventory(game),f.originalCards);
|
||||
});
|
||||
for (const claim of [false,true]) void test(`a mixed constant alliance answer survives Semuta ${claim?'claim':'pass'} without a residual promise`,()=>{
|
||||
const f=source(); let game=act(f.game,'harkonnen',{type:'card',card:f.truth});
|
||||
while (game.truthtrance?.stage==='priority') {
|
||||
const seat=game.players.find(player=>!game.truthtrance!.passed.includes(player.id)); assert.ok(seat);
|
||||
game=act(game,seat.id,{type:'truthPass'});
|
||||
}
|
||||
game=act(game,'harkonnen',{type:'truthAsk',question:{kind:'mixedAlliance',target:'emperor',turn:game.turn,
|
||||
mixed:{kind:'or',terms:[{kind:'fact',fact:{kind:'spice',compare:'gte',value:0}},
|
||||
{kind:'action',action:{partner:'richese'}}]}}});
|
||||
assert.ok(viewGame(game,'emperor').truthMixedAllianceAnswers?.includes('yes'));
|
||||
game=act(game,'emperor',{type:'truthAnswer',answer:'yes'});
|
||||
const answer=game.mixedAllianceQuestions?.at(-1); assert.ok(answer);
|
||||
assert.equal(answer.binding,false);
|
||||
assert.ok(!game.allianceExpressionPromises?.some(row=>row.event===answer.event));
|
||||
game=react(game,f.truth,claim);
|
||||
assert.deepEqual(game.mixedAllianceQuestions?.at(-1),answer);
|
||||
game=close(game);
|
||||
assert.ok(viewGame(game,'emperor').mixedAlliancePromises.some(row=>row.event===answer.event && row.fulfilled));
|
||||
assert.deepEqual(inventory(game),f.originalCards);
|
||||
});
|
||||
@@ -0,0 +1,81 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { registerHooks } from 'node:module';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { createElement } from 'react';
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { handLimit, viewGame, type Action, type Game, type GameView } from '../game/engine';
|
||||
import { beforeIxSpiceDraw, orderIxSpiceCards } from './fixture-ix-spice-cards';
|
||||
import { act, advance, clean, createKullRicheseSemutaFixture, inventory, player } from './fixture-kull-richese-semuta';
|
||||
|
||||
const aliases = registerHooks({
|
||||
resolve(specifier, context, next) {
|
||||
return next(specifier === 'next/image' ? 'vinext/shims/image' :
|
||||
specifier === 'next/link' ? 'vinext/shims/link' : specifier, context);
|
||||
},
|
||||
load(url, context, next) {
|
||||
if (!url.endsWith('.module.css')) return next(url, context);
|
||||
const css = readFileSync(new URL(url), 'utf8');
|
||||
const classes = Object.fromEntries([...css.matchAll(/\.([a-zA-Z_][\w-]*)/g)].map(match => [match[1], match[1]]));
|
||||
return {format:'module', source:`export default ${JSON.stringify(classes)}`, shortCircuit:true};
|
||||
},
|
||||
});
|
||||
const { GameTable } = await import('../components/game-table');
|
||||
const { Truthtrance } = await import('../components/truthtrance');
|
||||
const { AlliancePromiseGuideButton } = await import('../components/alliance-promises');
|
||||
aliases.deregister();
|
||||
|
||||
const table = (game:GameView) => renderToStaticMarkup(createElement(GameTable,
|
||||
{game,busy:false,send:async () => {},onExit() {}}));
|
||||
const truth = (game:GameView) => renderToStaticMarkup(createElement(Truthtrance,
|
||||
{game,busy:false,act() {}}));
|
||||
|
||||
/** The native Basic game purchases Semuta through Richese's real cache auction.
|
||||
* Only a physical Truthtrance is reassigned and an unopened Worm and replacement
|
||||
* are selected; the offer, question, Semuta pass and acceptance are real actions. */
|
||||
function source() {
|
||||
const f = createKullRicheseSemutaFixture();
|
||||
let game = structuredClone(f.game);
|
||||
const zones = [game.deck, game.discard, ...(game.richeseCache ? [game.richeseCache] : []),
|
||||
...(game.richeseRemoved ? [game.richeseRemoved] : []), ...game.players.map(seat => seat.hand)];
|
||||
const zone = zones.find(cards => cards.some(card => card.effect === 'truthtrance')); assert.ok(zone);
|
||||
const [card] = zone.splice(zone.findIndex(row => row.effect === 'truthtrance'), 1);
|
||||
const asker = player(game,'harkonnen'); assert.ok(asker.hand.length < handLimit(asker)); asker.hand.push(card);
|
||||
assert.deepEqual(inventory(game),f.originalCards);
|
||||
game = advance(game,state => state.turn === 2 && beforeIxSpiceDraw(state));
|
||||
orderIxSpiceCards(game,['worm','land']);
|
||||
game = advance(game,state => state.phase === 1 && state.nexus && clean(state) && !state.spiceWindow && !state.spiceResolution);
|
||||
game = act(game,'richese',{type:'alliance',target:'emperor'});
|
||||
game = act(game,'harkonnen',{type:'card',card:card.id});
|
||||
while (game.truthtrance?.stage === 'priority') {
|
||||
const seat = game.players.find(row => !game.truthtrance!.passed.includes(row.id)); assert.ok(seat);
|
||||
game = act(game,seat.id,{type:'truthPass'});
|
||||
}
|
||||
return {game,originalCards:f.originalCards};
|
||||
}
|
||||
|
||||
void test('Basic Kull and Richese render a genuine alliance question and owned acceptance guide',()=>{
|
||||
const f = source(); let game:Game = f.game;
|
||||
const asker = viewGame(game,'harkonnen');
|
||||
assert.ok(asker.truthAllianceTargets.includes('emperor'));
|
||||
assert.match(truth(asker), /<option value="alliance">Bind alliance membership at this Nexus close<\/option>/);
|
||||
assert.match(table(asker), /Bind alliance membership at this Nexus close/);
|
||||
game = act(game,'harkonnen',{type:'truthAsk',question:{kind:'alliance',target:'emperor',turn:game.turn,partner:'richese'}});
|
||||
const respondent = viewGame(game,'emperor');
|
||||
assert.ok(respondent.truthAllianceAnswers?.includes('yes'));
|
||||
assert.ok(respondent.truthAllianceAnswers?.includes('no'));
|
||||
assert.equal(viewGame(game,'harkonnen').truthAllianceAnswers,null);
|
||||
assert.match(truth(respondent),/Answer Yes/); assert.match(truth(respondent),/Answer No/);
|
||||
assert.match(table(respondent),/Answer Yes/); assert.match(table(respondent),/Answer No/);
|
||||
game = act(game,'emperor',{type:'truthAnswer',answer:'yes'});
|
||||
game = advance(game,clean);
|
||||
const own = viewGame(game,'emperor'), sent:Action[] = [];
|
||||
assert.ok(own.alliancePromiseGuide);
|
||||
assert.match(table(own),/Accept richese.*alliance invitation/);
|
||||
const button = AlliancePromiseGuideButton({game:own,busy:false,send(action) {sent.push(action);}});
|
||||
assert.ok(button); assert.equal(button.props.disabled,false); button.props.onClick();
|
||||
assert.deepEqual(sent,[own.alliancePromiseGuide.action]);
|
||||
game = act(game,'emperor',sent[0]);
|
||||
assert.equal(player(game,'emperor').ally,'richese');
|
||||
assert.deepEqual(inventory(game),f.originalCards);
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { territory } from '../game/board';
|
||||
import { createGame, joinGame, newPlayer, viewGame, type Game } from '../game/engine';
|
||||
import { SEMUTA_DRUG_ID } from '../game/semuta-drug';
|
||||
import { act, advance, clean, inventory, player } from './fixture-kull-richese-semuta';
|
||||
import { beforeIxSpiceDraw, orderIxSpiceCards } from './fixture-ix-spice-cards';
|
||||
|
||||
/** Public Basic setup, original cache purchase and a real Worm/Nexus. Only
|
||||
* unopened card positions and one physical Fremen reserve are selected: the
|
||||
* latter is placed at the previous blow so the real Worm creates a ride. */
|
||||
function source() {
|
||||
let game = createGame('ALLIANCERIDE', newPlayer('choam','CHOAM','choam'), false, ['choam','ix']);
|
||||
for (const faction of ['richese','fremen','emperor','guild'] as const)
|
||||
joinGame(game, newPlayer(faction,faction,faction));
|
||||
game = act(game,'choam',{type:'moduleOption',module:'kullPreview',enabled:true});
|
||||
for (const seat of game.players) game = act(game,seat.id,{type:'ready'});
|
||||
game = act(game,'choam',{type:'start'});
|
||||
assert.equal(game.status,'setup'); assert.ok(game.kullPreview && game.semutaPreview);
|
||||
const originalCards = inventory(game), selected: Game['deck'] = [];
|
||||
for (const kind of ['kull','filler','filler','filler','truth'] as const) {
|
||||
const index = game.deck.findIndex(card => kind === 'kull' ? card.id === 'ix-kull-wahad' :
|
||||
kind === 'truth' ? card.effect === 'truthtrance' : card.kind === 'worthless' && card.id !== 'ix-kull-wahad');
|
||||
assert.ok(index >= 0); selected.push(game.deck.splice(index,1)[0]);
|
||||
}
|
||||
game.deck.unshift(...selected);
|
||||
game = advance(game,state => state.status === 'playing');
|
||||
const truth = selected.at(-1)!.id;
|
||||
assert.ok(player(game,'guild').hand.some(card => card.id === truth));
|
||||
const land = game.spiceDeck.findIndex(card => 'territory' in card && !card.discovery &&
|
||||
territory(card.territory).type === 'sand');
|
||||
assert.ok(land >= 0); game.spiceDeck.unshift(game.spiceDeck.splice(land,1)[0]);
|
||||
game = advance(game,state => player(state,'richese').hand.some(card => card.id === SEMUTA_DRUG_ID));
|
||||
game = advance(game,state => state.turn === 2 && beforeIxSpiceDraw(state));
|
||||
const previous = game.spiceDiscard[0].findLast(card => 'territory' in card);
|
||||
assert.ok(previous && 'territory' in previous);
|
||||
const sector = territory(previous.territory).sectors.find(value => value !== game.storm);
|
||||
assert.notEqual(sector,undefined);
|
||||
const fremen = player(game,'fremen'); assert.ok(fremen.reserves >= 1);
|
||||
fremen.reserves--;
|
||||
const key = `${previous.territory}:${sector}`;
|
||||
fremen.forces[key] = (fremen.forces[key] ?? 0) + 1;
|
||||
orderIxSpiceCards(game,['worm','land']);
|
||||
game = advance(game,state => state.nexus && clean(state) && !state.spiceWindow && !state.spiceResolution);
|
||||
assert.deepEqual(game.wormRides,[previous.territory]);
|
||||
assert.deepEqual(inventory(game),originalCards);
|
||||
return {game,truth,originalCards,ride:previous.territory};
|
||||
}
|
||||
|
||||
for (const claim of [false,true]) void test(`Semuta ${claim ? 'claims' : 'passes'} alliance Truth while the Fremen ride waits`, () => {
|
||||
const f = source(); let game = act(f.game,'guild',{type:'card',card:f.truth});
|
||||
while (game.truthtrance?.stage === 'priority') {
|
||||
const next = game.players.find(seat => !game.truthtrance!.passed.includes(seat.id)); assert.ok(next);
|
||||
game = act(game,next.id,{type:'truthPass'});
|
||||
}
|
||||
game = act(game,'guild',{type:'truthAsk',question:{kind:'alliance',target:'emperor',turn:game.turn,partner:'choam'}});
|
||||
assert.ok(viewGame(game,'emperor').truthAllianceAnswers?.includes('no'));
|
||||
game = act(game,'emperor',{type:'truthAnswer',answer:'no'});
|
||||
const pending = game.pendingTreacheryDiscard; assert.ok(pending);
|
||||
assert.equal(pending.reaction?.stage,'offer');
|
||||
assert.deepEqual(game.wormRides,[f.ride]);
|
||||
const event = pending.batch.event;
|
||||
if (claim) {
|
||||
game = act(game,'richese',{type:'semutaCommit',event});
|
||||
if (game.pendingTreacheryDiscard?.reaction?.stage === 'select')
|
||||
game = act(game,'richese',{type:'semutaSelect',event,card:f.truth});
|
||||
} else for (let count=0;game.pendingTreacheryDiscard?.batch.event === event && count < game.players.length;count++) {
|
||||
const reaction = game.pendingTreacheryDiscard!.reaction; assert.ok(reaction?.stage === 'offer');
|
||||
const next = game.players.find(seat => !reaction.passed.includes(seat.id)); assert.ok(next);
|
||||
game = act(game,next.id,{type:'semutaPass',event});
|
||||
}
|
||||
assert.notEqual(game.pendingTreacheryDiscard?.batch.event,event);
|
||||
assert.deepEqual(game.wormRides,[f.ride]);
|
||||
assert.ok(game.alliancePromises?.some(row => row.player === 'emperor' && !row.released));
|
||||
for (const seat of game.players) if (!game.ready.includes(seat.id)) game = act(game,seat.id,{type:'ready'});
|
||||
assert.equal(game.decision?.kind,'wormRide');
|
||||
assert.equal(game.decision?.player,'fremen');
|
||||
game = act(game,'fremen',{type:'decision',accept:false});
|
||||
assert.equal(game.nexus,false);
|
||||
assert.ok(game.alliancePromises?.some(row => row.player === 'emperor' && row.fulfilled));
|
||||
assert.deepEqual(inventory(game),f.originalCards);
|
||||
});
|
||||
@@ -36,8 +36,8 @@ void test('Basic Kull and Semuta expose the bribe family only in the supported n
|
||||
}
|
||||
});
|
||||
|
||||
void test('Basic Semuta retains separate alliance and bid boundaries', () => {
|
||||
assert.equal(alliancePromiseModeSupported(profile),false);
|
||||
void test('Basic Semuta retains separate bid boundaries', () => {
|
||||
assert.equal(alliancePromiseModeSupported(profile),true);
|
||||
assert.equal(revivalPromiseModeSupported(profile),true);
|
||||
assert.equal(bidPromiseModeSupported(profile),false);
|
||||
assert.equal(currentBidPromiseModeSupported(profile),true);
|
||||
|
||||
@@ -35,8 +35,8 @@ void test('Basic Richese admits each Revival family with and without printed Kul
|
||||
'moritaniAssassinatePreview'] as const)
|
||||
assert.equal(quote({...profile,[key]:true}),false,key);
|
||||
}
|
||||
assert.equal(alliancePromiseModeSupported(profile),false);
|
||||
assert.equal(alliancePromiseModeSupported({...profile,kullPreview:false}),false);
|
||||
assert.equal(alliancePromiseModeSupported(profile),true);
|
||||
assert.equal(alliancePromiseModeSupported({...profile,kullPreview:false}),true);
|
||||
});
|
||||
|
||||
function assertRevivalTargets(game: ReturnType<typeof createGame>) {
|
||||
|
||||
@@ -33,7 +33,7 @@ void test('public host lobby shows the explicitly selected Kull preview and its
|
||||
assert.match(html,/Printed Kull is enabled by default/);
|
||||
assert.match(html,/Combined turn-action Truthtrance questions are unavailable/);
|
||||
assert.match(html,/Unfunded non-CHOAM Karama-dependent bids remain deferred/);
|
||||
assert.match(html,/When Richese is seated, alliance commitments are also unavailable/);
|
||||
assert.match(html,/Some Kull reactions may be unavailable in complex response windows/);
|
||||
const off = act(f.lobby,f.lobby.host,{type:'moduleOption',module:'kullPreview',enabled:false});
|
||||
const unselected = viewGame(off,off.host);
|
||||
assert.equal(unselected.lobbyModules?.kullPreview,false);
|
||||
|
||||
Reference in new issue
Block a user