diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-10-28 07:59:56 +0000 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-10-28 07:59:56 +0000 |
commit | b7c261893c9b85a38fdd6cc3bc3210c69c908125 (patch) | |
tree | 762442538181cda7b672c0c3e9551b9c164a395f /play.js | |
parent | 84c87bb49f4e4dd5dad535b2f0403d91dd9fdfb2 (diff) | |
download | 1989-dawn-of-freedom-b7c261893c9b85a38fdd6cc3bc3210c69c908125.tar.gz |
Fix game.played_card and show discard for events
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -647,7 +647,6 @@ function on_update() { ui.power_card_1.replaceChildren() ui.power_card_2.replaceChildren() - console.log('view.is_pwr_struggle', view.is_pwr_struggle, 'view.power_card_1', view.power_card_1, 'view.power_card_2', view.power_card_2) if (!view.is_pwr_struggle) { if (view.played_card > 0) ui.played_card.appendChild(ui.cards[view.played_card]) @@ -695,17 +694,24 @@ function on_update() { ui.ceausescu_hand.appendChild(ui.power_cards[c]) ui.discard.replaceChildren() - for (let c of view.strategy_discard) - ui.discard.appendChild(ui.cards[c]) + for (let c of view.strategy_discard) { + if (c === view.played_card) continue + ui.discard.appendChild(ui.cards[c]) } + if (view.discard) + document.getElementById("discard_panel").classList.remove("hide") + else + document.getElementById("discard_panel").classList.add("hide") ui.removed.replaceChildren() - for (let c of view.strategy_removed) - ui.removed.appendChild(ui.cards[c]) + for (let c of view.strategy_removed) { + if (c === view.played_card) continue + ui.removed.appendChild(ui.cards[c]) } ui.table_cards.replaceChildren() if (view.table_cards) - for (let c of view.table_cards) - ui.table_cards.appendChild(ui.cards[c]) + for (let c of view.table_cards) { + if (c === view.played_card) continue + ui.table_cards.appendChild(ui.cards[c]) } for (let e of action_register) e.classList.toggle("action", is_action(e.my_action, e.my_id)) |