diff options
-rw-r--r-- | play.css | 6 | ||||
-rw-r--r-- | play.js | 80 | ||||
-rw-r--r-- | rules.js | 30 |
3 files changed, 103 insertions, 13 deletions
@@ -382,9 +382,9 @@ span.suit.reserve { color: var(--color-reserve); font-weight: bold; font-family: .marker.subsidy_marker { background-image: url(markers/subsidy_marker.075.png) } .marker.income_minus_marker { background-image: url(markers/income_minus_marker.075.png) } .marker.income_plus_marker { background-image: url(markers/income_plus_marker.075.png) } -.marker.political_marker_italy { background-image: url(markers/political_marker_italy.100.png) } -.marker.political_marker_russia { background-image: url(markers/political_marker_russia.100.png) } -.marker.political_marker_saxony { background-image: url(markers/political_marker_saxony.100.png) } +.marker.political_marker_italy { background-image: url(markers/political_marker_italy.075.png) } +.marker.political_marker_russia { background-image: url(markers/political_marker_russia.075.png) } +.marker.political_marker_saxony { background-image: url(markers/political_marker_saxony.075.png) } /* TROOP NUMBER BADGE */ @@ -34,6 +34,9 @@ const ELIMINATED_GENERAL_DX = 50 const HUSSAR_X = 2190 const HUSSAR_Y = 1630 +const VICTORY_BOX_X = [ 115, 170, 235 ] +const VICTORY_BOX_Y = [ 235, 290, 345, 401 ] + /* DATA (SHARED) */ const deck_name = [ "red", "green", "blue", "yellow" ] @@ -51,6 +54,12 @@ const P_SAXONY = 5 const power_name = [ "France", "Prussia", "Pragmatic Army", "Austria", "Bavaria", "Saxony" ] const power_class = [ "france", "prussia", "pragmatic", "austria", "bavaria", "saxony" ] +const F_EMPEROR_FRANCE = 1 +const F_EMPEROR_AUSTRIA = 2 +const F_ITALY_FRANCE = 4 +const F_ITALY_AUSTRIA = 8 +const F_SILESIA_ANNEXED = 16 + const SPADES = 0 const CLUBS = 1 const HEARTS = 2 @@ -595,6 +604,13 @@ function on_init() { ui.turn = document.createElement("div") ui.turn.className = "marker turn_marker" + ui.saxony = document.createElement("div") + ui.saxony.className = "marker political_marker_saxony" + ui.russia = document.createElement("div") + ui.russia.className = "marker political_marker_russia" + ui.italy = document.createElement("div") + ui.italy.className = "marker political_marker_italy" + ui.political = [] for (let fc = 0; fc <= 18; ++fc) ui.political[fc] = make_political_card(fc) @@ -878,6 +894,23 @@ function layout_victory(s, pow) { ui.markers_element.appendChild(e) } +function layout_victory_box(pow, col, row) { + let e = ui.victory[pow][used_victory[pow]++] + let x = VICTORY_BOX_X[row] + let y = VICTORY_BOX_Y[col] + e.style.left = (x - 16) + "px" + e.style.top = (y - 16) + "px" + ui.markers_element.appendChild(e) +} + +function layout_political_marker(e, col, row) { + let x = 190 + (col-1) * 69 + let y = 72 + row * 86 + 16 + e.style.left = (x - 16) + "px" + e.style.top = (y - 16) + "px" + ui.political_display.appendChild(e) +} + function layout_retro(s, pow) { let e = ui.retro[pow][used_retro[pow]++] let x = data.cities.x[s] @@ -1012,15 +1045,10 @@ function on_update() { ui.hand[view.power].appendChild(ui.tc[c]) } - /* ui.political_display.replaceChildren() - if (view.oo > 0) - ui.political_display.appendChild(ui.tc[view.oo]) - ui.political_display.appendChild(ui.fate[0]) - if (typeof view.fate === "object") - for (let c of view.fate) - ui.political_display.appendChild(ui.fate[c]) - */ + layout_political_marker(ui.saxony, view.saxony, 0) + layout_political_marker(ui.russia, view.russia, 1) + layout_political_marker(ui.italy, view.italy, 2) for (let deck = 0; deck < 4; ++deck) { ui.discard[deck].replaceChildren() @@ -1042,6 +1070,42 @@ function on_update() { layout_victory_pool(P_PRUSSIA, 13, 1927, 76) layout_victory_pool(P_PRAGMATIC, 8, 797, 98) + // battle vp + if (view.vp[P_PRUSSIA] > 0) layout_victory_box(P_PRUSSIA, 0, 0) + if (view.vp[P_PRUSSIA] > 1) layout_victory_box(P_PRUSSIA, 0, 1) + if (view.vp[P_PRAGMATIC] > 0) layout_victory_box(P_PRAGMATIC, 1, 0) + if (view.vp[P_PRAGMATIC] > 1) layout_victory_box(P_PRAGMATIC, 1, 1) + if (view.vp[P_FRANCE] > 0) layout_victory_box(P_FRANCE, 2, 0) + if (view.vp[P_FRANCE] > 1) layout_victory_box(P_FRANCE, 2, 1) + if (view.vp[P_AUSTRIA] > 0) layout_victory_box(P_AUSTRIA, 3, 0) + if (view.vp[P_AUSTRIA] > 1) layout_victory_box(P_AUSTRIA, 3, 1) + + if (view.flags & F_SILESIA_ANNEXED) + layout_victory_box(P_PRUSSIA, 0, 2) + + let elector_france = 0 + let elector_pragmatic = 0 + for (let i = 0; i < 8; i += 2) { + if (view.elector[i+1] === P_FRANCE) + elector_france ++ + else + elector_pragmatic ++ + } + if (elector_france >= 3) + layout_victory_box(P_FRANCE, 1, 2) + if (elector_pragmatic >= 3) + layout_victory_box(P_PRAGMATIC, 1, 2) + + if (view.flags & F_ITALY_FRANCE) + layout_victory_box(P_FRANCE, 2, 2) + if (view.flags & F_ITALY_AUSTRIA) + layout_victory_box(P_AUSTRIA, 2, 2) + + if (view.flags & F_EMPEROR_FRANCE) + layout_victory_box(P_FRANCE, 3, 2) + if (view.flags & F_EMPEROR_AUSTRIA) + layout_victory_box(P_AUSTRIA, 3, 2) + layout_turn_marker() if (view.attacker !== undefined && view.defender !== undefined) { @@ -16,6 +16,13 @@ tc draw -- advanced -- +VICTORY BOXES + vp for winning (tracks) + electors (check victory markers) + emperor (bit) + italy (bit) + silesia (bit) + silesia home country for prussia tc subsidies @@ -81,6 +88,12 @@ const P_SAXONY = 5 const power_name = [ "France", "Prussia", "Pragmatic Army", "Austria", "Bavaria", "Saxony" ] const power_class = [ "france", "prussia", "pragmatic", "austria", "bavaria", "saxony" ] +const F_EMPEROR_FRANCE = 1 +const F_EMPEROR_AUSTRIA = 2 +const F_ITALY_FRANCE = 4 +const F_ITALY_AUSTRIA = 8 +const F_SILESIA_ANNEXED = 16 + const SPADES = 0 const CLUBS = 1 const HEARTS = 2 @@ -3252,6 +3265,13 @@ exports.setup = function (seed, _scenario, _options) { turn: 0, stage: 0, + + vp: [ 0, 0, 0, 0 ], // battle victory points + saxony: 2, // political track + russia: 6, // political track + italy: 5, // political track + flags: 0, // emperor vp, italy vp, silesia annexed, etc + pol_deck: null, deck: null, hand: [ [], [], [], [], [], [] ], @@ -3441,11 +3461,17 @@ exports.view = function (state, player) { log: game.log, turn: game.turn, + vp: game.vp, + saxony: game.saxony, + russia: game.russia, + italy: game.italy, + flags: game.flags, + victory: game.victory, + elector: game.elector, + pos: game.pos, oos: game.oos, supreme: game.supreme, - victory: game.victory, - elector: game.elector, troops: mask_troops(player), hand: mask_hand(player), pt: total_troops_list(), |