From b83c7f35103b43a9fae4ba9b0d4b98bd95a745b1 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 22 Jun 2023 23:03:32 +0200 Subject: Show barbarian dice in homeland region. --- play.css | 2 +- play.js | 25 +++++++++++++++++++++++- rules.js | 3 +++ tools/boxes.svg | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 80 insertions(+), 9 deletions(-) diff --git a/play.css b/play.css index fd8c0d6..f1f400a 100644 --- a/play.css +++ b/play.css @@ -140,7 +140,7 @@ body.military svg .sea.action { background-repeat: no-repeat; } -.dice.d0 { display: none; } +.dice.d0 { background-position: -100% 0 } .dice.d1 { background-position: 0% 0; } .dice.d2 { background-position: 20% 0; } .dice.d3 { background-position: 40% 0; } diff --git a/play.js b/play.js index 1aefd9b..baf4137 100644 --- a/play.js +++ b/play.js @@ -253,6 +253,11 @@ const BOXES = { "Goths XY": [ 2020, 360, 60, 60 ], "Alamanni XY": [ 1540, 280, 60, 60 ], "Franks XY": [ 1160, 300, 60, 60 ], + "Franks Dice": [785,160,100,50], + "Alamanni Dice": [1265,160,100,50], + "Goths Dice": [1730,195,100,50], + "Sassanids Dice": [2380,895,100,50], + "Nomads Dice": [570,1520,100,50], } const LAYOUT_XY = [ @@ -294,6 +299,14 @@ const LAYOUT_SUPPORT = [ BOXES["Syria Support"], ] +const LAYOUT_DICE = [ + BOXES["Alamanni Dice"], + BOXES["Franks Dice"], + BOXES["Goths Dice"], + BOXES["Nomads Dice"], + BOXES["Sassanids Dice"], +] + const LAYOUT_QUAESTOR = [ [ 971, 829 ], [ 1622, 994 ], @@ -855,7 +868,7 @@ function layout_governor_unavailable(e, color, ix) { function layout_mob(region, i, e, visible, x2) { if (visible) { - let [ x, y, w ,h ] = LAYOUT_SUPPORT[region] + let [ x, y, w, h ] = LAYOUT_SUPPORT[region] e.className = x2 ? "mob_x2" : "mob" e.style.top = (y - 36) + "px" e.style.left = (x + 26 + 26 * i) + "px" @@ -864,6 +877,14 @@ function layout_mob(region, i, e, visible, x2) { } } +function layout_barbarian_dice(black, white, tribe) { + let [ x, y, w, h ] = LAYOUT_DICE[tribe] + black.style.top = (y + 4) + "px" + white.style.top = (y + 4) + "px" + black.style.left = (x + 0) + "px" + white.style.left = (x + 50) + "px" +} + function on_update() { let player_count = view.legacy.length @@ -1153,8 +1174,10 @@ function on_update() { ui.dice[0].className = "dice black d" + view.dice[0] ui.dice[1].className = "dice white d" + view.dice[1] + ui.dice[2].className = "dice black d" + view.dice[2] ui.dice[3].className = "dice white d" + view.dice[3] + layout_barbarian_dice(ui.dice[2], ui.dice[3], view.crisis) if (view.events) { for (let c of view.events) diff --git a/rules.js b/rules.js index 8c7b846..d407d32 100644 --- a/rules.js +++ b/rules.js @@ -1088,6 +1088,8 @@ function goto_upkeep() { function goto_crisis() { game.dice[0] = roll_die() game.dice[1] = roll_die() + game.dice[2] = 0 + game.dice[3] = 0 log(`Crisis B${game.dice[0]} W${game.dice[1]}`) @@ -3292,6 +3294,7 @@ exports.view = function (state, player_name) { current: game.current, prompt: null, + crisis: game.crisis, support: game.support, mobs: game.mobs, militia: game.militia, diff --git a/tools/boxes.svg b/tools/boxes.svg index 6d7a190..8f81dcb 100644 --- a/tools/boxes.svg +++ b/tools/boxes.svg @@ -40,9 +40,9 @@ inkscape:window-height="480" id="namedview6" showgrid="true" - inkscape:zoom="0.56786857" - inkscape:cx="1692.2778" - inkscape:cy="1133.1474" + inkscape:zoom="1.4142136" + inkscape:cx="859.33219" + inkscape:cy="1408.35" inkscape:current-layer="svg4" inkscape:document-rotation="0"> + height="1650" + id="image2" + sodipodi:insensitive="true" /> + + + + + -- cgit v1.2.3