summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js31
1 files changed, 30 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index edccf06..0e3c181 100644
--- a/rules.js
+++ b/rules.js
@@ -2412,12 +2412,29 @@ states.activate_individually = {
},
}
+function can_activate_force(who) {
+ let where = game.location[who]
+ // If at Halifax or Louisbourg ...
+ if (where === HALIFAX || where === LOUISBOURG) {
+ // must be able to Naval move
+ if (game.activation_value === 3)
+ return true
+ // or Siege/Assault
+ if (can_siege_or_assault_if_activated(who, where))
+ return true
+ // otherwise it's a do-nothing action
+ return false
+ }
+ return true
+}
+
states.activate_force = {
prompt() {
view.prompt = "Activate a Force."
for (let p = first_friendly_leader; p <= last_friendly_leader; ++p)
if (is_piece_on_map(p) && leader_initiative(p) <= game.activation_value)
- gen_action_piece(p)
+ if (can_activate_force(p))
+ gen_action_piece(p)
},
piece(p) {
push_undo()
@@ -5782,6 +5799,18 @@ function resume_retreat_lone_leader(from) {
const SIEGE_TABLE = [ 0, 0, 0, 1, 1, 1, 2, 2 ]
+function can_siege_or_assault_if_activated(leader, where) {
+ if (has_besieged_enemy_fortifications(where)) {
+ let commanding = find_friendly_commanding_leader_in_space(where)
+ if (commanding > 0) {
+ let cmd_rank = leader_command(commanding)
+ let ldr_rank = leader_command(leader)
+ if (ldr_rank === cmd_rank && has_friendly_supplied_drilled_troops(where))
+ return true
+ }
+ }
+}
+
function can_moving_force_siege_or_assault() {
let leader = moving_piece()
let where = moving_piece_space()