From 305837ab0f083dd7f9f054db26ce3db10c80921a Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 11 May 2021 12:40:52 +0200 Subject: 300 fix draw/discard display when more cards in draw queue than deck --- rules.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/rules.js b/rules.js index 3228a5e..eb1be0b 100644 --- a/rules.js +++ b/rules.js @@ -3251,8 +3251,6 @@ exports.view = function(state, current) { active: game.active, campaign: game.campaign, vp: game.vp, - deck_size: game.deck.length - game.greek.draw - game.persian.draw, - discard_size: game.discard.length, trigger: game.trigger, units: game.units, }; @@ -3261,6 +3259,15 @@ exports.view = function(state, current) { view.p_cards = game.persian.hand.length + game.persian.draw; view.discard = game.discard.length > 0 ? game.discard[game.discard.length-1] : 0; + let draw = game.greek.draw + game.persian.draw; + if (draw > game.deck.length) { + view.deck_size = game.deck.length + game.discard.length - draw; + view.discard_size = 0; + } else { + view.deck_size = game.deck.length - draw; + view.discard_size = game.discard.length; + } + states[game.state].prompt(view, current); view.prompt = $(view.prompt); -- cgit v1.2.3