summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-06-23 14:37:40 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-16 19:19:38 +0100
commitba49b45691c35d4b4a1a484f0b8c26e2dcbad206 (patch)
tree6ddf2893ee205e3d4592b2d0ff5c91c10448be88
parentb90969b17567a17d9f2ac44dac7b156daf3d887a (diff)
downloadcrusader-rex-ba49b45691c35d4b4a1a484f0b8c26e2dcbad206.tar.gz
crusader: Add Jihad badges.
-rw-r--r--Cross_of_the_Knights_Templar.svg2
-rw-r--r--data.js2
-rw-r--r--jihad-christian.svg1
-rw-r--r--jihad-muslim.svg1
-rw-r--r--play.html12
-rw-r--r--rules.js9
-rw-r--r--ui.js9
7 files changed, 28 insertions, 8 deletions
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 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="600" height="600"><path d="M 0,-250 H 600" fill="none" stroke="#c00" stroke-width="72" transform="translate(0,550)"/><path transform="translate(0,550) matrix(12,0,0,12,0,-550)" fill="#c00" d="M0 18L5 25 0 32z"/><path transform="translate(0,550) matrix(0,12,-12,0,600,-550)" fill="#c00" d="M0 32L0 18 5 25z"/><g><path d="M 0,25 H 50" fill="none" stroke="#c00" stroke-width="6" transform="matrix(0,-12,-12,0,600,600)"/><path fill="#c00" d="M0 32L0 18 5 25z" transform="matrix(0,-12,-12,0,600,600)"/><path transform="matrix(0,-12,-12,0,600,600) rotate(90,25,25)" fill="#c00" d="M5 25L0 32 0 18z"/></g></svg> \ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" width="600" height="600"><path d="M0 300h600" fill="none" stroke="#c00" stroke-width="72"/><path fill="#c00" d="M0 216l60 84-60 84zM216 0h168l-84 60z"/><path d="M300 600V0" fill="none" stroke="#c00" stroke-width="72"/><path fill="#c00" d="M216 600h168l-84-60zM540 300l60 84V216z"/></svg> \ 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 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="600" height="600"><g opacity="0.3"><path d="M0 300h600" fill="none" stroke="#000" stroke-width="72"/><path fill="#000" d="M0 216l60 84-60 84zM216 0h168l-84 60z"/><path d="M300 600V0" fill="none" stroke="#000" stroke-width="72"/><path fill="#000" d="M216 600h168l-84-60zM540 300l60 84V216z"/></g></svg>
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 @@
+<svg width="248.87" height="215.85" viewBox="0 0 65.847 57.11" xmlns="http://www.w3.org/2000/svg"><g fill="#000" opacity="0.3"><path d="M28.02.53C12.797.82.534 13.264.534 28.553c0 15.47 12.56 28.029 28.03 28.029a27.924 27.924 0 0018.801-7.251 23.821 23.821 0 01-11.906 3.166c-13.21 0-23.928-10.718-23.928-23.928S22.25 4.64 35.46 4.64a23.82 23.82 0 0111.99 3.217A27.922 27.922 0 0028.563.53c-.181 0-.365-.003-.546 0z"/><path d="M65.32 28.57L41.2 36.408l14.906-20.516v25.36L41.201 20.733z"/></g></svg>
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 {
<button id="end_retreat_button" class="hide" onclick="on_button_end_retreat()">End retreat</button>
<button id="end_regroup_button" class="hide" onclick="on_button_end_regroup()">End regroup</button>
<button id="end_move_phase_button" class="hide" onclick="on_button_end_move_phase()">End move phase</button>
- <button id="jihad_button" class="hide" onclick="on_button_jihad()">Jihad</button>
<button id="pass_button" class="hide" onclick="on_button_pass()">Pass</button>
<button id="next_button" class="hide" onclick="on_button_next()">Next</button>
<button id="undo_button" class="hide" onclick="on_button_undo()">Undo</button>
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;