diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-07-14 15:52:50 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-16 19:19:39 +0100 |
commit | 1358a6e20963b36e8a82d856e30b358e527884ba (patch) | |
tree | 55c0959a34bb445b602aa7ea228d8bb40bba7865 /rules.js | |
parent | 4df24dfec4e012d4bba3235166034fba3c28d0fe (diff) | |
download | crusader-rex-1358a6e20963b36e8a82d856e30b358e527884ba.tar.gz |
crusader: Track who hasn't played their card yet.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -1148,9 +1148,20 @@ function goto_card_phase() { game.active = BOTH; } +function resume_play_card() { + if (game.s_card && game.f_card) + reveal_cards(); + else if (game.f_card) + game.active = SARACENS; + else if (game.s_card) + game.active = FRANKS; + else + game.active = BOTH; +} + states.play_card = { prompt: function (view, current) { - if (is_inactive_player(current)) + if (current === OBSERVER) return view.prompt = "Card Phase: Waiting for players to play a card."; if (current === FRANKS) { view.prior_s_card = game.prior_s_card; @@ -1186,8 +1197,7 @@ states.play_card = { remove_from_array(game.s_hand, card); game.s_card = card; } - if (game.s_card > 0 && game.f_card > 0) - reveal_cards(); + resume_play_card(); }, undo: function (_, current) { if (current === FRANKS) { @@ -1198,6 +1208,7 @@ states.play_card = { game.s_hand.push(game.s_card); game.s_card = 0; } + resume_play_card(); } } |