diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-05-10 01:01:47 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-05-24 21:06:18 +0200 |
commit | 67606c621d421cd2a5781928d94f3568cca78268 (patch) | |
tree | b25bef280cfbf46dae73b5f770003aa792a1c073 | |
parent | 6e11782299250cecad1ef3603f850859fa5769e6 (diff) | |
download | red-flag-over-paris-67606c621d421cd2a5781928d94f3568cca78268.tar.gz |
New panels.
-rw-r--r-- | play.html | 30 | ||||
-rw-r--r-- | play.js | 36 | ||||
-rw-r--r-- | rules.js | 29 |
3 files changed, 67 insertions, 28 deletions
@@ -48,16 +48,24 @@ body.Versailles header.your_turn { background-color: skyblue; } gap: 20px; } -#hand, #final, #discard, #objective, #set_aside { +#hand, #discard, #set_aside, #commune_cards, #versailles_cards { min-height: 350px; } #hand { min-width: 1060px } -#final { min-width: 250px } -#objective { min-width: 520px } +#commune_cards { min-width: 790px } +#versailles_cards { min-width: 790px } #set_aside { min-width: 790px } #discard { min-width: 250px } +#commune_cards_header { + background-color: #633; +} + +#versailles_cards_header { + background-color: #345; +} + #hand, #set_aside { flex-grow: 1 } @@ -447,19 +455,19 @@ body.Observer #set_aside_panel { display: none } <div id="hand" class="panel_body"></div> </div> -<div id="final_panel" class="panel"> -<div id="final_header" class="panel_header">Final</div> -<div id="final" class="panel_body"></div> -</div> - <div id="discard_panel" class="panel"> <div id="discard_header" class="panel_header">Discard</div> <div id="discard" class="panel_body"></div> </div> -<div id="objective_panel" class="panel"> -<div id="objective_header" class="panel_header">Objective</div> -<div id="objective" class="panel_body"></div> +<div id="versailles_cards_panel" class="panel"> +<div id="versailles_cards_header" class="panel_header">Versailles</div> +<div id="versailles_cards" class="panel_body"></div> +</div> + +<div id="commune_cards_panel" class="panel"> +<div id="commune_cards_header" class="panel_header">Commune</div> +<div id="commune_cards" class="panel_body"></div> </div> <div id="set_aside_panel" class="panel"> @@ -236,6 +236,11 @@ function build_user_interface() { document.getElementById("red_momentum").addEventListener("mousedown", on_click_red_momentum) document.getElementById("blue_momentum").addEventListener("mousedown", on_click_blue_momentum) + ui.red_objective_back = document.createElement("div") + ui.red_objective_back.className = "card card_objective_back" + ui.blue_objective_back = document.createElement("div") + ui.blue_objective_back.className = "card card_objective_back" + for (let c = 1; c <= 41 + 12; ++c) { elt = ui.cards[c] = document.createElement("div") elt.className = `card card_${c}` @@ -398,12 +403,32 @@ function on_update() { ui.political_vp.className = `piece cylinder orange vp${5+view.political_vp}` document.getElementById("hand").replaceChildren() - document.getElementById("final").replaceChildren() document.getElementById("discard").replaceChildren() document.getElementById("set_aside").replaceChildren() - document.getElementById("objective").replaceChildren() - if (view.final) - document.getElementById("final").appendChild(ui.cards[view.final]) + + // document.getElementById("final").replaceChildren() + // document.getElementById("objective").replaceChildren() + + document.getElementById("commune_cards").replaceChildren() + document.getElementById("versailles_cards").replaceChildren() + + if (view.red_final) + document.getElementById("commune_cards").appendChild(ui.cards[view.red_final]) + if (view.blue_final) + document.getElementById("versailles_cards").appendChild(ui.cards[view.blue_final]) + + if (view.red_objective === 0) + document.getElementById("commune_cards").appendChild(ui.red_objective_back) + else + for (let c of view.red_objective) + document.getElementById("commune_cards").appendChild(ui.cards[c]) + + if (view.blue_objective === 0) + document.getElementById("versailles_cards").appendChild(ui.blue_objective_back) + else + for (let c of view.blue_objective) + document.getElementById("versailles_cards").appendChild(ui.cards[c]) + if (view.discard) document.getElementById("discard").appendChild(ui.cards[view.discard]) if (view.hand) @@ -412,9 +437,6 @@ function on_update() { if (view.set_aside) for (let c of view.set_aside) document.getElementById("set_aside").appendChild(ui.cards[c]) - if (view.objective) - for (let c of view.objective) - document.getElementById("objective").appendChild(ui.cards[c]) for (let i = 0; i < space_names.length; ++i) layout[i] = [] @@ -1802,6 +1802,7 @@ function end_crisis_dimension_scoring() { function goto_objective_card_scoring() { log_h2("Objective Card Scoring") update_presence_and_control() + game.reveal_objectives = 1 game.active = game.initiative game.count = 3 game.state = "objective_card_scoring" @@ -1815,10 +1816,6 @@ function goto_objective_card_scoring() { states.objective_card_scoring = { prompt() { view.prompt = "Objective Card Scoring!" - if (game.active === COMMUNE) - view.objective = [ commune_objective_card(), versailles_objective_card() ] - else - view.objective = [ versailles_objective_card(), commune_objective_card() ] if (game.count & 1) gen_action_space(commune_objective_space()) if (game.count & 2) @@ -1852,10 +1849,12 @@ function resume_objective_card_events() { log_br() let c = commune_objective_card() let v = versailles_objective_card() - if (c || v) + if (c || v) { game.state = "objective_card_events" - else + } else { + delete game.reveal_objectives start_round() + } } states.objective_card_events = { @@ -1909,11 +1908,13 @@ function goto_final_crisis() { game.red_hand = game.red_set_aside if (game.red_final) game.red_hand.push(game.red_final) + game.red_final = 0 game.red_set_aside = [] game.blue_hand = game.blue_set_aside if (game.blue_final) game.blue_hand.push(game.blue_final) + game.blue_final = 0 game.blue_set_aside = [] game.active = "Both" @@ -2969,6 +2970,10 @@ exports.view = function(state, player) { blue_hand: game.blue_hand.length, red_momentum: game.red_momentum, blue_momentum: game.blue_momentum, + red_final: game.red_final, + blue_final: game.blue_final, + red_objective: 0, + blue_objective: 0, pieces: game.pieces, @@ -2981,15 +2986,19 @@ exports.view = function(state, player) { if (player === COMMUNE) { view.hand = game.red_hand - view.final = game.red_final view.set_aside = game.red_set_aside - view.objective = game.red_objective + view.red_objective = game.red_objective } + if (player === VERSAILLES) { view.hand = game.blue_hand - view.final = game.blue_final view.set_aside = game.blue_set_aside - view.objective = game.blue_objective + view.blue_objective = game.blue_objective + } + + if (game.reveal_objectives) { + view.red_objective = game.red_objective + view.blue_objective = game.blue_objective } if (game.state === "game_over") { |