diff options
-rw-r--r-- | lib/colonial_twilight/fln_bot_rules.rb | 5 | ||||
-rw-r--r-- | spec/fln_bot_rules_spec.rb | 15 |
2 files changed, 14 insertions, 6 deletions
diff --git a/lib/colonial_twilight/fln_bot_rules.rb b/lib/colonial_twilight/fln_bot_rules.rb index 90936ad..3f04ed5 100644 --- a/lib/colonial_twilight/fln_bot_rules.rb +++ b/lib/colonial_twilight/fln_bot_rules.rb @@ -145,13 +145,14 @@ module ColonialTwilight end def may_rally_9_in?(space) - r = may_agitate_in?(space) && (space.terror.positive? || !space.oppose?) + r = may_agitate_in?(space) dbg " may_rally_9_in : #{space.name}", r r end def rally_9_priority(spaces, resources) - _filter(spaces) { |s| !s.oppose? && resources > s.terror } + f = _filter(spaces) { |s| s.support? && resources > s.terror } + _filter(f) { |s| s.neutral? && resources > s.terror } end # Extort diff --git a/spec/fln_bot_rules_spec.rb b/spec/fln_bot_rules_spec.rb index 5f3c3c3..2fe0216 100644 --- a/spec/fln_bot_rules_spec.rb +++ b/spec/fln_bot_rules_spec.rb @@ -450,11 +450,18 @@ describe ColonialTwilight::FLNBotRules do expect(@rules.may_rally_9_in?(a)).to be true end - it 'rally_9_priority no cubes' do + it 'rally_9_priority support' do a = Sector.new(terror: 1, oppose: true) - b = Sector.new(terror: 2, neutral: true) - c = Sector.new(terror: 1, neutral: true) - expect(@rules.rally_9_priority([a, b, c], 2)[0]).to be c + b = Sector.new(terror: 3, support: true) + c = Sector.new(terror: 2, support: true) + expect(@rules.rally_9_priority([a, b, c], 3)[0]).to be c + end + + it 'rally_9_priority neutral' do + a = Sector.new(terror: 1, oppose: true) + b = Sector.new(terror: 3, neutral: true) + c = Sector.new(terror: 2, neutral: true) + expect(@rules.rally_9_priority([a, b, c], 3)[0]).to be c end end |