summaryrefslogtreecommitdiff
path: root/rules.ts
diff options
context:
space:
mode:
Diffstat (limited to 'rules.ts')
-rw-r--r--rules.ts71
1 files changed, 43 insertions, 28 deletions
diff --git a/rules.ts b/rules.ts
index 4204a70..e3ea9e2 100644
--- a/rules.ts
+++ b/rules.ts
@@ -3864,15 +3864,11 @@ states.command = {
inactive: "Command",
prompt() {
let here = get_lord_locale(game.command)
- if (game.actions === 0)
- view.prompt = `Command: ${lord_name[game.command]} has no more actions.`
- else if (game.actions === 1)
+ if (game.actions === 1)
view.prompt = `Command: ${lord_name[game.command]} has ${game.actions} action.`
else
view.prompt = `Command: ${lord_name[game.command]} has ${game.actions} actions.`
- view.group = game.group
-
prompt_held_event_at_campaign()
if (!is_lord_on_map(game.command)) {
@@ -3881,13 +3877,6 @@ states.command = {
return
}
- if (can_pick_up_lords(game.command)) {
- for_each_friendly_lord_in_locale(here, other => {
- if (can_pick_up_other(game.command, other))
- gen_action_lord(other)
- })
- }
-
if (game.actions > 0) {
// show "always" actions
view.actions.supply = 0
@@ -3901,7 +3890,20 @@ states.command = {
view.actions.end_command = 1
}
- prompt_march()
+ let can_move = prompt_march()
+
+ if (can_action_sail()) {
+ view.actions.sail = 1
+ can_move = true
+ }
+
+ if (can_move && can_pick_up_lords(game.command)) {
+ view.group = game.group
+ for_each_friendly_lord_in_locale(here, other => {
+ if (can_pick_up_other(game.command, other))
+ gen_action_lord(other)
+ })
+ }
if (can_action_supply())
view.actions.supply = 1
@@ -3909,8 +3911,6 @@ states.command = {
view.actions.forage = 1
if (can_action_tax())
view.actions.tax = 1
- if (can_action_sail())
- view.actions.sail = 1
if (can_action_parley_campaign())
view.actions.parley = 1
if (can_action_heralds())
@@ -3923,6 +3923,9 @@ states.command = {
if (is_york_lord(game.command) && game.group.length === 1)
if (can_action_exile_pact())
view.actions.exile_pact = 1
+
+ if (game.actions === 0 && !can_move)
+ view.prompt = "Command: All done."
},
pass() {
@@ -4303,7 +4306,7 @@ function can_action_sail() {
return false
}
- if (game.actions === 0)
+ if (game.actions < 1)
return false
// at a seaport (or sea)
@@ -4824,7 +4827,7 @@ function search_parley_levy(result, start: Locale, lord: Lord, ships: boolean) {
}
function can_action_parley_campaign() {
- if (game.actions <= 0)
+ if (game.actions < 1)
return false
if (is_lord_at_sea(game.command))
@@ -4874,7 +4877,7 @@ function search_parley_campaign(here: Locale, lord: Lord) {
}
function can_action_parley_levy(): boolean {
- if (game.actions <= 0 && !has_free_parley_levy())
+ if (game.actions < 1 && !has_free_parley_levy())
return false
let here = get_lord_locale(game.command)
@@ -5097,21 +5100,33 @@ function can_action_march_to(to: Locale, type: "highway" | "road" | "path") {
function prompt_march() {
let from = get_lord_locale(game.command)
+ let has_march = false
if (!is_locale_on_map(from))
- return
+ return false
- for (let to of data.locales[from].highways)
- if (can_action_march_to(to, "highway"))
+ for (let to of data.locales[from].highways) {
+ if (can_action_march_to(to, "highway")) {
gen_action_locale(to)
+ has_march = true
+ }
+ }
- for (let to of data.locales[from].roads)
- if (can_action_march_to(to, "road"))
+ for (let to of data.locales[from].roads) {
+ if (can_action_march_to(to, "road")) {
gen_action_locale(to)
+ has_march = true
+ }
+ }
- for (let to of data.locales[from].paths)
- if (can_action_march_to(to, "path"))
+ for (let to of data.locales[from].paths) {
+ if (can_action_march_to(to, "path")) {
gen_action_locale(to)
+ has_march = true
+ }
+ }
+
+ return has_march
}
function goto_march(to: Locale) {
@@ -10936,7 +10951,7 @@ function count_merchants_deplete(loc: Locale) {
function can_action_merchants() {
let loc = get_lord_locale(game.command)
- if (game.actions <= 0)
+ if (game.actions < 1)
return false
if (lord_has_capability(game.command, AOW_LANCASTER_MERCHANTS))
return count_merchants_deplete(loc) > 0
@@ -11050,7 +11065,7 @@ function roll_blockade(fail: string) {
function can_action_agitators() {
let here = get_lord_locale(game.command)
- if (game.actions <= 0)
+ if (game.actions < 1)
return false
if (lord_has_capability(game.command, AOW_YORK_AGITATORS)) {
for (let next of data.locales[here].adjacent) {
@@ -11095,7 +11110,7 @@ function end_agitators() {
// === CAPABILITY: HERALDS ===
function can_action_heralds() {
- if (game.actions <= 0)
+ if (game.actions < 1)
return false
if (!is_first_action())