From 55578bb49831b1636e0a3ec6826d5a0844b953b0 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 23 Jun 2023 18:06:56 +0200 Subject: Pax Deorum. --- rules.js | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/rules.js b/rules.js index 6259195..a8c3227 100644 --- a/rules.js +++ b/rules.js @@ -1,12 +1,10 @@ "use strict" - /* TODO ---- [ ] cut holes for capital in region svg -[ ] crisis pax deorum [ ] combat battle screen - splay stack / dialog for watching contents and taking hits [ ] killed leader stash for buy/trash phase @@ -616,6 +614,10 @@ function next_player() { return (game.current + 1) % game.legacy.length } +function prev_player() { + return (game.current + game.legacy.length - 1) % game.legacy.length +} + function find_unused_legion() { for (let ix = 0; ix < LEGION_COUNT; ++ix) if (get_legion_location(ix) === AVAILABLE) @@ -1257,8 +1259,31 @@ states.ira_deorum = { function goto_pax_deorum() { logi("Pax Deorum") - logi("TODO") - goto_take_actions() + + game.count = game.current + + for (let p = 0; p < game.legacy.length; ++p) + if (game.draw[p].length === 0) + flip_discard_to_available(p) + + game.current = prev_player() + game.state = "pax_deorum" +} + +states.pax_deorum = { + prompt(player) { + prompt("Pax Deorum: Draw one card.") + for (let c of game.draw[player]) + gen_action_card(c) + }, + card(c, player) { + set_add(game.hand[player], c) + set_delete(game.draw[player], c) + if (game.current === game.count) + goto_take_actions() + else + game.current = prev_player() + }, } // CRISIS: BARBARIAN INVASION -- cgit v1.2.3