summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-06-26 21:02:18 +0200
committerTor Andersson <tor@ccxvii.net>2023-07-07 19:05:52 +0200
commit5a4754c6f27b3ff80154dc2c1c5358d791cd474f (patch)
tree166d6b26ef414f96ace331d6cd0abd788d311b2b /rules.js
parent09bec88e3ad8894217f4f426372e9d94b2ad1ba9 (diff)
downloadtime-of-crisis-5a4754c6f27b3ff80154dc2c1c5358d791cd474f.tar.gz
Improve prompts.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js61
1 files changed, 38 insertions, 23 deletions
diff --git a/rules.js b/rules.js
index 756374b..c529fbc 100644
--- a/rules.js
+++ b/rules.js
@@ -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)