summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.js27
-rw-r--r--rules.js33
2 files changed, 56 insertions, 4 deletions
diff --git a/play.js b/play.js
index 8989551..fab015a 100644
--- a/play.js
+++ b/play.js
@@ -507,6 +507,7 @@ const ui = {
locale: [],
locale_name: [],
locale_markers: [],
+ locale_markers_rose: [],
lord_cylinder: [],
lord_mat: [],
lord_buttons: [],
@@ -684,8 +685,8 @@ function build_map() {
document.getElementById("locales").appendChild(e)
// Locale Markers
- e = ui.locale_markers[ix] = document.createElement("div")
- e.className = "locale marker rose favour " + locale.name // York to be removed - York/Lancaster
+ e = ui.locale_markers_rose[ix] = document.createElement("div")
+ e.className = "locale marker rose favour " + locale.name // York/Lancaster to add favour
e.style.top = y+h-small + "px"
e.style.left = x+ (w-small)/2 + "px"
e.style.width = small + "px"
@@ -698,7 +699,7 @@ function build_map() {
// Depleted markers
e = ui.locale_markers[ix] = document.createElement("div")
- e.className = "locale marker " + locale.name // Depleted to be removed - depleted/exhausted to add markers
+ e.className = "locale marker " + locale.name // depleted or exhausted to add markers
e.style.top = y+h-small-offsetdeplete + "px"
e.style.left = offsetdeplete+x+ (w-small)/2 + "px"
e.style.width = small + "px"
@@ -1121,7 +1122,7 @@ function update_locale(loc) {
else
ui.locale_markers[loc].appendChild(get_cached_element("marker circle battle"))
-
+ //DEPLETED/EXHAUSTED
if (!set_has(view.pieces.depleted,loc) && !set_has(view.pieces.exhausted,loc)) {
let cn
cn = "depleted"
@@ -1146,6 +1147,24 @@ function update_locale(loc) {
ui.locale_markers[loc].classList.remove(cn)
}
+
+ // FAVOUR MARKERS
+
+ if (set_has(view.pieces.favourl,loc)) {
+ let cn
+ cn = "lancaster"
+ ui.locale_markers_rose[loc].classList.add(cn)
+ cn = "york"
+ ui.locale_markers_rose[loc].classList.remove(cn)
+ }
+
+ if (set_has(view.pieces.favoury,loc)) {
+ let cn
+ cn = "york"
+ ui.locale_markers_rose[loc].classList.add(cn)
+ cn = "lancaster"
+ ui.locale_markers_rose[loc].classList.remove(cn)
+ }
}
function update_plan() {
diff --git a/rules.js b/rules.js
index f041364..397a7e3 100644
--- a/rules.js
+++ b/rules.js
@@ -1086,6 +1086,30 @@ function is_london(loc) {
function is_harlech(loc) {
return data.locales[loc].type === "harlech"
}
+function is_favour_friendly(loc, side) {
+ if (has_favoury_marker(loc) && side === "YORK")
+ return true
+ else if (has_favourl_marker(loc) && side === "LANCASTER")
+ return true
+ else
+ return false
+}
+
+function is_favour_enemy(loc, side) {
+ if (has_favoury_marker(loc) && side === "LANCASTER")
+ return true
+ else if (has_favourl_marker(loc) && side === "YORK")
+ return true
+ else
+ return false
+}
+
+function is_favour_neutral(loc) {
+ if (!has_favoury_marker(loc) && !has_favourl_marker(loc))
+ return true
+ else
+ return false
+}
function is_stronghold(loc) {
return data.locales[loc].stronghold > 0
@@ -1102,6 +1126,7 @@ function add_favourl_marker(loc) {
function remove_favourl_marker(loc) {
set_delete(game.pieces.favourl, loc)
}
+
function has_favoury_marker(loc) {
return set_has(game.pieces.favoury, loc)
}
@@ -1113,6 +1138,12 @@ function add_favoury_marker(loc) {
function remove_favoury_marker(loc) {
set_delete(game.pieces.favoury, loc)
}
+function parley_locale(loc, side) {
+ if (is_favour_friendly(loc, side))
+ set_delete(game.pieces.favoury, loc)
+ set_delete(game.pieces.favourl, loc)
+
+}
function has_exhausted_marker(loc) {
return set_has(game.pieces.exhausted, loc)
@@ -1446,6 +1477,8 @@ function setup_Ia(first_player, second_player) {
set_lord_cylinder_on_calendar(LORD_WARWICK_Y, 3)
set_lord_cylinder_on_calendar(LORD_RUTLAND, 5)
+ add_favourl_marker(LOC_LONDON)
+
}
function setup_Ib(first_player, second_player) {