summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-12-15 12:50:36 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 13:02:38 +0100
commit7d019c80c7051b8a37d7bf9eb4b376b83a3ed8c3 (patch)
tree372419aaff80cfa5ea42e2702c895fb8a9c984a9
parent65dff0c518948bf6d552b92f01901320d40ba448 (diff)
downloadnevsky-7d019c80c7051b8a37d7bf9eb4b376b83a3ed8c3.tar.gz
Red locale highlight for laden march.
-rw-r--r--play.html7
-rw-r--r--play.js17
-rw-r--r--rules.js32
3 files changed, 37 insertions, 19 deletions
diff --git a/play.html b/play.html
index 565db0f..cc6ebe4 100644
--- a/play.html
+++ b/play.html
@@ -586,6 +586,10 @@ body.shift .mustered_vassals {
//box-shadow: 0 0 6px white, inset 0 0 6px 0px white;
}
+.locale.action.laden {
+ border-color: red;
+}
+
.locale.region {
border-radius: 50%;
}
@@ -601,6 +605,9 @@ body.shift .mustered_vassals {
.locale_extra.action {
box-shadow: 0 0 8px 2px white, inset 0 0 12px 2px white;
}
+.locale_extra.action.laden {
+ box-shadow: 0 0 8px 2px red, inset 0 0 12px 2px red;
+}
.locale_extra.traderoute { border-radius: 50% 30% 10% 10% }
.locale_extra.town { border-radius: 50% 50% 0 0 }
diff --git a/play.js b/play.js
index d37e5bd..1ba6ac3 100644
--- a/play.js
+++ b/play.js
@@ -178,6 +178,10 @@ function is_locale_action(locale) {
return !!(view.actions && view.actions.locale && set_has(view.actions.locale, locale))
}
+function is_laden_march_action(locale) {
+ return !!(view.actions && view.actions.laden_march && set_has(view.actions.laden_march, locale))
+}
+
function is_way_action(way) {
return !!(view.actions && view.actions.way && set_has(view.actions.way, way))
}
@@ -475,6 +479,7 @@ function on_click_locale(evt) {
if (evt.button === 0) {
let id = evt.target.my_id
send_action('locale', id)
+ send_action('laden_march', id)
}
}
@@ -1005,9 +1010,12 @@ function update_veche() {
}
function update_locale(loc) {
- ui.locale[loc].classList.toggle("action", is_locale_action(loc))
- if (ui.locale_extra[loc])
- ui.locale_extra[loc].classList.toggle("action", is_locale_action(loc))
+ ui.locale[loc].classList.toggle("action", is_locale_action(loc) || is_laden_march_action(loc))
+ ui.locale[loc].classList.toggle("laden", is_laden_march_action(loc))
+ if (ui.locale_extra[loc]) {
+ ui.locale_extra[loc].classList.toggle("action", is_locale_action(loc) || is_laden_march_action(loc))
+ ui.locale_extra[loc].classList.toggle("laden", is_laden_march_action(loc))
+ }
ui.locale_markers[loc].replaceChildren()
@@ -1230,9 +1238,6 @@ function on_update() {
update_plan()
update_cards()
- action_button("laden", "Laden")
- action_button("unladen", "Unladen")
-
action_button("use_legate", "Legate")
action_button("sail", "Sail")
diff --git a/rules.js b/rules.js
index 21a79b3..3855b1a 100644
--- a/rules.js
+++ b/rules.js
@@ -2228,7 +2228,7 @@ states.actions = {
else {
if (game.active === TEUTONS) {
- if (game.count === 0 && is_located_with_legate() && !has_flag(FLAG_LEGATE))
+ if (game.count === 0 && is_located_with_legate(game.who) && !has_flag(FLAG_LEGATE))
view.actions.use_legate = 1
}
@@ -2255,6 +2255,7 @@ states.actions = {
push_undo()
log(`Used Legate for +1 Command.`)
set_flag(FLAG_LEGATE)
+ set_delete(game.group, LEGATE)
game.call_to_arms.legate = LEGATE_ARRIVED
},
pass() {
@@ -2376,22 +2377,23 @@ states.march_laden = {
let prov = count_group_assets(PROV)
let loot = count_group_assets(LOOT)
- view.prompt = `March with ${loot} loot, ${prov} prov, and ${transport} usable transport.`
+ view.prompt = `March with ${loot} loot, ${prov} provender, and ${transport} transport.`
view.group = game.group
if (prov <= transport * 2) {
if (loot > 0 || prov > transport) {
let avail = get_available_actions()
- if (avail >= 2)
- view.actions.laden = 1
- view.actions.unladen = 0
+ if (avail >= 2) {
+ view.prompt += " Laden!"
+ gen_action_laden_march(to)
+ } else {
+ view.prompt += " Laden with 1 action left."
+ }
} else {
- view.actions.laden = 0
- view.actions.unladen = 1
+ gen_action_locale(to)
}
} else {
- view.actions.laden = 0
- view.actions.unladen = 0
+ view.prompt += " Carrying too much."
}
if (loot > 0 || prov > transport) {
@@ -2418,10 +2420,10 @@ states.march_laden = {
push_undo()
drop_loot(lord)
},
- laden() {
+ laden_march(to) {
march_with_group_2(true)
},
- unladen() {
+ locale(to) {
march_with_group_2(false)
},
}
@@ -2677,11 +2679,11 @@ function drop_loot(lord) {
function count_lord_ships(lord) {
let ships = get_lord_assets(lord, SHIP)
- if (lord_has_capability(AOW_TEUTONIC_COGS)) {
+ if (lord_has_capability(lord, AOW_TEUTONIC_COGS)) {
ships *= 2
}
- if (lord_has_capability(AOW_RUSSIAN_LODYA)) {
+ if (lord_has_capability(lord, AOW_RUSSIAN_LODYA)) {
// TODO: one option or the other (only matters for supply)
let boats = get_lord_assets(lord, BOAT)
if (boats > 2)
@@ -3323,6 +3325,10 @@ function gen_action_locale(locale) {
gen_action("locale", locale)
}
+function gen_action_laden_march(locale) {
+ gen_action("laden_march", locale)
+}
+
function gen_action_lord(lord) {
gen_action("lord", lord)
}