Fix mixed-deck Nexus Betrayal continuations
Verify and publish checkpoint container / container (push) Canceled after 0s
Verify and publish checkpoint container / container (push) Canceled after 0s
This commit is contained in:
1 parent
6204efb7e4
commit
7680e1ee69
15 files changed
+487
-46
No files matched your search
@@ -31,6 +31,10 @@ function nativeStep(game:Game):{actor:string;action:Action} {
|
||||
if(game.decision?.kind==='ixTechnology')
|
||||
return {actor:game.decision.player,action:{type:'decision',decline:true}};
|
||||
if(game.status==='playing' && !game.decision) {
|
||||
if(game.phase===2 && game.charityOrder?.remaining[0])
|
||||
return {actor:game.charityOrder.remaining[0],action:{type:'ready'}};
|
||||
if(game.phase===4 && game.revivalOrder?.remaining[0])
|
||||
return {actor:game.revivalOrder.remaining[0],action:{type:'ready'}};
|
||||
if(game.phase===0 && game.stormPending===null) return {actor:game.stormDialers.find(id=>game.stormDials[id]===undefined)!,action:{type:'stormDial',amount:game.turn===1?0:1}};
|
||||
if(game.phase===3 && game.auction) return {actor:game.auction.active,action:{type:'passBid'}};
|
||||
if(game.phase===5) return {actor:game.active!,action:{type:'endMovement'}};
|
||||
@@ -103,6 +107,23 @@ export function createIxianNexusBetrayalFixture(options:IxianBetrayalFixtureOpti
|
||||
} else game=step(game);
|
||||
}
|
||||
assert.equal(game.status,'playing');
|
||||
// Ixian setup shuffles the remaining starting cards before dealing, so the
|
||||
// earlier conserved deck order alone cannot guarantee Harkonnen's printed
|
||||
// Technology counter and a different card to return. Swap actual dealt
|
||||
// cards with another original hand or the deck, without creating cards.
|
||||
const harkonnen = game.players.find(p => p.faction === 'harkonnen');
|
||||
if (kind === 'technology' && harkonnen) {
|
||||
const sources = [game.deck, ...game.players.filter(p => p.id !== harkonnen.id).map(p => p.hand)];
|
||||
const ensure = (predicate: (card: Card) => boolean) => {
|
||||
if (harkonnen.hand.some(predicate)) return;
|
||||
const source = sources.find(cards => cards.some(predicate)); assert.ok(source);
|
||||
const index = source.findIndex(predicate);
|
||||
const replacement = harkonnen.hand.findIndex(card => !predicate(card)); assert.ok(replacement >= 0);
|
||||
[source[index], harkonnen.hand[replacement]] = [harkonnen.hand[replacement], source[index]];
|
||||
};
|
||||
ensure(card => card.effect === 'karama');
|
||||
ensure(card => card.effect !== 'karama');
|
||||
}
|
||||
for(let pos=0;pos<2;pos++) {
|
||||
const index=game.spiceDeck.findIndex((c,i)=>i>=pos&&'territory'in c);
|
||||
assert.ok(index>=pos);game.spiceDeck.splice(pos,0,game.spiceDeck.splice(index,1)[0]);
|
||||
|
||||
Reference in new issue
Block a user