INNER CODE UNIT · JavaScript
choice
Sisyphe42/ReignsAgent · packages/core/src/index.js:96
const choice = card.choices.find((candidate) => candidate.id === choiceId);
if (!choice) {
throw new CoreError(`Unknown choice '${choiceId}' for card '${card.id}'`);
}
applyChoice(choice, state, recordEvent);
state.dismissedCards.add(card.id);
state.currentCardId = null;
state.turn += 1;
const choiceEvent = recordEvent("choice", { cardId: card.id, choiceId: choice.id });
runActiveHooks("on_tick", state, { card, choice });
state.gameOver = evaluateGameOver(state.factions);
if (state.gameOver) {
recordEvent("game_over", state.gameOver);
}
return {