diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-01-26 15:00:08 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 13:02:39 +0100 |
commit | 870052c751ea5c84231eafb8d4a374fb5142ee52 (patch) | |
tree | d49bd6ee4bb474ec40d4fd1d215ed905adde354e | |
parent | e122a7620958b111d95438493f1a8e3a6a051543 (diff) | |
download | nevsky-870052c751ea5c84231eafb8d4a374fb5142ee52.tar.gz |
Color H2 and H3 headers by active player.
-rw-r--r-- | play.html | 19 | ||||
-rw-r--r-- | play.js | 33 | ||||
-rw-r--r-- | rules.js | 56 |
3 files changed, 73 insertions, 35 deletions
@@ -17,19 +17,28 @@ main { background-color: dimgray; } #roles { background-color: gray; } header { background-color: silver; } header.your_turn { background-color: orange; } -#role_Teutons .role_name { background-color: #e1e6e8; } -#role_Russians .role_name { background-color: #e1d6c1; } +#role_Teutons .role_name { background-color: hsl(210,30%,80%); } +#role_Russians .role_name { background-color: hsl(35,40%,80%); } #turn_info { background-color: gainsboro; } .role_held { float: right; } #log { background-color: whitesmoke; } -#log .h1 { background-color: silver; font-weight: bold; padding-top:2px; padding-bottom:2px; text-align: center; } -#log .h2 { background-color: gainsboro; padding-top:2px; padding-bottom:2px; text-align: center; } -#log .h3 { text-decoration: underline; } +#log .h1 { font-weight: bold; padding-top:2px; padding-bottom:2px; text-align: center; } +#log .h2 { padding-top:2px; padding-bottom:2px; text-align: center; } +#log .h3 { text-align: center; } #log .h4 { text-decoration: underline; } +#log .h5 { text-decoration: underline; } + +#log .h1 { background-color: hsl(0,0%,80%); } +#log .h2.teutonic { background-color: hsl(210,30%,85%); } +#log .h2.russian { background-color: hsl(36,40%,85%); } +#log .h3.teutonic { background-color: hsl(210,30%,90%); } +#log .h3.russian { background-color: hsl(35,40%,90%); } + #log > .i { padding-left: 20px; } #log > .ii { padding-left: 32px; } #log > div > .i { padding-left: 12px; } + #log .card_tip { font-style: italic; } #log .card_tip:hover { text-decoration: underline; } #log .lord_tip:hover { cursor: pointer; text-decoration: underline; } @@ -945,23 +945,38 @@ function on_log(text) { text = text.substring(4) p.className = "h1" } - if (text.match(/^\.h2/)) { + else if (text.match(/^\.h2t/)) { + text = text.substring(5) + p.className = "h2 teutonic" + } + else if (text.match(/^\.h2r/)) { + text = text.substring(5) + p.className = "h2 russian" + } + else if (text.match(/^\.h2/)) { text = text.substring(4) - if (text.startsWith("Teuton")) - p.className = "h2 teutonic" - else if (text.startsWith("Russian")) - p.className = "h2 russian" - else - p.className = "h2" + p.className = "h2" + } + else if (text.match(/^\.h3t/)) { + text = text.substring(5) + p.className = "h3 teutonic" } - if (text.match(/^\.h3/)) { + else if (text.match(/^\.h3r/)) { + text = text.substring(5) + p.className = "h3 russian" + } + else if (text.match(/^\.h3/)) { text = text.substring(4) p.className = "h3" } - if (text.match(/^\.h4/)) { + else if (text.match(/^\.h4/)) { text = text.substring(4) p.className = "h4" } + else if (text.match(/^\.h5/)) { + text = text.substring(4) + p.className = "h5" + } p.innerHTML = text return p @@ -1944,7 +1944,6 @@ function end_setup_lords() { set_active_enemy() if (game.active === P1) { log_h1("Levy " + current_turn_name()) - log_h2("Arts of War") goto_levy_arts_of_war_first() } } @@ -3202,7 +3201,10 @@ function discard_card_event(c) { } function goto_levy_arts_of_war_first() { - log_br() + if (game.active === TEUTONS) + log_h2("Teutonic Arts of War") + else + log_h2("Russian Arts of War") game.state = "levy_arts_of_war_first" game.what = draw_two_cards() } @@ -3273,10 +3275,10 @@ function end_levy_arts_of_war_first() { // === LEVY: ARTS OF WAR === function goto_levy_arts_of_war() { - if (game.active === P1) - log_h2("Arts of War") + if (game.active === TEUTONS) + log_h2("Teutonic Arts of War") else - log_br() + log_h2("Russian Arts of War") game.what = draw_two_cards() resume_levy_arts_of_war() } @@ -6702,7 +6704,7 @@ function init_battle(here, is_storm, is_sally) { function start_battle() { let here = get_lord_locale(game.command) - log_h2(`Battle at %${here}`) + log_h3(`Battle at %${here}`) init_battle(here, 0, 0) @@ -6735,7 +6737,7 @@ function start_battle() { function start_sally() { let here = get_lord_locale(game.command) - log_h2(`Sally at %${here}`) + log_h3(`Sally at %${here}`) init_battle(here, 0, 1) @@ -6758,7 +6760,7 @@ function init_garrison(knights, men_at_arms) { function start_storm() { let here = get_lord_locale(game.command) - log_h2(`Storm at %${here}`) + log_h3(`Storm at %${here}`) init_battle(here, 1, 0) @@ -7375,13 +7377,13 @@ function goto_battle_rounds() { function goto_concede() { // No concede during first round of Storm if (game.battle.storm) { - log_h3(`Storm Round ${game.battle.round} / ${count_siege_markers(game.battle.where)}`) + log_h4(`Storm Round ${game.battle.round} / ${count_siege_markers(game.battle.where)}`) if (game.battle.round === 1) goto_first_strike() else game.state = "concede_storm" } else { - log_h3(`Battle Round ${game.battle.round}`) + log_h4(`Battle Round ${game.battle.round}`) game.state = "concede_battle" } } @@ -8220,9 +8222,9 @@ function goto_strike() { set_active_defender() if (game.battle.storm) - log_h4(storm_steps[game.battle.step].name) + log_h5(storm_steps[game.battle.step].name) else - log_h4(battle_steps[game.battle.step].name) + log_h5(battle_steps[game.battle.step].name) // Once per Archery and once per Melee. if (game.battle.step === 0 || game.battle.step === 2) { @@ -9011,7 +9013,7 @@ function set_active_victor() { } function end_battle() { - log_h3(`${game.battle.loser} Lost`) + log_h4(`${game.battle.loser} Lost`) if ((game.battle.sally || game.battle.relief) && game.battle.attacker === game.battle.loser) { log("Raid removed Siege markers.") @@ -9454,9 +9456,9 @@ function goto_battle_losses_loser() { game.who = NOBODY if (has_battle_losses()) if (game.active === P1) - log_h3("Teutonic Losses") + log_h4("Teutonic Losses") else - log_h3("Russian Losses") + log_h4("Russian Losses") resume_battle_losses() } @@ -9466,9 +9468,9 @@ function goto_battle_losses_victor() { game.who = NOBODY if (has_battle_losses()) if (game.active === P1) - log_h3("Teutonic Losses") + log_h4("Teutonic Losses") else - log_h3("Russian Losses") + log_h4("Russian Losses") resume_battle_losses() } @@ -9640,7 +9642,7 @@ function find_lone_friendly_lord_at(loc) { function goto_battle_spoils() { if (has_any_spoils() && has_friendly_lord(game.battle.where)) { - log_h3("Spoils") + log_h4("Spoils") log_spoils() game.state = "battle_spoils" game.who = find_lone_friendly_lord_at(game.battle.where) @@ -9688,7 +9690,7 @@ states.battle_spoils = { function goto_battle_service() { if (game.battle.retreated) { - log_h3("Service") + log_h4("Service") resume_battle_service() } else { end_battle_service() @@ -10749,13 +10751,20 @@ function log_h1(msg) { function log_h2(msg) { log_br() - log(".h2 " + msg) + if (game.active === TEUTONS) + log(".h2t " + msg) + else + log(".h2r " + msg) log_br() } function log_h3(msg) { log_br() - log(".h3 " + msg) + if (game.active === TEUTONS) + log(".h3t " + msg) + else + log(".h3r " + msg) + log_br() } function log_h4(msg) { @@ -10763,6 +10772,11 @@ function log_h4(msg) { log(".h4 " + msg) } +function log_h5(msg) { + log_br() + log(".h5 " + msg) +} + function gen_action(action, argument) { if (!(action in view.actions)) view.actions[action] = [] |