diff options
| author | Jérémy Zurcher <jeremy@asynk.ch> | 2026-03-11 15:16:47 +0100 |
|---|---|---|
| committer | Jérémy Zurcher <jeremy@asynk.ch> | 2026-03-11 15:16:47 +0100 |
| commit | 9458b6413e3609e12f563dcb321d493b5f317017 (patch) | |
| tree | 0e8bb866639541ee1e5b9c669b964054d9da8aa6 /lib/colonial_twilight/fln_bot/fln_terror.rb | |
| parent | 96eba00d76af7fe662bc7f26d8962ada3bfa15b2 (diff) | |
| download | colonial-twilight-9458b6413e3609e12f563dcb321d493b5f317017.zip colonial-twilight-9458b6413e3609e12f563dcb321d493b5f317017.tar.gz | |
update FlnBot infrastructure
Diffstat (limited to 'lib/colonial_twilight/fln_bot/fln_terror.rb')
| -rw-r--r-- | lib/colonial_twilight/fln_bot/fln_terror.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/colonial_twilight/fln_bot/fln_terror.rb b/lib/colonial_twilight/fln_bot/fln_terror.rb new file mode 100644 index 0000000..a9fd9e2 --- /dev/null +++ b/lib/colonial_twilight/fln_bot/fln_terror.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module ColonialTwilight + module FLNBotTerror + def terror + # return false if !available_resources.positive? && !extort + return false if event_playable? && event_more_effective_than_terror? + + until (space = terror_1_priority(@board.search { |s| may_terror_1_in?(s) }).sample).nil? + exc = space.fln_underground == 1 ? space : nil + break if !available_resources.positive? && !extort(except: exc) + + apply_action @turn.operation_in(:terror, space, 1).terror + end + + if last_campaign? + until (space = @board.search { |s| may_terror_2_in?(s) }.sample).nil? + exc = space.fln_underground == 1 ? space : nil + break if !available_resources.positive? && !extort(except: exc) + + apply_action @turn.operation_in(:terror, space, 1).terror + end + end + + @turn.operation_done? + end + end +end |
