summaryrefslogtreecommitdiffstats
path: root/lib/colonial_twilight
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2023-11-07 11:08:01 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2023-11-07 11:08:01 +0100
commit45df0be14323eaaa140f56b930f3d56d8239a902 (patch)
tree81d8d6886f8cab213bb0ae7fa188ceccb5f06e9b /lib/colonial_twilight
parent166034e674396af49f1977ef5853b4f3d3b6e202 (diff)
downloadcolonial-twilight-45df0be14323eaaa140f56b930f3d56d8239a902.zip
colonial-twilight-45df0be14323eaaa140f56b930f3d56d8239a902.tar.gz
FLNBotRules : add #may_extort_0_in? and #extort_priority
Diffstat (limited to 'lib/colonial_twilight')
-rw-r--r--lib/colonial_twilight/fln_bot_rules.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/colonial_twilight/fln_bot_rules.rb b/lib/colonial_twilight/fln_bot_rules.rb
index f5e02d9..77ee6d7 100644
--- a/lib/colonial_twilight/fln_bot_rules.rb
+++ b/lib/colonial_twilight/fln_bot_rules.rb
@@ -144,6 +144,20 @@ module ColonialTwilight
_filter(f) { |s| s.gov_cubes.zero? }
end
+ # Extort
+
+ def may_extort_0_in?(space)
+ r = may_extort_in?(space) && space.fln_underground > (space.fln_bases.zero? ? 0 : 1)
+ dbg " may_extort_0_in : #{space.name}", r
+ r
+ end
+
+ def extort_priority(spaces)
+ # 2+ guerrillas, 3+ if gov cubes and fln base -> Country -> anywhere if still at 0
+ f = _filter(spaces) { |s| s.guerrillas > (s.gov_cubes.positive? && s.fln_bases.positive? ? 2 : 1) }
+ _filter(f, &:country?)
+ end
+
# 8.1.2 - Procedure Guidelines
def _filter(spaces, &block)