summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-06-20 17:23:55 +0200
committerTor Andersson <tor@ccxvii.net>2023-07-07 18:39:37 +0200
commit8fb42cd1821020f433d19c01ce70fa45b4797ec4 (patch)
tree49c54a04487bcf03d79dc2b36cc2498ddab74c70 /rules.js
parentce78446a80136970f3207dc3f8c44346c72db01b (diff)
downloadtime-of-crisis-8fb42cd1821020f433d19c01ce70fa45b4797ec4.tar.gz
Skip intermediate Create Army step.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js44
1 files changed, 24 insertions, 20 deletions
diff --git a/rules.js b/rules.js
index c18d137..8a3d25c 100644
--- a/rules.js
+++ b/rules.js
@@ -1213,7 +1213,7 @@ states.take_actions_general = {
// Create Army
if (where === AVAILABLE) {
if (mip >= 1 && find_unused_legion() >= 0)
- view.actions.create_army = 1
+ gen_create_army()
}
if (is_region(where)) {
@@ -1292,12 +1292,17 @@ states.take_actions_general = {
},
region(to) {
push_undo()
- move_army_to(game.who, to, false)
+ if (get_general_location(game.who) === AVAILABLE)
+ create_army(to)
+ else
+ move_army_to(game.who, to, false)
},
capital(to) {
push_undo()
if (get_general_location(game.who) === to)
set_general_inside_capital(game.who)
+ else if (get_general_location(game.who) === AVAILABLE)
+ create_army(to)
else
move_army_to(game.who, to, true)
},
@@ -1511,24 +1516,23 @@ states.build_improvement = {
// ACTION: CREATE ARMY
-states.create_army = {
- prompt() {
- prompt("Create Army.")
- for (let i = 0; i < 6; ++i) {
- let where = get_governor_location(game.current * 6 + i)
- if (is_province(where))
- gen_action_region(where)
- }
- },
- region(where) {
- push_undo()
- log("Created Army in S" + where + ".")
- set_general_location(game.who, where)
- if (can_enter_capital(where))
- set_general_inside_capital(game.who)
- set_legion_location(find_unused_legion(), ARMY + game.who)
- game.state = "take_actions_general"
- },
+function gen_create_army() {
+ for (let i = 0; i < 6; ++i) {
+ let where = get_governor_location(game.current * 6 + i)
+ if (is_province(where))
+ gen_action_region(where)
+ }
+}
+
+function create_army(where) {
+ push_undo()
+ spend_ip(MILITARY, 1)
+ log("Created Army in S" + where + ".")
+ set_general_location(game.who, where)
+ if (can_enter_capital(where))
+ set_general_inside_capital(game.who)
+ set_legion_location(find_unused_legion(), ARMY + game.who)
+ game.state = "take_actions_general"
}
// ACTION: MOVE ARMY