From 32c5d3a4b5bd208ba620ea336bc4b35835cf391b Mon Sep 17 00:00:00 2001 From: Frans Bongers Date: Fri, 24 Jan 2025 21:34:47 +0100 Subject: Disable button if icon cannot be resolved --- rules.js | 9 +++++++++ rules.ts | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/rules.js b/rules.js index 6920a5e..e85112a 100644 --- a/rules.js +++ b/rules.js @@ -516,6 +516,12 @@ function start_turn() { } next(); } +function player_can_resolve_icon(icon) { + if (icon === 'teamwork_on' && game.bonuses[data_1.TEAMWORK_BONUS] === data_1.ON) { + return false; + } + return true; +} states.activate_icon = { inactive: 'activate an icon', prompt() { @@ -524,6 +530,9 @@ states.activate_icon = { const c = cards[game.played_card]; for (const i of c.icons) { gen_action(i); + if (!player_can_resolve_icon(i)) { + view.actions[i] = 0; + } } }, spend_hp() { diff --git a/rules.ts b/rules.ts index 2cee300..45409a6 100644 --- a/rules.ts +++ b/rules.ts @@ -749,6 +749,13 @@ function start_turn() { // region STATES +function player_can_resolve_icon(icon: Icon): boolean { + if (icon === 'teamwork_on' && game.bonuses[TEAMWORK_BONUS] === ON) { + return false; + } + return true; +} + states.activate_icon = { inactive: 'activate an icon', prompt() { @@ -757,6 +764,9 @@ states.activate_icon = { const c = cards[game.played_card] as PlayerCard; for (const i of c.icons) { gen_action(i); + if (!player_can_resolve_icon(i)) { + view.actions[i] = 0; + } } }, spend_hp() { -- cgit v1.2.3