From ba49b45691c35d4b4a1a484f0b8c26e2dcbad206 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 23 Jun 2021 14:37:40 +0200 Subject: crusader: Add Jihad badges. --- Cross_of_the_Knights_Templar.svg | 2 +- data.js | 2 +- jihad-christian.svg | 1 + jihad-muslim.svg | 1 + play.html | 12 +++++++++++- rules.js | 9 +++++++-- ui.js | 9 ++++++--- 7 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 jihad-christian.svg create mode 100644 jihad-muslim.svg diff --git a/Cross_of_the_Knights_Templar.svg b/Cross_of_the_Knights_Templar.svg index 235cf8a..0d0a7b5 100644 --- a/Cross_of_the_Knights_Templar.svg +++ b/Cross_of_the_Knights_Templar.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/data.js b/data.js index 2abeead..e23917f 100644 --- a/data.js +++ b/data.js @@ -110,7 +110,7 @@ const TOWNS = { "Latakia":{"x":401,"y":445}, "Legio":{"x":587,"y":1658}, "Margat":{"x":540,"y":567}, - "Masyaf":{"x":758,"y":604}, + "Masyaf":{"x":756,"y":608}, "Monterrand":{"x":920,"y":603}, "Nablus":{"x":643,"y":1787}, "Qaddas":{"x":1145,"y":916}, diff --git a/jihad-christian.svg b/jihad-christian.svg new file mode 100644 index 0000000..196101e --- /dev/null +++ b/jihad-christian.svg @@ -0,0 +1 @@ + diff --git a/jihad-muslim.svg b/jihad-muslim.svg new file mode 100644 index 0000000..a1538be --- /dev/null +++ b/jihad-muslim.svg @@ -0,0 +1 @@ + diff --git a/play.html b/play.html index ff79e04..b374274 100644 --- a/play.html +++ b/play.html @@ -206,6 +206,17 @@ body.shift .block.known:hover { background-position: center; } +.block.Franks.jihad { + background-image: url("/crusader-rex/jihad-christian.svg"); + background-size: 60%; + background-position: center; +} +.block.Saracen.jihad { + background-image: url("/crusader-rex/jihad-muslim.svg"); + background-size: 60%; + background-position: center; +} + .block.r0 { transform: rotate(0deg); } .block.r1 { transform: rotate(-90deg); } .block.r2 { transform: rotate(-180deg); } @@ -396,7 +407,6 @@ body.shift .block.known:hover { - diff --git a/rules.js b/rules.js index c3fe05c..805a581 100644 --- a/rules.js +++ b/rules.js @@ -5,7 +5,7 @@ // TODO: can sea move into fortified port that is under attack but not yet besieged? // TODO: pause after battle ends to show final result/action - +// TODO: optional retreat after combat round 3 if storming exports.scenarios = [ "Third Crusade" @@ -3357,8 +3357,10 @@ function make_battle_view() { battle.title += " \u2014 Combat Deployment"; else battle.title += " \u2014 Round " + game.combat_round; - if (game.where == game.jihad) + if (game.where == game.jihad) { + battle.jihad = game.attacker[game.where]; battle.title += " \u2014 Jihad!"; + } function fill_cell(cell, owner, fn) { for (let b in BLOCKS) @@ -3470,6 +3472,9 @@ exports.view = function(state, current) { actions: null, }; + if (game.jihad && game.jihad != game.p1) + view.jihad = game.jihad; + states[game.state].prompt(view, current); if (states[game.state].show_battle) diff --git a/ui.js b/ui.js index dcf5648..f590fde 100644 --- a/ui.js +++ b/ui.js @@ -235,7 +235,6 @@ function on_button_end_move_phase(evt) { send_action('end_move_phase'); } function on_button_end_regroup(evt) { send_action('end_regroup'); } function on_button_end_retreat(evt) { send_action('end_retreat'); } function on_button_eliminate(evt) { send_action('eliminate'); } -function on_button_jihad(evt) { send_action('jihad'); } function build_battle_button(menu, b, c, click, enter, img_src) { let img = new Image(); @@ -591,7 +590,8 @@ function update_map() { element.classList = info.owner + known + " block" + image + steps + moved; } else { let besieging = (game.sieges[town] == info.owner) ? " besieging" : ""; - element.classList = info.owner + " block" + moved + besieging; + let jihad = (game.jihad == town) ? " jihad" : ""; + element.classList = info.owner + " block" + moved + besieging + jihad; } if (info.owner == FRANKS) layout[town].north.push(element); @@ -750,6 +750,10 @@ function update_battle() { ui.battle_block[block].classList.add("moved"); else ui.battle_block[block].classList.remove("moved"); + if (!show && (game.battle.jihad == block_owner(block))) + ui.battle_block[block].classList.add("jihad"); + else + ui.battle_block[block].classList.remove("jihad"); } for (let b in BLOCKS) { @@ -794,7 +798,6 @@ function on_update() { show_action_button("#end_move_phase_button", "end_move_phase"); show_action_button("#end_regroup_button", "end_regroup"); show_action_button("#end_retreat_button", "end_retreat"); - show_action_button("#jihad_button", "jihad"); show_action_button("#eliminate_button", "eliminate"); document.getElementById("frank_vp").textContent = game.f_vp; -- cgit v1.2.3