diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2023-10-22 18:19:29 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2023-10-22 18:19:29 +0200 |
commit | 52e7a831cbff3ac1b9940e7f8a207db95f67d564 (patch) | |
tree | 7fadce98bcd3b7373d21d696d66cfd4d63553143 | |
parent | 211d6c0666ce58aa0330091e9eb076d3f231b57a (diff) | |
download | colonial-twilight-52e7a831cbff3ac1b9940e7f8a207db95f67d564.zip colonial-twilight-52e7a831cbff3ac1b9940e7f8a207db95f67d564.tar.gz |
fln_cubes -> guerrillas and fix #max_placable_flns
-rw-r--r-- | lib/colonial_twilight/fln_rules.rb | 6 | ||||
-rw-r--r-- | lib/colonial_twilight/forces.rb | 4 | ||||
-rw-r--r-- | lib/colonial_twilight/spaces.rb | 2 | ||||
-rw-r--r-- | spec/board_spec.rb | 6 | ||||
-rw-r--r-- | spec/fln_rules_spec.rb | 4 |
5 files changed, 11 insertions, 11 deletions
diff --git a/lib/colonial_twilight/fln_rules.rb b/lib/colonial_twilight/fln_rules.rb index f260dea..49a591e 100644 --- a/lib/colonial_twilight/fln_rules.rb +++ b/lib/colonial_twilight/fln_rules.rb @@ -20,15 +20,15 @@ module ColonialTwilight board.search(&method(:may_agitate_in?)) end - def max_placable_flns(space) - space.fln_bases.positive? ? space.fln_bases + space.pop - space.fln_cubes : 1 + def max_placable_guerrillas(space) + space.fln_bases.positive? ? space.fln_bases + space.pop : 1 end # March 3.3.2 # Attack 3.3.3 def may_attack_in?(space) - space.fln_cubes.positive? && space.gov.positive? + space.guerrillas.positive? && space.gov.positive? end def attack_spaces(board) diff --git a/lib/colonial_twilight/forces.rb b/lib/colonial_twilight/forces.rb index 4991c89..5e21931 100644 --- a/lib/colonial_twilight/forces.rb +++ b/lib/colonial_twilight/forces.rb @@ -71,10 +71,10 @@ module ColonialTwilight end def fln - fln_cubes + (@fln_bases || 0) + guerrillas + (@fln_bases || 0) end - def fln_cubes + def guerrillas (@fln_underground || 0) + (@fln_active || 0) end diff --git a/lib/colonial_twilight/spaces.rb b/lib/colonial_twilight/spaces.rb index 14d95a4..35e99ac 100644 --- a/lib/colonial_twilight/spaces.rb +++ b/lib/colonial_twilight/spaces.rb @@ -85,7 +85,7 @@ module ColonialTwilight %i[gov gov_bases gov_cubes french_cubes algerian_cubes troops police french_troops french_police algerian_troops algerian_police - fln fln_bases fln_cubes fln_underground fln_active max_bases control].each do |sym| + fln fln_bases guerrillas fln_underground fln_active max_bases control].each do |sym| define_method(sym) { @forces.send(sym) } end diff --git a/spec/board_spec.rb b/spec/board_spec.rb index 4f0e7aa..21a48fc 100644 --- a/spec/board_spec.rb +++ b/spec/board_spec.rb @@ -87,8 +87,8 @@ describe ColonialTwilight::Board do it 'has fln 2 pop' do expect(board.has { |s| s.pop == 2 && s.fln.positive? }).to be true end it 'has fln 3 pop' do expect(board.has { |s| s.pop == 3 && s.fln.positive? }).to be false end it 'count fln_bases' do expect(board.count(&:fln_bases)).to eq(8) end - it 'count fln with bases' do expect(board.count { |s| s.fln_bases.zero? ? 0 : s.fln_cubes }).to eq(13) end - it 'count fln without bases' do expect(board.count { |s| s.fln_bases.zero? ? s.fln_cubes : 0 }).to eq(4) end - it 'count fln in country' do expect(board.count { |s| s.country? ? s.fln_cubes : 0 }).to eq(9) end + it 'count fln with bases' do expect(board.count { |s| s.fln_bases.zero? ? 0 : s.guerrillas }).to eq(13) end + it 'count fln without bases' do expect(board.count { |s| s.fln_bases.zero? ? s.guerrillas : 0 }).to eq(4) end + it 'count fln in country' do expect(board.count { |s| s.country? ? s.guerrillas : 0 }).to eq(9) end end end diff --git a/spec/fln_rules_spec.rb b/spec/fln_rules_spec.rb index 90fc708..9a8c39c 100644 --- a/spec/fln_rules_spec.rb +++ b/spec/fln_rules_spec.rb @@ -28,14 +28,14 @@ describe ColonialTwilight::FLNRules do it 'may place 1 FLN cube' do @board.load :short space = @board.by_name('Mostaganem') - expect(rules.max_placable_flns(space)).to eq(1) + expect(rules.max_placable_guerrillas(space)).to eq(1) end it 'may place 2 FLN cube' do @board.load :short space = @board.by_name('Orleansville') space.add :fln_base - expect(rules.max_placable_flns(space)).to eq(3) + expect(rules.max_placable_guerrillas(space)).to eq(4) end end |