diff options
Diffstat (limited to 'lib/colonial_twilight/fln_bot/fln_extort.rb')
| -rw-r--r-- | lib/colonial_twilight/fln_bot/fln_extort.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/colonial_twilight/fln_bot/fln_extort.rb b/lib/colonial_twilight/fln_bot/fln_extort.rb new file mode 100644 index 0000000..5889e24 --- /dev/null +++ b/lib/colonial_twilight/fln_bot/fln_extort.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module ColonialTwilight + module FLNBotExtort + def extort(except: nil, to_agitate_in: nil) + return false if available_resources > 4 + return false unless @turn.may_special_activity?(:extort) + return false if (space = extort_priority(extortable(except: except)).sample).nil? + + apply_action @turn.special_activity_in(:extort, space, -1, to_agitate_in: to_agitate_in).extort + end + + def extortable(except: nil) + @board.search { |s| may_extort_0_in?(s) }.reject { |s| @turn.special_activity_selected?(s) || s == except } + end + end +end |
