summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-10-04 15:24:55 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 13:11:28 +0100
commitea1e0d445204857be2e0d3250d45200266f8b02b (patch)
tree5d683f87f90ea631ad0fa3a60cf5a9a08ed7b1e9
parentbd1c2fc7a716faff5dda84baf5e7a052b19a5b25 (diff)
downloadrommel-in-the-desert-ea1e0d445204857be2e0d3250d45200266f8b02b.tar.gz
Drop the turn info row in the sidebar.
Show card commitment in player rows as commitment + hand size.
-rw-r--r--play.html2
-rw-r--r--play.js13
-rw-r--r--rules.js10
3 files changed, 15 insertions, 10 deletions
diff --git a/play.html b/play.html
index 400dec9..c4b83ac 100644
--- a/play.html
+++ b/play.html
@@ -19,7 +19,6 @@ header { background-color: silver; }
header.your_turn { background-color: orange; }
#role_Axis .role_name { background-color: darkseagreen; }
#role_Allied .role_name { background-color: tan; }
-#turn_info { background-color: gainsboro; }
.role_supply { float: right; }
#log { background-color: ghostwhite; }
@@ -731,7 +730,6 @@ svg #lines line.axis_supply.allied_supply {
<div class="role_user">-</div>
</div>
</div>
- <div id="turn_info">1940</div>
</div>
<div id="log"></div>
</aside>
diff --git a/play.js b/play.js
index 99865f0..388984d 100644
--- a/play.js
+++ b/play.js
@@ -93,7 +93,6 @@ let ui = {
months: [],
axis_supply: document.getElementById("axis_supply"),
allied_supply: document.getElementById("allied_supply"),
- turn_info: document.getElementById("turn_info"),
hand: document.getElementById("hand"),
battle: document.getElementById("battle"),
battle_hits: [
@@ -1015,9 +1014,15 @@ function on_update() {
else
ui.pursuit.classList.add("hide")
- ui.axis_supply.textContent = view.axis_hand
- ui.allied_supply.textContent = view.allied_hand
- ui.turn_info.textContent = `Month: ${view.month} / ${view.end}\nSupply Commitment: ${view.commit}`
+ if (view.phasing === "Axis" && view.commit >= 0)
+ ui.axis_supply.textContent = view.commit + " + " + view.axis_hand
+ else
+ ui.axis_supply.textContent = view.axis_hand
+
+ if (view.phasing === "Allied" && view.commit >= 0)
+ ui.allied_supply.textContent = view.commit + " + " + view.allied_hand
+ else
+ ui.allied_supply.textContent = view.allied_hand
for (let i = 0; i < 28; ++i)
ui.cards[i].classList.toggle("action", !!(view.actions && view.actions.real_card))
diff --git a/rules.js b/rules.js
index 68c7181..d659421 100644
--- a/rules.js
+++ b/rules.js
@@ -2273,6 +2273,7 @@ function reveal_visited_minefields() {
// === SUPPLY COMMITMENT & TURN OPTION ===
function goto_turn_option() {
+ game.commit = [ 0, 0 ]
game.state = 'turn_option'
}
@@ -2392,7 +2393,7 @@ function goto_player_turn() {
set_clear(game.fired)
set_clear(game.moved)
- game.commit = [ 0, 0 ]
+ game.commit = null
goto_initial_supply_check()
}
@@ -2415,7 +2416,7 @@ function end_player_turn() {
log_br()
}
- game.commit = [ 0, 0 ]
+ game.commit = null
if (check_sudden_death_victory())
return
@@ -7056,7 +7057,7 @@ exports.setup = function (seed, scenario, options) {
allied_sides: [],
// current turn option and selected moves
- commit: [0, 0],
+ commit: null,
turn_option: null,
passed: 0,
side_limit: {},
@@ -7127,7 +7128,8 @@ exports.view = function(state, current) {
fortress: game.fortress,
axis_hand: game.axis_hand[REAL] + game.axis_hand[DUMMY],
allied_hand: game.allied_hand[REAL] + game.allied_hand[DUMMY],
- commit: game.commit[0] + game.commit[1],
+ phasing: game.phasing,
+ commit: game.commit ? (game.commit[0] + game.commit[1]) : -1,
axis_hexes: game.axis_hexes,
allied_hexes: game.allied_hexes,
axis_sides: game.axis_sides,