From 2251bab21f032ef8b3f3a1c7d2d977b163da6161 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 18 Jan 2023 14:57:22 +0100 Subject: "Bad" and "Select" action colors for Calendar service markers. --- play.html | 49 +++++++++++-------------------------------------- play.js | 8 +++++++- rules.js | 16 ++++++++++------ 3 files changed, 28 insertions(+), 45 deletions(-) diff --git a/play.html b/play.html index 2498ae6..a11e38e 100644 --- a/play.html +++ b/play.html @@ -951,44 +951,17 @@ body.shift .mustered_vassals { pointer-events: none; } -.service_marker.teutonic.lord.selected { - box-shadow: 0 0 0 1px #111, 0 0 0 3px yellow; -} - -.service_marker.russian.lord.selected { - box-shadow: 0 0 0 1px #555, 0 0 0 3px yellow; -} - -.service_marker.teutonic.vassal.selected { - box-shadow: 0 0 0 1px #0f0d0d, 0 0 0 3px yellow; -} - -.service_marker.russian.vassal.selected { - box-shadow: 0 0 0 1px #736e5e, 0 0 0 3px yellow; -} - -.service_marker.teutonic.lord.action { - box-shadow: 0 0 0 1px #111, 0 0 0 3px red; -} - -.service_marker.russian.lord.action { - box-shadow: 0 0 0 1px #555, 0 0 0 3px red; -} - -.service_marker.teutonic.vassal.action { - box-shadow: 0 0 0 1px #0f0d0d, 0 0 0 3px white; -} - -.service_marker.russian.vassal.action { - box-shadow: 0 0 0 1px #736e5e, 0 0 0 3px white; -} - -.service_marker.teutonic.lord.selected, -.service_marker.teutonic.vassal.selected, -.service_marker.russian.lord.selected, -.service_marker.russian.vassal.selected { - box-shadow: 0 0 0 3px yellow; -} +.service_marker.teutonic.lord.selected { box-shadow: 0 0 0 1px #111, 0 0 0 4px yellow; } +.service_marker.russian.lord.selected { box-shadow: 0 0 0 1px #555, 0 0 0 4px yellow; } +.service_marker.teutonic.lord.action { box-shadow: 0 0 0 1px #111, 0 0 0 4px white; } +.service_marker.russian.lord.action { box-shadow: 0 0 0 1px #555, 0 0 0 4px white; } +.service_marker.teutonic.lord.action.bad { box-shadow: 0 0 0 1px #111, 0 0 0 4px tomato; } +.service_marker.russian.lord.action.bad { box-shadow: 0 0 0 1px #555, 0 0 0 4px tomato; } + +.service_marker.teutonic.vassal.selected { box-shadow: 0 0 0 1px #0f0d0d, 0 0 0 4px yellow; } +.service_marker.russian.vassal.selected { box-shadow: 0 0 0 1px #736e5e, 0 0 0 4px yellow; } +.service_marker.teutonic.vassal.action { box-shadow: 0 0 0 1px #0f0d0d, 0 0 0 4px white; } +.service_marker.russian.vassal.action { box-shadow: 0 0 0 1px #736e5e, 0 0 0 4px white; } .service_marker.lord { background-size: 90px 252px } .service_marker.vassal { background-size: 270px 210px } diff --git a/play.js b/play.js index 6539957..fd4237e 100644 --- a/play.js +++ b/play.js @@ -269,6 +269,10 @@ function is_service_action(lord) { return !!(view.actions && view.actions.service && set_has(view.actions.service, lord)) } +function is_service_bad_action(lord) { + return !!(view.actions && view.actions.service_bad && set_has(view.actions.service_bad, lord)) +} + function is_vassal_action(vassal) { return !!(view.actions && view.actions.vassal && set_has(view.actions.vassal, vassal)) } @@ -696,6 +700,7 @@ function on_click_lord_service_marker(evt) { if (evt.button === 0) { let id = evt.target.my_id send_action('service', id) + send_action('service_bad', id) } } @@ -1134,7 +1139,8 @@ function update_lord(ix) { ui.lord_cylinder[ix].classList.toggle("moved", is_lord_moved(ix)) ui.lord_buttons[ix].classList.toggle("action", is_lord_action(ix)) ui.lord_cylinder[ix].classList.toggle("action", is_lord_action(ix)) - ui.lord_service[ix].classList.toggle("action", is_service_action(ix)) + ui.lord_service[ix].classList.toggle("action", is_service_action(ix) || is_service_bad_action(ix)) + ui.lord_service[ix].classList.toggle("bad", is_service_bad_action(ix)) if (ix === LORD_HERMANN) ui.lord_cylinder[ix].classList.toggle("marshal", !is_lord_on_map(LORD_ANDREAS)) diff --git a/rules.js b/rules.js index 85fc4bc..86757cd 100644 --- a/rules.js +++ b/rules.js @@ -8936,9 +8936,9 @@ states.battle_service = { prompt() { view.prompt = "Battle: Roll to shift service of each retreated lord." for (let lord of game.battle.retreated) - gen_action_service(lord) + gen_action_service_bad(lord) }, - service(lord) { + service_bad(lord) { let die = roll_die() log(`L${lord} rolled ${die}.`) if (die <= 2) @@ -9091,7 +9091,7 @@ states.feed = { view.prompt = "You must shift the Service of any unfed lords." for (let lord = first_friendly_lord; lord <= last_friendly_lord; ++lord) { if (is_lord_unfed(lord)) { - gen_action_service(lord) + gen_action_service_bad(lord) done = false } } @@ -9120,7 +9120,7 @@ states.feed = { game.who = lord game.state = "feed_lord_shared" }, - service(lord) { + service_bad(lord) { push_undo() log(`Unfed L${lord}.`) add_lord_service(lord, -1) @@ -9356,14 +9356,14 @@ states.disband = { for (let lord = first_friendly_lord; lord <= last_friendly_lord; ++lord) { if (is_lord_on_map(lord) && get_lord_service(lord) <= current_turn()) { gen_action_lord(lord) - gen_action_service(lord) + gen_action_service_bad(lord) done = false } } if (done) view.actions.end_disband = 1 }, - service(lord) { + service_bad(lord) { this.lord(lord) }, lord(lord) { @@ -10035,6 +10035,10 @@ function gen_action_service(service) { gen_action("service", service) } +function gen_action_service_bad(service) { + gen_action("service_bad", service) +} + function gen_action_vassal(vassal) { gen_action("vassal", vassal) } -- cgit v1.2.3