diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 58 |
1 files changed, 40 insertions, 18 deletions
@@ -830,6 +830,11 @@ states.setup_hand = { function goto_start_turn() { log_h2(PLAYER_NAMES[game.current]) + + game.battled = 0 + game.mbattled = 0 + game.placed = 0 + goto_upkeep() } @@ -1029,13 +1034,11 @@ function action_take_actions_card(c) { } function action_take_actions_governor(id) { - push_undo() game.who = id game.state = "take_actions_governor" } function action_take_actions_general(id) { - push_undo() game.who = id game.state = "take_actions_general" } @@ -1323,6 +1326,7 @@ function remove_governor(where) { log("Removed Governor from S" + where) remove_all_mobs(where) + remove_militia(where) let old_governor = get_province_governor(where) if (old_governor >= 0) { @@ -1339,6 +1343,7 @@ function remove_governor(where) { function place_governor(where, new_governor) { remove_all_mobs(where) + remove_militia(where) let old_governor = get_province_governor(where) if (old_governor >= 0) { @@ -1717,39 +1722,56 @@ function gen_hits_militia() { return false } +function gen_hits_barbarians(tribe) { + let prov = is_province(game.misc.where) + for (let id = first_barbarian[tribe]; id <= last_barbarian[tribe]; ++id) + if (get_barbarian_location(id) === game.misc.where) + if (prov || is_barbarian_active(id)) + gen_action_barbarian(id) +} + function gen_hits_general(general) { let army = ARMY + general + let done = true // TODO: castra - if (is_general_inside_capital(general) && has_militia(game.misc.where)) { - gen_action_militia(game.misc.where) - return false + if (!done) { + if (is_general_inside_capital(general) && has_militia(game.misc.where)) { + gen_action_militia(game.misc.where) + done = true + } } - for (let id = 0; id < game.barbarians.length; ++id) { - if (get_barbarian_location(id) === army) { - gen_action_barbarian(id) - return false + if (!done) { + for (let id = 0; id < game.barbarians.length; ++id) { + if (get_barbarian_location(id) === army) { + gen_action_barbarian(id) + done = true + } } } // NOTE: reduce all legions before eliminating any - for (let id = 0; id < 33; ++id) { - if (get_legion_location(id) === army && !is_legion_reduced(id)) { - gen_action_legion(id) - return false + if (!done) { + for (let id = 0; id < 33; ++id) { + if (get_legion_location(id) === army && !is_legion_reduced(id)) { + gen_action_legion(id) + done = true + } } } - for (let id = 0; id < 33; ++id) { - if (get_legion_location(id) === army && is_legion_reduced(id)) { - gen_action_legion(id) - return false + if (!done) { + for (let id = 0; id < 33; ++id) { + if (get_legion_location(id) === army && is_legion_reduced(id)) { + gen_action_legion(id) + done = true + } } } - return true + return done } states.assign_hits_on_attacker = { |