From f4fcc3f927412c4a89b032a99db07019a9b63749 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 5 May 2024 15:01:22 +0200 Subject: favicons --- favicons/conv.sh | 6 ++ favicons/favicon_henry_vi.png | Bin 11353 -> 0 bytes favicons/favicon_lancaster_buckingham.png | Bin 0 -> 13033 bytes favicons/favicon_lancaster_clarence.png | Bin 0 -> 9006 bytes favicons/favicon_lancaster_exeter.png | Bin 0 -> 11006 bytes favicons/favicon_lancaster_henry_tudor.png | Bin 0 -> 14157 bytes favicons/favicon_lancaster_henry_vi.png | Bin 0 -> 10940 bytes favicons/favicon_lancaster_jasper_tudor.png | Bin 0 -> 12588 bytes favicons/favicon_lancaster_margaret.png | Bin 0 -> 11409 bytes favicons/favicon_lancaster_northumberland.png | Bin 0 -> 10575 bytes favicons/favicon_lancaster_oxford.png | Bin 0 -> 9959 bytes favicons/favicon_lancaster_somerset.png | Bin 0 -> 14599 bytes favicons/favicon_lancaster_warwick.png | Bin 0 -> 10941 bytes favicons/favicon_march.png | Bin 14779 -> 0 bytes favicons/favicon_margaret.png | Bin 11615 -> 0 bytes favicons/favicon_warwick.png | Bin 14943 -> 0 bytes favicons/favicon_york.png | Bin 14112 -> 0 bytes favicons/favicon_york_devon.png | Bin 0 -> 9953 bytes favicons/favicon_york_edward_iv.png | Bin 0 -> 14075 bytes favicons/favicon_york_gloucester.png | Bin 0 -> 10762 bytes favicons/favicon_york_march.png | Bin 0 -> 14604 bytes favicons/favicon_york_norfolk.png | Bin 0 -> 12829 bytes favicons/favicon_york_northumberland.png | Bin 0 -> 10419 bytes favicons/favicon_york_pembroke.png | Bin 0 -> 13303 bytes favicons/favicon_york_rutland.png | Bin 0 -> 9551 bytes favicons/favicon_york_salisbury.png | Bin 0 -> 10870 bytes favicons/favicon_york_warwick.png | Bin 0 -> 11019 bytes favicons/favicon_york_york.png | Bin 0 -> 14409 bytes play.html | 2 +- play.js | 83 +++++++++++++++++++++++--- rules.ts | 11 +--- 31 files changed, 84 insertions(+), 18 deletions(-) create mode 100644 favicons/conv.sh delete mode 100644 favicons/favicon_henry_vi.png create mode 100644 favicons/favicon_lancaster_buckingham.png create mode 100644 favicons/favicon_lancaster_clarence.png create mode 100644 favicons/favicon_lancaster_exeter.png create mode 100644 favicons/favicon_lancaster_henry_tudor.png create mode 100644 favicons/favicon_lancaster_henry_vi.png create mode 100644 favicons/favicon_lancaster_jasper_tudor.png create mode 100644 favicons/favicon_lancaster_margaret.png create mode 100644 favicons/favicon_lancaster_northumberland.png create mode 100644 favicons/favicon_lancaster_oxford.png create mode 100644 favicons/favicon_lancaster_somerset.png create mode 100644 favicons/favicon_lancaster_warwick.png delete mode 100644 favicons/favicon_march.png delete mode 100644 favicons/favicon_margaret.png delete mode 100644 favicons/favicon_warwick.png delete mode 100644 favicons/favicon_york.png create mode 100644 favicons/favicon_york_devon.png create mode 100644 favicons/favicon_york_edward_iv.png create mode 100644 favicons/favicon_york_gloucester.png create mode 100644 favicons/favicon_york_march.png create mode 100644 favicons/favicon_york_norfolk.png create mode 100644 favicons/favicon_york_northumberland.png create mode 100644 favicons/favicon_york_pembroke.png create mode 100644 favicons/favicon_york_rutland.png create mode 100644 favicons/favicon_york_salisbury.png create mode 100644 favicons/favicon_york_warwick.png create mode 100644 favicons/favicon_york_york.png diff --git a/favicons/conv.sh b/favicons/conv.sh new file mode 100644 index 0000000..b61ef19 --- /dev/null +++ b/favicons/conv.sh @@ -0,0 +1,6 @@ +for F in seat_*.png +do + B=${F/seat/favicon} + echo $F $B + convert -background transparent $F -rotate 315 +repage -crop 270x270+125+150 +repage -colorspace RGB -resize 128x128! -colorspace sRGB $B +done diff --git a/favicons/favicon_henry_vi.png b/favicons/favicon_henry_vi.png deleted file mode 100644 index 3d7b22c..0000000 Binary files a/favicons/favicon_henry_vi.png and /dev/null differ diff --git a/favicons/favicon_lancaster_buckingham.png b/favicons/favicon_lancaster_buckingham.png new file mode 100644 index 0000000..0d7bc82 Binary files /dev/null and b/favicons/favicon_lancaster_buckingham.png differ diff --git a/favicons/favicon_lancaster_clarence.png b/favicons/favicon_lancaster_clarence.png new file mode 100644 index 0000000..4472e99 Binary files /dev/null and b/favicons/favicon_lancaster_clarence.png differ diff --git a/favicons/favicon_lancaster_exeter.png b/favicons/favicon_lancaster_exeter.png new file mode 100644 index 0000000..2b61cf2 Binary files /dev/null and b/favicons/favicon_lancaster_exeter.png differ diff --git a/favicons/favicon_lancaster_henry_tudor.png b/favicons/favicon_lancaster_henry_tudor.png new file mode 100644 index 0000000..63f46de Binary files /dev/null and b/favicons/favicon_lancaster_henry_tudor.png differ diff --git a/favicons/favicon_lancaster_henry_vi.png b/favicons/favicon_lancaster_henry_vi.png new file mode 100644 index 0000000..d45f071 Binary files /dev/null and b/favicons/favicon_lancaster_henry_vi.png differ diff --git a/favicons/favicon_lancaster_jasper_tudor.png b/favicons/favicon_lancaster_jasper_tudor.png new file mode 100644 index 0000000..5d8e009 Binary files /dev/null and b/favicons/favicon_lancaster_jasper_tudor.png differ diff --git a/favicons/favicon_lancaster_margaret.png b/favicons/favicon_lancaster_margaret.png new file mode 100644 index 0000000..824c4b9 Binary files /dev/null and b/favicons/favicon_lancaster_margaret.png differ diff --git a/favicons/favicon_lancaster_northumberland.png b/favicons/favicon_lancaster_northumberland.png new file mode 100644 index 0000000..9036a3d Binary files /dev/null and b/favicons/favicon_lancaster_northumberland.png differ diff --git a/favicons/favicon_lancaster_oxford.png b/favicons/favicon_lancaster_oxford.png new file mode 100644 index 0000000..4b443a6 Binary files /dev/null and b/favicons/favicon_lancaster_oxford.png differ diff --git a/favicons/favicon_lancaster_somerset.png b/favicons/favicon_lancaster_somerset.png new file mode 100644 index 0000000..a80de6d Binary files /dev/null and b/favicons/favicon_lancaster_somerset.png differ diff --git a/favicons/favicon_lancaster_warwick.png b/favicons/favicon_lancaster_warwick.png new file mode 100644 index 0000000..510a79c Binary files /dev/null and b/favicons/favicon_lancaster_warwick.png differ diff --git a/favicons/favicon_march.png b/favicons/favicon_march.png deleted file mode 100644 index c6225ad..0000000 Binary files a/favicons/favicon_march.png and /dev/null differ diff --git a/favicons/favicon_margaret.png b/favicons/favicon_margaret.png deleted file mode 100644 index 3d9bc1c..0000000 Binary files a/favicons/favicon_margaret.png and /dev/null differ diff --git a/favicons/favicon_warwick.png b/favicons/favicon_warwick.png deleted file mode 100644 index 1baf53c..0000000 Binary files a/favicons/favicon_warwick.png and /dev/null differ diff --git a/favicons/favicon_york.png b/favicons/favicon_york.png deleted file mode 100644 index 0ffb8be..0000000 Binary files a/favicons/favicon_york.png and /dev/null differ diff --git a/favicons/favicon_york_devon.png b/favicons/favicon_york_devon.png new file mode 100644 index 0000000..ca98895 Binary files /dev/null and b/favicons/favicon_york_devon.png differ diff --git a/favicons/favicon_york_edward_iv.png b/favicons/favicon_york_edward_iv.png new file mode 100644 index 0000000..fed5bf4 Binary files /dev/null and b/favicons/favicon_york_edward_iv.png differ diff --git a/favicons/favicon_york_gloucester.png b/favicons/favicon_york_gloucester.png new file mode 100644 index 0000000..3549afd Binary files /dev/null and b/favicons/favicon_york_gloucester.png differ diff --git a/favicons/favicon_york_march.png b/favicons/favicon_york_march.png new file mode 100644 index 0000000..6c8cd48 Binary files /dev/null and b/favicons/favicon_york_march.png differ diff --git a/favicons/favicon_york_norfolk.png b/favicons/favicon_york_norfolk.png new file mode 100644 index 0000000..62d5713 Binary files /dev/null and b/favicons/favicon_york_norfolk.png differ diff --git a/favicons/favicon_york_northumberland.png b/favicons/favicon_york_northumberland.png new file mode 100644 index 0000000..47fcd05 Binary files /dev/null and b/favicons/favicon_york_northumberland.png differ diff --git a/favicons/favicon_york_pembroke.png b/favicons/favicon_york_pembroke.png new file mode 100644 index 0000000..9ada90c Binary files /dev/null and b/favicons/favicon_york_pembroke.png differ diff --git a/favicons/favicon_york_rutland.png b/favicons/favicon_york_rutland.png new file mode 100644 index 0000000..a6b1fd9 Binary files /dev/null and b/favicons/favicon_york_rutland.png differ diff --git a/favicons/favicon_york_salisbury.png b/favicons/favicon_york_salisbury.png new file mode 100644 index 0000000..2646f6c Binary files /dev/null and b/favicons/favicon_york_salisbury.png differ diff --git a/favicons/favicon_york_warwick.png b/favicons/favicon_york_warwick.png new file mode 100644 index 0000000..d533894 Binary files /dev/null and b/favicons/favicon_york_warwick.png differ diff --git a/favicons/favicon_york_york.png b/favicons/favicon_york_york.png new file mode 100644 index 0000000..6c69dc0 Binary files /dev/null and b/favicons/favicon_york_york.png differ diff --git a/play.html b/play.html index 74a33e8..b0a9b7c 100644 --- a/play.html +++ b/play.html @@ -5,7 +5,7 @@ PLANTAGENET - + diff --git a/play.js b/play.js index 1190305..1a6194d 100644 --- a/play.js +++ b/play.js @@ -256,6 +256,45 @@ function is_lord_selected(ix) { return false } +const SCENARIO_IA = 0 +const SCENARIO_IB = 1 +const SCENARIO_IC = 2 +const SCENARIO_II = 3 +const SCENARIO_III = 4 + +const scenario_end_marker = [ + 16, + 2, + 8, + 16, + 10, +] + +function scenario_victory_threshold() { + let turn = view.turn >> 1 + switch (view.scenario) { + case SCENARIO_IA: + if (turn <= 5) + return 40 + if (turn <= 10) + return 35 + return 30 + case SCENARIO_IB: + return 100 // no threshold + case SCENARIO_IC: + return 25 + case SCENARIO_II: + if (turn <= 5) + return 40 + if (turn <= 10) + return 35 + return 30 + case SCENARIO_III: + return 45 + } + return 45 +} + // === BUILD UI === function is_action(action, arg) { @@ -1320,18 +1359,44 @@ function show_track_marker(elt, pos) { elt.style.top = y + "px" } +function update_lancaster_favicon() { + switch (view.scenario) { + default: + case SCENARIO_IA: return "favicons/favicon_lancaster_henry_vi.png" + case SCENARIO_IB: return "favicons/favicon_lancaster_somerset.png" + case SCENARIO_IC: return "favicons/favicon_lancaster_henry_vi.png" + case SCENARIO_II: return "favicons/favicon_lancaster_margaret.png" + case SCENARIO_III: return "favicons/favicon_lancaster_henry_tudor.png" + } +} + +function update_york_favicon() { + switch (view.scenario) { + default: + case SCENARIO_IA: return "favicons/favicon_york_york.png" + case SCENARIO_IB: return "favicons/favicon_york_warwick.png" + case SCENARIO_IC: return "favicons/favicon_york_march.png" + case SCENARIO_II: return "favicons/favicon_york_edward_iv.png" + case SCENARIO_III: return "favicons/favicon_york_gloucester.png" + } +} + +function update_observer_favicon() { + return "favicons/favicon_france.png" +} + function on_update() { restart_cache() switch (player) { case "York": - ui.favicon.href = "favicons/favicon_york.png" + ui.favicon.href = update_york_favicon() break case "Lancaster": - ui.favicon.href = "favicons/favicon_henry_vi.png" + ui.favicon.href = update_lancaster_favicon() break default: - ui.favicon.href = "favicons/favicon_warwick.png" + ui.favicon.href = update_observer_favicon() break } @@ -1385,10 +1450,11 @@ function on_update() { ui.turn.style.left = (CALENDAR_XY[view.turn >> 1][0] + 91 - 52) + "px" ui.turn.style.top = (CALENDAR_XY[view.turn >> 1][1] + 94) + "px" - if (view.end < 16) { + let end = scenario_end_marker[view.scenario] + if (end < 16) { ui.end.style.display = null - ui.end.style.left = (CALENDAR_XY[view.end][0] + 91 - 52) + "px" - ui.end.style.top = (CALENDAR_XY[view.end][1] + 94) + "px" + ui.end.style.left = (CALENDAR_XY[end][0] + 91 - 52) + "px" + ui.end.style.top = (CALENDAR_XY[end][1] + 94) + "px" } else { ui.end.style.display = "none" } @@ -1396,9 +1462,10 @@ function on_update() { ui.held_york.textContent = `${view.held_y} Held` ui.held_lancaster.textContent = `${view.held_l} Held` - if (view.victory_check <= 45) { + let vc = scenario_victory_threshold() + if (vc <= 45) { ui.victory_check.style.display = null - show_track_marker(ui.victory_check, view.victory_check) + show_track_marker(ui.victory_check, vc) } else { ui.victory_check.style.display = "none" } diff --git a/rules.ts b/rules.ts index ef7bb29..8ca0bd1 100644 --- a/rules.ts +++ b/rules.ts @@ -271,9 +271,8 @@ interface View { actions: any, log: string[], - end: number, + scenario: number, turn: number, - victory_check: number, influence: number, events: Card[], @@ -10022,7 +10021,6 @@ function setup_ItoIII() { set_flag(FLAG_REBEL_IS_YORK) game.active = YORK - game.victory_check = 45 game.influence = 0 muster_lord(LORD_YORK, LOC_ELY) muster_lord(LORD_MARCH, LOC_LUDLOW) @@ -10071,7 +10069,6 @@ function setup_II_Y() { game.scenario = "IIY. The Kingmaker" clear_flag(FLAG_REBEL_IS_YORK) game.active = LANCASTER - game.victory_check = 45 game.influence = 0 for (let lord of all_lords) { @@ -10194,7 +10191,6 @@ function setup_II_L() { game.scenario = "IIL. Lancastrian Legitimacy Fades" set_flag(FLAG_REBEL_IS_YORK) game.active = YORK - game.victory_check = 40 game.influence = 0 for (let lord of all_lords) { @@ -10323,7 +10319,6 @@ function setup_III_Y() { game.scenario = "IIIY. New Rivals" clear_flag(FLAG_REBEL_IS_YORK) game.active = LANCASTER - game.victory_check = 45 game.influence = 0 if (!is_lord_in_play(LORD_YORK)) { @@ -10520,7 +10515,6 @@ function setup_III_L() { game.scenario = "IIIL. Yorkists Last Stand" set_flag(FLAG_REBEL_IS_YORK) game.active = YORK - game.victory_check = 45 game.influence = 0 if (!is_lord_in_play(LORD_YORK)) { @@ -12912,9 +12906,8 @@ exports.view = function (state, current) { log: game.log, reveal: 0, - end: scenario_end_marker[game.scenario], + scenario: game.scenario, turn: game.turn, - victory_check: scenario_victory_threshold(), influence: game.influence, events: game.events, -- cgit v1.2.3