diff options
-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 |