diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-06-20 17:23:55 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-07-07 18:39:37 +0200 |
commit | 8fb42cd1821020f433d19c01ce70fa45b4797ec4 (patch) | |
tree | 49c54a04487bcf03d79dc2b36cc2498ddab74c70 | |
parent | ce78446a80136970f3207dc3f8c44346c72db01b (diff) | |
download | time-of-crisis-8fb42cd1821020f433d19c01ce70fa45b4797ec4.tar.gz |
Skip intermediate Create Army step.
-rw-r--r-- | rules.js | 44 |
1 files changed, 24 insertions, 20 deletions
@@ -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 |