summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.css2
-rw-r--r--play.html4
-rw-r--r--play.js47
-rw-r--r--rules.js58
4 files changed, 89 insertions, 22 deletions
diff --git a/play.css b/play.css
index 49b9876..b8638f0 100644
--- a/play.css
+++ b/play.css
@@ -375,12 +375,14 @@ TWOD.piece.cylinder {
.card.action {
box-shadow: 0 0 0 4px white;
+ margin-top: -10px;
}
/*
.card.tc.reverse + .card.tc.reverse { margin-left: -200px; }
*/
+.draw-break { margin-left: 180px; }
.card.tc { margin-right: -180px; }
.panel_body { padding-right: calc(18px + 180px); }
diff --git a/play.html b/play.html
index a8ae42c..009ff21 100644
--- a/play.html
+++ b/play.html
@@ -56,6 +56,8 @@
</div>
</div>
+<div id="power_panel_list">
+
<div id="hand_prussia_panel" class="panel">
<div id="hand_prussia_header" class="panel_header">Prussia</div>
<div id="hand_prussia" class="panel_body">
@@ -98,6 +100,8 @@
</div>
</div>
+</div>
+
<div id="clock_of_fate_panel" class="panel">
<div id="clock_of_fate_header" class="panel_header">Clock of Fate</div>
<div id="clock_of_fate" class="panel_body">
diff --git a/play.js b/play.js
index fe7c12a..dc917f8 100644
--- a/play.js
+++ b/play.js
@@ -119,6 +119,17 @@ const ui = {
spaces_element: document.getElementById("spaces"),
pieces_element: document.getElementById("pieces"),
markers_element: document.getElementById("markers"),
+ clock_of_fate: document.getElementById("clock_of_fate"),
+ power_panel_list: document.getElementById("power_panel_list"),
+ hand: [
+ document.getElementById("hand_prussia"),
+ document.getElementById("hand_hanover"),
+ document.getElementById("hand_russia"),
+ document.getElementById("hand_sweden"),
+ document.getElementById("hand_austria"),
+ document.getElementById("hand_imperial"),
+ document.getElementById("hand_france"),
+ ],
cities: [],
action_register: [],
}
@@ -280,16 +291,6 @@ function on_init() {
for (let e of ui.turns)
ui.pieces_element.appendChild(e)
- ui.hand = [
- document.getElementById("hand_prussia"),
- document.getElementById("hand_hanover"),
- document.getElementById("hand_russia"),
- document.getElementById("hand_sweden"),
- document.getElementById("hand_austria"),
- document.getElementById("hand_imperial"),
- document.getElementById("hand_france"),
- ]
-
ui.tc = []
make_tc_deck(0)
make_tc_deck(1)
@@ -303,7 +304,8 @@ function on_init() {
make_tc_deck_back("deck_4"),
]
- ui.clock_of_fate = document.getElementById("clock_of_fate")
+ ui.tcbreak = document.createElement("div")
+ ui.tcbreak.className = "draw-break"
ui.fate = []
for (let fc = 0; fc <= 18; ++fc)
@@ -543,9 +545,27 @@ function on_update() {
ui.hand[pow].replaceChildren()
for (let c of view.hand[pow]) {
if ((c & 15) === 0)
- ui.hand[pow].append(ui.tc_back[c>>7][back[c>>7]++])
+ ui.hand[pow].appendChild(ui.tc_back[c>>7][back[c>>7]++])
else
- ui.hand[pow].append(ui.tc[c])
+ ui.hand[pow].appendChild(ui.tc[c])
+ }
+ }
+
+ if (false) {
+ if (view.draw) {
+ ui.draw_panel.classList.remove("hide")
+ ui.draw.replaceChildren()
+ for (let c of view.draw)
+ ui.draw.appendChild(ui.tc[c])
+ } else {
+ ui.draw_panel.classList.add("hide")
+ }
+ } else {
+ if (view.draw) {
+ if (view.hand[view.power].length > 0)
+ ui.hand[view.power].appendChild(ui.tcbreak)
+ for (let c of view.draw)
+ ui.hand[view.power].appendChild(ui.tc[c])
}
}
@@ -576,6 +596,7 @@ function on_update() {
action_button("next", "Next")
action_button("done", "Done")
+ action_button("end_cards", "End cards")
action_button("end_setup", "End setup")
action_button("end_recruit", "End recruit")
action_button("end_movement", "End movement")
diff --git a/rules.js b/rules.js
index 6d8f147..eaffc3a 100644
--- a/rules.js
+++ b/rules.js
@@ -363,14 +363,16 @@ function is_protected_from_reconquest(s) {
/* STATE */
-function turn_power_draw(pow) {
+function turn_power_draw() {
let n = 0
- if (game.scenario === 1 && pow === P_PRUSSIA) {
- n = 2
+ if (game.scenario === 1 && game.power === P_PRUSSIA) {
+ if (set_has(game.fate, FC_LORD_BUTE) || set_has(game.fate, FC_POEMS))
+ return 1
+ return 2
}
- switch (pow) {
+ switch (game.power) {
case P_PRUSSIA:
n = 7
if (set_has(game.fate, FC_LORD_BUTE))
@@ -785,16 +787,54 @@ function draw_next_tc() {
}
function goto_tactical_cards() {
- let pow = game.power
- let n = turn_power_draw(pow)
+ let n = turn_power_draw()
log("Draw " + n + " TC.")
+ game.draw = []
for (let i = 0; i < n; ++i)
- set_add(game.hand[pow], draw_next_tc())
+ set_add(game.draw, draw_next_tc())
+
+ game.state = "tactical_cards"
+}
+
+function should_power_discard_tc() {
+ if (game.power === P_FRANCE)
+ return true
+ if (game.scenario === 1 && game.power === P_PRUSSIA)
+ return true
+ return false
+}
+
+states.tactical_cards = {
+ prompt() {
+ view.draw = game.draw
+ if (should_power_discard_tc()) {
+ prompt("Drew " + game.draw.length + " TCs. Discard one of them.")
+ for (let c of game.draw)
+ gen_action_card(c)
+ } else {
+ prompt("Drew " + game.draw.length + " TCs.")
+ view.actions.end_cards = 1
+ }
+ },
+ card(c) {
+ push_undo()
+ set_delete(game.draw, c)
+ end_tactical_cards()
+ },
+ end_cards() {
+ end_tactical_cards()
+ },
+}
+
+function end_tactical_cards() {
+ for (let c of game.draw)
+ set_add(game.hand[game.power], c)
+ delete game.draw
// MARIA: supply is before movement
-
+
goto_movement()
}
@@ -2200,7 +2240,7 @@ exports.setup = function (seed, scenario, options) {
active: "Frederick",
power: P_PRUSSIA,
- turn: 5,
+ turn: 0,
step: 0,
clock: null,
fate: [],