From b336226f0ab09407ac2048d00b92f8f824dbdc5c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= <jeremy@asynk.ch>
Date: Mon, 30 Oct 2023 10:55:18 +0100
Subject: FLNRulse : add #max_agitate_cost(space)

---
 lib/colonial_twilight/fln_rules.rb |  4 ++++
 spec/fln_rules_spec.rb             | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/lib/colonial_twilight/fln_rules.rb b/lib/colonial_twilight/fln_rules.rb
index 2c5c00b..a472844 100644
--- a/lib/colonial_twilight/fln_rules.rb
+++ b/lib/colonial_twilight/fln_rules.rb
@@ -24,6 +24,10 @@ module ColonialTwilight
       space.fln_bases.positive? ? space.fln_bases + space.pop : 1
     end
 
+    def max_agitate_cost(space)
+      space.terror + (space.oppose? ? 0 : 1)
+    end
+
     # March 3.3.2
 
     # Attack 3.3.3
diff --git a/spec/fln_rules_spec.rb b/spec/fln_rules_spec.rb
index ce9b384..9a4ebdc 100644
--- a/spec/fln_rules_spec.rb
+++ b/spec/fln_rules_spec.rb
@@ -72,6 +72,16 @@ describe ColonialTwilight::FLNRules do
       # 4 with bases + 1 in fln control : but only 1 without fln control
       expect(rules.agitate_spaces(@board).size).to eq(1)
     end
+
+    it 'compute agitate cost terror and shift' do
+      a = Sector.new(terror: 2)
+      expect(rules.max_agitate_cost(a)).to eq(3)
+    end
+
+    it 'compute agitate terror' do
+      a = Sector.new(terror: 1, oppose: true)
+      expect(rules.max_agitate_cost(a)).to eq(1)
+    end
   end
 
   describe 'Attack' do
-- 
cgit v1.1-2-g2b99