diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-06-26 21:02:18 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-07-07 19:05:52 +0200 |
commit | 5a4754c6f27b3ff80154dc2c1c5358d791cd474f (patch) | |
tree | 166d6b26ef414f96ace331d6cd0abd788d311b2b | |
parent | 09bec88e3ad8894217f4f426372e9d94b2ad1ba9 (diff) | |
download | time-of-crisis-5a4754c6f27b3ff80154dc2c1c5358d791cd474f.tar.gz |
Improve prompts.
-rw-r--r-- | play.css | 20 | ||||
-rw-r--r-- | play.html | 38 | ||||
-rw-r--r-- | play.js | 37 | ||||
-rw-r--r-- | rules.js | 61 |
4 files changed, 94 insertions, 62 deletions
@@ -256,16 +256,16 @@ body svg .sea.action { z-index: 2; } -body.p3 #Hispania_NPG { display: block } -body.p3 #Africa_NPG { display: block } -body.p3 #Aegyptus_NPG { display: block } - -body.p2 #Britannia_NPG { display: block } -body.p2 #Hispania_NPG { display: block } -body.p2 #Africa_NPG { display: block } -body.p2 #Aegyptus_NPG { display: block } -body.p2 #Syria_NPG { display: block } -body.p2 #Galatia_NPG { display: block } +body.p3 #npg_hispania { display: block } +body.p3 #npg_africa { display: block } +body.p3 #npg_aegyptus { display: block } + +body.p2 #npg_britannia { display: block } +body.p2 #npg_hispania { display: block } +body.p2 #npg_africa { display: block } +body.p2 #npg_aegyptus { display: block } +body.p2 #npg_syria { display: block } +body.p2 #npg_galatia { display: block } /* COUNTERS */ @@ -146,25 +146,25 @@ <div id="yellow_legacy" class="yellow legacy hide" style="top:72px;left:43px;"></div> <div id="green_legacy" class="green legacy hide" style="top:92px;left:43px;"></div> -<div id="Italia_Capital" class="capital" style="left:1037px;top:742px"></div> -<div id="Aegyptus_Capital" class="capital" style="left:1792px;top:1379px"></div> -<div id="Africa_Capital" class="capital" style="left:740px;top:1203px"></div> -<div id="Asia_Capital" class="capital" style="left:1789px;top:907px"></div> -<div id="Britannia_Capital" class="capital" style="left:324px;top:176px"></div> -<div id="Galatia_Capital" class="capital" style="left:2047px;top:841px"></div> -<div id="Gallia_Capital" class="capital" style="left:553px;top:417px"></div> -<div id="Hispania_Capital" class="capital" style="left:248px;top:891px"></div> -<div id="Macedonia_Capital" class="capital" style="left:1476px;top:849px"></div> -<div id="Pannonia_Capital" class="capital" style="left:1213px;top:535px"></div> -<div id="Syria_Capital" class="capital" style="left:2173px;top:1192px"></div> -<div id="Thracia_Capital" class="capital" style="left:1593px;top:630px"></div> - -<div id="Aegyptus_NPG" class="no_place_governor" style="left:1793px;top:1380px"></div> -<div id="Africa_NPG" class="no_place_governor" style="left:741px;top:1204px"></div> -<div id="Britannia_NPG" class="no_place_governor" style="left:325px;top:177px"></div> -<div id="Galatia_NPG" class="no_place_governor" style="left:2048px;top:842px"></div> -<div id="Hispania_NPG" class="no_place_governor" style="left:249px;top:891px"></div> -<div id="Syria_NPG" class="no_place_governor" style="left:2174px;top:1193px"></div> +<div id="capital_italia" class="capital" style="left:1037px;top:742px"></div> +<div id="capital_aegyptus" class="capital" style="left:1792px;top:1379px"></div> +<div id="capital_africa" class="capital" style="left:740px;top:1203px"></div> +<div id="capital_asia" class="capital" style="left:1789px;top:907px"></div> +<div id="capital_britannia" class="capital" style="left:324px;top:176px"></div> +<div id="capital_galatia" class="capital" style="left:2047px;top:841px"></div> +<div id="capital_gallia" class="capital" style="left:553px;top:417px"></div> +<div id="capital_hispania" class="capital" style="left:248px;top:891px"></div> +<div id="capital_macedonia" class="capital" style="left:1476px;top:849px"></div> +<div id="capital_pannonia" class="capital" style="left:1213px;top:535px"></div> +<div id="capital_syria" class="capital" style="left:2173px;top:1192px"></div> +<div id="capital_thracia" class="capital" style="left:1593px;top:630px"></div> + +<div id="npg_aegyptus" class="no_place_governor" style="left:1793px;top:1380px"></div> +<div id="npg_africa" class="no_place_governor" style="left:741px;top:1204px"></div> +<div id="npg_britannia" class="no_place_governor" style="left:325px;top:177px"></div> +<div id="npg_galatia" class="no_place_governor" style="left:2048px;top:842px"></div> +<div id="npg_hispania" class="no_place_governor" style="left:249px;top:891px"></div> +<div id="npg_syria" class="no_place_governor" style="left:2174px;top:1193px"></div> </div> @@ -160,11 +160,11 @@ const REGION_NAME = [ "Aegyptus", "Africa", "Hispania", - "Alamanni Homeland", - "Franks Homeland", - "Goths Homeland", - "Sassanids Homeland", - "Nomads Homeland", + "Alamanni homeland", + "Frank homeland", + "Goth homeland", + "Sassanid homeland", + "Nomad homeland", "Mare Occidentale", "Mare Orientale", "Oceanus Atlanticus", @@ -686,7 +686,20 @@ let ui = { document.getElementById("mapsvg").getElementById("region_oceanus_atlanticus"), document.getElementById("mapsvg").getElementById("region_pontus_euxinus"), ], - capital: [], + capital: [ + document.getElementById("capital_italia"), + document.getElementById("capital_asia"), + document.getElementById("capital_gallia"), + document.getElementById("capital_macedonia"), + document.getElementById("capital_pannonia"), + document.getElementById("capital_thracia"), + document.getElementById("capital_britannia"), + document.getElementById("capital_galatia"), + document.getElementById("capital_syria"), + document.getElementById("capital_aegyptus"), + document.getElementById("capital_africa"), + document.getElementById("capital_hispania"), + ], quaestor: [], amphitheater: [], basilica: [], @@ -845,7 +858,6 @@ function on_init() { for (let region = 0; region < 12; ++region) { ui.mcastra[region] = create_thing({ className: "castra hide" }) ui.militia[region] = create_thing({ className: "militia hide", my_action: "militia", my_id: region }) - ui.capital[region] = document.getElementById(REGION_NAME[region] + "_Capital") ui.quaestor[region] = create_thing({ className: "quaestor hide" }) ui.quaestor[region].style.left = (LAYOUT_QUAESTOR[region][0] + 16) + "px" ui.quaestor[region].style.top = (LAYOUT_QUAESTOR[region][1]) + "px" @@ -1377,8 +1389,13 @@ function on_update() { ui.crisis.className = "p_" + PLAYER_CLASS[view.current] + " c" + (view.crisis[1] + view.crisis[2]) ui.dice[0].className = "dice black d" + view.crisis[1] ui.dice[1].className = "dice white d" + view.crisis[2] - ui.dice[2].className = "dice black d" + view.crisis[3] - ui.dice[3].className = "dice white d" + view.crisis[4] + if (view.crisis[0] >= 0) { + ui.dice[2].className = "dice black d" + view.crisis[3] + ui.dice[3].className = "dice white d" + view.crisis[4] + } else { + ui.dice[2].className = "dice black hide" + ui.dice[3].className = "dice white hide" + } ui.active_event.replaceChildren() ui.active_event.appendChild(ui.event_cards[view.event]) @@ -1484,7 +1501,7 @@ function sub_card_1(match) { } function sub_card_x(match, p1, p2) { - return p1 + "\xa0" + p2 + return p1 + " " + p2 } function on_log(text) { @@ -97,11 +97,11 @@ const REGION_NAME = [ "Aegyptus", "Africa", "Hispania", - "Alamanni Homeland", - "Frank Homeland", - "Goth Homeland", - "Sassanid Homeland", - "Nomad Homeland", + "Alamanni homeland", + "Frank homeland", + "Goth homeland", + "Sassanid homeland", + "Nomad homeland", "Mare Occidentale", "Mare Orientale", "Oceanus Atlanticus", @@ -197,6 +197,14 @@ const BARBARIAN_NAME = [ "Nomads", ] +const BARBARIAN_ONE = [ + "Alamanni", + "Frank", + "Goth", + "Sassanid", + "Nomad", +] + const BARBARIAN_HOMELAND = [ ALAMANNI_HOMELAND, FRANKS_HOMELAND, @@ -1118,7 +1126,7 @@ function has_card_event(event) { states.setup_province = { inactive: "Setup", prompt() { - view.prompt = "Setup: Choose a province to place your governor and general." + prompt("Setup: Choose a province to place your governor and general.") view.selected_governor = game.current * 6 view.selected_general = game.current * 6 view.color = SENATE @@ -1146,7 +1154,7 @@ states.setup_province = { states.setup_hand = { inactive: "Setup", prompt() { - view.prompt = "Setup: Draw cards." + prompt("Setup: Draw cards.") let hand = current_hand() if (hand.length < 5) { for (let c of current_draw()) @@ -1328,10 +1336,10 @@ function goto_barbarian_crisis(tribe) { } states.barbarian_crisis = { - get inactive() { return BARBARIAN_NAME[game.crisis[0]] }, + get inactive() { return "Barbarian Crisis \u2013 " + BARBARIAN_NAME[game.crisis[0]] }, prompt() { let tribe = game.crisis[0] - prompt(BARBARIAN_NAME[tribe] + ": Activate one barbarian.") + prompt("Barbarian Crisis: Activate one " + BARBARIAN_ONE[tribe] + ".") gen_action_barbarian(find_inactive_barbarian_at_home(tribe)) }, barbarian(id) { @@ -1378,10 +1386,14 @@ function goto_barbarian_invasion(tribe, black) { } states.barbarian_invasion = { - get inactive() { return BARBARIAN_NAME[game.crisis[0]] }, + get inactive() { return "Barbarian Crisis \u2013 " + BARBARIAN_NAME[game.crisis[0]] }, prompt() { let tribe = game.crisis[0] - prompt(BARBARIAN_NAME[tribe] + " invade!") + let count = game.crisis[3] + if (count === 1) + prompt("Barbarian Crisis: Invade with 1 " + BARBARIAN_ONE[tribe] + ".") + else + prompt("Barbarian Crisis: Invade with " + count + " " + BARBARIAN_NAME[tribe] + ".") gen_action_barbarian(find_active_barbarian_at_home(tribe)) }, barbarian(id) { @@ -1483,7 +1495,7 @@ function goto_crisis_barbarian_leader(id, where) { states.crisis_barbarian_leader = { get inactive() { return EVENT_NAME[game.active_event] }, prompt() { - prompt(EVENT_NAME[game.active_event] + ": Place barbarian leader.") + prompt(EVENT_NAME[game.active_event] + ": Place barbarian leader in " + REGION_NAME[game.where] + ".") gen_action_region(game.where) }, region(where) { @@ -1930,7 +1942,7 @@ states.take_actions = { hold_games() { push_undo() let where = get_governor_location(game.selected_governor) - log("Held Games in %" + where + ".") + log("Hold Games in %" + where + ".") spend_populace(2) set_mobs(where, get_mobs(where) - 1) }, @@ -1944,7 +1956,8 @@ states.take_actions = { add_legion_to_army() { push_undo() - log("Add Legion to Army.") + let where = get_general_location(game.selected_general) + log("Add Legion to Army in %" + where + ".") let cost = count_legions_in_army(game.selected_general) + 1 spend_military(cost) set_legion_location(find_unused_legion(), ARMY + game.selected_general) @@ -1952,7 +1965,8 @@ states.take_actions = { train_legions() { push_undo() - log("Trained Legions.") + let where = get_general_location(game.selected_general) + log("Train Legions in %" + where + ".") spend_military(1) set_legion_full_strength(find_reduced_legion_in_army(game.selected_general)) }, @@ -2068,7 +2082,7 @@ function increase_support_level() { function recall_governor() { let where = get_governor_location(game.selected_governor) - log("Recalled Governor from %" + where + ".") + log("Recall Governor from %" + where + ".") spend_senate(2) set_placed_governor(where) remove_governor(where) @@ -2978,7 +2992,7 @@ function gen_initiate_battle(where) { function format_battle_target() { switch (game.battle.type) { - case "militia": return PLAYER_NAME[get_province_player(game.battle.target)] + " militia" + case "militia": return PLAYER_NAME[get_province_player(game.where)] + " militia" case "barbarians": return BARBARIAN_NAME[game.battle.target] case "general": return PLAYER_NAME[game.battle.target / 6 | 0] + " army" case "rival_emperor": return RIVAL_EMPEROR_NAME[game.battle.target] @@ -3421,7 +3435,7 @@ states.combat_victory = { function goto_combat_victory() { log_br() - log("VICTORY") + log("RESULT") let de = is_defender_eliminated() let ae = is_attacker_eliminated() if (de && ae) @@ -3449,24 +3463,25 @@ function award_legacy_summary(p, reason, n) { } function goto_combat_no_victory() { - log("Nobody") + log("Both sides eliminated.") game.battle.killed = 0 end_battle() } function goto_combat_victory_defender() { - log("Defender") game.battle.killed = 0 if (game.battle.type === "general") award_legacy(game.battle.target / 6 | 0, "Victory", 2) - if (game.battle.type === "militia") + else if (game.battle.type === "militia") award_legacy(get_province_player(game.where), "Victory", 2) + else if (game.battle.type === "barbarians") + log(BARBARIAN_NAME[game.battle.target] + " won.") + else if (game.battle.type === "rival_emperor") + log(RIVAL_EMPEROR_NAME[game.battle.target] + " won.") end_battle() } function goto_combat_victory_attacker() { - log("Attacker") - if (game.battle.type === "barbarians") { award_legacy(game.current, "Victory", 2 + game.battle.dtaken) |