Add hoard_full.mjs test script for Hoard card interactions
- Covers three scenarios: basic Hoard play, Watchtower in hand, and Tiara armed - Verifies discard pile, pending actions, and supply changes after buying an estate
This commit is contained in:
parent
32761df1ff
commit
88b2ddfe16
|
|
@ -0,0 +1,31 @@
|
|||
import * as L from './src/games/dominion/DominionLogic.js';
|
||||
function hand(ids){ return ids.map((id,i)=>({iid:100+i, id})); }
|
||||
|
||||
// T1: exact user scenario - play Hoard, buy estate
|
||||
let s = L.newGame('prosperity', 2, 'beginners');
|
||||
s.players[0].hand = hand(['copper','copper','copper','hoard']);
|
||||
const b = {gold:s.supply.gold, estate:s.supply.estate};
|
||||
s = L.playTreasure(s, s.players[0].hand.find(c=>c.id==='hoard'));
|
||||
s = L.buyCard(s, 'estate');
|
||||
console.log('T1 log:', JSON.stringify(s.log.slice(-3)));
|
||||
console.log('T1 gold', b.gold,'->',s.supply.gold, '| estate', b.estate,'->',s.supply.estate);
|
||||
console.log('T1 discard:', s.players[0].discard.map(c=>c.id).join(','));
|
||||
|
||||
// T2: Watchtower in hand + Hoard in play, buy estate
|
||||
let s2 = L.newGame('prosperity', 2, 'beginners');
|
||||
s2.players[0].hand = hand(['copper','copper','copper','hoard','watchtower']);
|
||||
s2 = L.playTreasure(s2, s2.players[0].hand.find(c=>c.id==='hoard'));
|
||||
s2 = L.buyCard(s2, 'estate');
|
||||
console.log('\nT2 log:', JSON.stringify(s2.log.slice(-3)));
|
||||
console.log('T2 pending:', JSON.stringify(s2.pending));
|
||||
console.log('T2 discard:', s2.players[0].discard.map(c=>c.id).join(','), '| gold supply:', s2.supply.gold);
|
||||
|
||||
// T3: Tiara armed + Hoard in play, buy estate
|
||||
let s3 = L.newGame('prosperity', 2, 'beginners');
|
||||
s3.players[0].hand = hand(['copper','copper','copper','hoard','tiara']);
|
||||
s3 = L.playTreasure(s3, s3.players[0].hand.find(c=>c.id==='hoard'));
|
||||
s3 = L.playTreasure(s3, s3.players[0].hand.find(c=>c.id==='tiara'));
|
||||
s3 = L.buyCard(s3, 'estate');
|
||||
console.log('\nT3 log:', JSON.stringify(s3.log.slice(-3)));
|
||||
console.log('T3 pending:', JSON.stringify(s3.pending), '| tiaraTopdeckArmed:', s3.tiaraTopdeckArmed);
|
||||
console.log('T3 discard:', s3.players[0].discard.map(c=>c.id).join(','), '| gold supply:', s3.supply.gold);
|
||||
Loading…
Reference in New Issue