v0.4.2 fixed passenger trains not stopping at office. changeed revenue for train completing run - 1 point to every player when train exits division
This commit is contained in:
+16
-1
@@ -116,6 +116,12 @@ export type Game = {
|
||||
* clear it when the card is played — no element carries the class once the card leaves the hand.
|
||||
*/
|
||||
justDrawn: CardId | null;
|
||||
/**
|
||||
* A one-line announcement to flash, once. Drained like `scheduled` rather than read like `Frame`,
|
||||
* because it marks a MOMENT — the only event in the game that scores for everybody without anyone
|
||||
* having taken a turn to cause it.
|
||||
*/
|
||||
announced: string | null;
|
||||
};
|
||||
|
||||
/** How each intent kind is introduced in the action list, in the order they should appear. */
|
||||
@@ -150,7 +156,7 @@ export const SOLO_PLAYER = 'Solitaire';
|
||||
|
||||
export function newGame(seed: number, config: GameConfig = SOLO_CONFIG): Game {
|
||||
const state = createGame({ id: `web-${seed}`, seed, config, playerNames: [SOLO_PLAYER] });
|
||||
const game: Game = { state, seed, history: [], log: [], mustPlayCard: false, cues: [], scheduled: null, justDrawn: null };
|
||||
const game: Game = { state, seed, history: [], log: [], mustPlayCard: false, cues: [], scheduled: null, justDrawn: null, announced: null };
|
||||
// A history that opens mid-Stage reads as though something was missed. Say what the game IS
|
||||
// first, then let the clock take over.
|
||||
game.log.push({ text: 'Game Begins', tone: 'start' });
|
||||
@@ -685,6 +691,15 @@ function record(game: Game, events: GameEvent[], actor: PlayerIndex | null = nul
|
||||
for (const e of events) if (e.type === 'trainScheduled') game.scheduled = e.slot;
|
||||
// Which card just came into hand, so the row can badge it. Last one wins for the same reason.
|
||||
for (const e of events) if (e.type === 'cardDrawn') game.justDrawn = e.cardId;
|
||||
// A train that ran the whole Division pays EVERY player, and nobody did anything on this turn to
|
||||
// make it happen — so it is announced rather than left to be found in the log.
|
||||
for (const e of events) {
|
||||
if (e.type === 'trainCompleted') {
|
||||
game.announced =
|
||||
`Train ${e.isExtra ? 'X' : ''}${e.trainNumber} has completed its run, leaving via the ` +
|
||||
`${e.side === 'east' ? 'Eastern' : 'Western'} Division Point. All players get 1 Revenue.`;
|
||||
}
|
||||
}
|
||||
// Keep the log bounded; the full history lives in `history` and can be replayed.
|
||||
if (game.log.length > 400) game.log.splice(0, game.log.length - 400);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user