summaryrefslogtreecommitdiffstats
path: root/lib/colonial_twilight
diff options
context:
space:
mode:
Diffstat (limited to 'lib/colonial_twilight')
-rw-r--r--lib/colonial_twilight/fln_bot_rules.rb31
-rw-r--r--lib/colonial_twilight/fln_rules.rb2
2 files changed, 32 insertions, 1 deletions
diff --git a/lib/colonial_twilight/fln_bot_rules.rb b/lib/colonial_twilight/fln_bot_rules.rb
index 818f0bf..8f0f37a 100644
--- a/lib/colonial_twilight/fln_bot_rules.rb
+++ b/lib/colonial_twilight/fln_bot_rules.rb
@@ -218,6 +218,37 @@ module ColonialTwilight
(de_gaule && space.sector? && space.troops.positive? && space.police.positive? && space.gov_control?)
end
+ # Attack
+
+ def may_attack_1_in?(space)
+ # attack will remove 1+ GOV piece, do not expose a base
+ r = may_attack_in?(space) && space.guerrillas > 5 && space.fln_bases.zero?
+ dbg " may_attack_1_in : #{space.name}", r
+ r
+ end
+
+ def may_ambush_1_in?(space)
+ # do not expose a base
+ r = may_ambush_in?(space) && (space.fln_bases.zero? ? true : space.guerrillas > 1)
+ dbg " may_attack_1_in : #{space.name}", r
+ r
+ end
+
+ def may_attack_2_in?(space)
+ # 4+ guerrillas, do not expose a base
+ r = may_attack_in?(space) && space.guerrillas > 3 && space.fln_bases.zero?
+ dbg " may_attack_2_in : #{space.name}", r
+ r
+ end
+
+ def attack_priority(spaces)
+ # GOV bases -> French Troops -> French Police -> most pieces
+ f = _filter(spaces) { |s| s.gov_bases.positive? }
+ f = _filter(f) { |s| s.french_troops.positive? }
+ f = _filter(f) { |s| s.french_police.positive? }
+ _max(f, :gov)
+ end
+
# 8.1.2 - Procedure Guidelines
def _filter(spaces, &block)
diff --git a/lib/colonial_twilight/fln_rules.rb b/lib/colonial_twilight/fln_rules.rb
index 9e3bddd..f8e6c40 100644
--- a/lib/colonial_twilight/fln_rules.rb
+++ b/lib/colonial_twilight/fln_rules.rb
@@ -68,7 +68,7 @@ module ColonialTwilight
# Ambush 4.3.3
def may_ambush_in?(space)
- may_attack_in?(space)
+ may_attack_in?(space) && space.fln_underground.positive?
end
def ambush_spaces(board)