Say who is playing, what you can press, and where you are in the Stage
Mostly presentation, plus one rules fix found on the way.
This commit is contained in:
@@ -635,3 +635,54 @@ describe('an industry handles every commodity its profile names (regression)', (
|
||||
assert.deepEqual(twoCommodity, ['powerPlant', 'grocersWarehouse']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('a Modifier only goes beside a host that can use it (regression)', () => {
|
||||
it('offers a Waiting Area no square that is not beside a Passenger Facility', () => {
|
||||
// REGRESSION. Every Modifier prints its host — a Waiting Area, Restaurant and Hotel go beside a
|
||||
// Passenger Facility; Forklifts beside a Freight House or Packing Sheds — and the placement
|
||||
// check ignored all of it, asking only "does this square touch ANY facility?". A Waiting Area
|
||||
// was therefore legal beside a Mine Tipple, and `applyModifier` handed its extra Porter to
|
||||
// whichever facility the scan happened to reach first. The player was shown three legal spots
|
||||
// for a card that has one.
|
||||
const s = game();
|
||||
const area = areaOf(s, 0);
|
||||
|
||||
// A freight industry away from the Office, and nothing else nearby.
|
||||
area.grid.set(coordKey({ row: -1, col: 4 }), {
|
||||
geometry: { kind: 'facility', facility: 'mineTipple', axis: 'ew' },
|
||||
baseOperationalRail: true, standing: [], modifiers: [], enhancements: [],
|
||||
facility: {
|
||||
kind: 'freight', subtype: 'mineTipple',
|
||||
allows: { outbound: true, inbound: false },
|
||||
outboundBox: [], inboundBox: [], capacity: { outbound: 1, inbound: 0 },
|
||||
menAtWork: [null, null, null],
|
||||
industryTrack: { length: 2, cars: [] },
|
||||
laborers: 1, porters: 0, usedThisStage: { laborers: 0, porters: 0 },
|
||||
},
|
||||
} as never);
|
||||
|
||||
const waiting = [...s.cards.entries()].find(
|
||||
([, c]) => c.kind.kind === 'modifier' && c.kind.modifier === 'waitingArea',
|
||||
);
|
||||
assert.ok(waiting, 'no Waiting Area card in the deck');
|
||||
const [cardId] = waiting!;
|
||||
s.decks.hands.set(0, [cardId]);
|
||||
applyIntent(s, 0, { type: 'localOps.choose', option: 'draw' });
|
||||
|
||||
const spots = legalActions(s, 0).filter(
|
||||
(i) => i.type === 'card.play' && i.cardId === cardId && i.placement !== undefined,
|
||||
);
|
||||
assert.ok(spots.length > 0, 'a Waiting Area has nowhere legal at all — the Office is a host');
|
||||
|
||||
// Every offered square must touch the Office and none may touch only the Mine Tipple.
|
||||
for (const i of spots) {
|
||||
const p = (i as { placement: { row: number; col: number } }).placement;
|
||||
const touchesOffice =
|
||||
Math.abs(p.row - area.officeCoord.row) <= 1 && Math.abs(p.col - area.officeCoord.col) <= 1;
|
||||
assert.ok(
|
||||
touchesOffice,
|
||||
`a Waiting Area was offered (${p.row}, ${p.col}), which is not beside a Passenger Facility`,
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user