summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-05-11 12:40:52 +0200
committerTor Andersson <tor@ccxvii.net>2023-02-18 12:42:59 +0100
commit305837ab0f083dd7f9f054db26ce3db10c80921a (patch)
treeb9c57b93955aac07436245da8b1924f986e7d6f5
parent90fa6f8ec7ef16640316eb0f6af933f44c41315c (diff)
download300-earth-and-water-305837ab0f083dd7f9f054db26ce3db10c80921a.tar.gz
300 fix draw/discard display when more cards in draw queue than deck
-rw-r--r--rules.js11
1 files 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);