diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2023-12-03 12:23:07 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2023-12-03 12:23:07 +0100 |
commit | 9be45071168928c2ad3b2a184c2a3c9e7183040a (patch) | |
tree | 66e5cc3a2d0b40fb97fb8f411f7eb088cace353d | |
parent | 7e94c38bc75cc0393e140e23df5531927acc87d7 (diff) | |
download | colonial-twilight-9be45071168928c2ad3b2a184c2a3c9e7183040a.zip colonial-twilight-9be45071168928c2ad3b2a184c2a3c9e7183040a.tar.gz |
FLNBotRules : fix rally 9 and priorities
-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 |