diff options
| author | Jérémy Zurcher <jeremy@asynk.ch> | 2023-10-30 11:13:35 +0100 | 
|---|---|---|
| committer | Jérémy Zurcher <jeremy@asynk.ch> | 2023-10-30 11:13:35 +0100 | 
| commit | 9b47c09704523be98ab1cbdbb80b8243be08afe3 (patch) | |
| tree | f23cccae8b117b16c36c6dbdba3a34e03f0361fa | |
| parent | b336226f0ab09407ac2048d00b92f8f824dbdc5c (diff) | |
| download | colonial-twilight-9b47c09704523be98ab1cbdbb80b8243be08afe3.zip colonial-twilight-9b47c09704523be98ab1cbdbb80b8243be08afe3.tar.gz  | |
FLNBotRules : rally_6 considers terror && oppose
| -rw-r--r-- | lib/colonial_twilight/fln_bot_rules.rb | 4 | ||||
| -rw-r--r-- | spec/fln_bot_rules_spec.rb | 12 | 
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/colonial_twilight/fln_bot_rules.rb b/lib/colonial_twilight/fln_bot_rules.rb index 625d31e..b5bdbc9 100644 --- a/lib/colonial_twilight/fln_bot_rules.rb +++ b/lib/colonial_twilight/fln_bot_rules.rb @@ -98,9 +98,9 @@ module ColonialTwilight      def may_rally_6_in?(space, already_rallied)        # 2+ pop to agitate after rally -      r = (already_rallied || may_rally_in?(space)) && space.pop > 1 +      r = (already_rallied || may_rally_in?(space)) && space.pop > 1 && (space.terror.positive? || !space.oppose?)        if r -        # to agitate : FLN base or control after rally +        # may agitate if : FLN base or control after rally          n = already_rallied ? 0 : place_guerrillas_in(space).values.sum          r &= (space.fln_bases.positive? || (space.gov < (space.fln + n)))        end diff --git a/spec/fln_bot_rules_spec.rb b/spec/fln_bot_rules_spec.rb index fed7b24..612e32d 100644 --- a/spec/fln_bot_rules_spec.rb +++ b/spec/fln_bot_rules_spec.rb @@ -294,6 +294,18 @@ describe ColonialTwilight::FLNBotRules do        expect(@rules.may_rally_6_in?(a, false)).to be true      end +    it 'may_rally_6_in? pop 2+ and control but oppose' do +      a = Sector.new(pop: 2, gov_cubes: 1, fln_active: 1, oppose: true) +      @board.available_fln_underground = 1 +      expect(@rules.may_rally_6_in?(a, false)).to be false +    end + +    it 'may_rally_6_in? pop 2+ and control but oppose but terror' do +      a = Sector.new(pop: 2, gov_cubes: 1, fln_active: 1, oppose: true, terror: 1) +      @board.available_fln_underground = 1 +      expect(@rules.may_rally_6_in?(a, false)).to be true +    end +      it 'rally_6_priority population' do        a = Sector.new(pop: 2)        b = Sector.new(pop: 1)  | 
