diff options
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 |
