diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2023-09-24 14:18:37 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2023-09-24 14:18:37 +0200 |
commit | 41345b8cc52bdf1a01c30ab7b34bf7e3b901a853 (patch) | |
tree | 9814cea6acaa936dc85c1b0c11e836c11130f1c1 /lib/colonial_twilight | |
parent | b21d125966e118914f0442f322eebc298be78824 (diff) | |
download | colonial-twilight-41345b8cc52bdf1a01c30ab7b34bf7e3b901a853.zip colonial-twilight-41345b8cc52bdf1a01c30ab7b34bf7e3b901a853.tar.gz |
Board : fix Country @descr
Diffstat (limited to 'lib/colonial_twilight')
-rw-r--r-- | lib/colonial_twilight/board.rb | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/colonial_twilight/board.rb b/lib/colonial_twilight/board.rb index 3f2e326..44a493a 100644 --- a/lib/colonial_twilight/board.rb +++ b/lib/colonial_twilight/board.rb @@ -198,7 +198,13 @@ module ColonialTwilight def _compute_strings @terrain = %i[mountain coastal border].map { |s| send("#{s}?") ? s : nil }.reject(&:nil?).join('/') - @descr = "#{self.class.name} #{@name} #{@wilaya.nil? ? '' : @wilaya}" + (@sector.nil? ? '' : "-#{@sector}") + @descr = "#{@name} #{self.class.name.split('::')[-1]}#{number}" + end + + def number + return '' if @wilaya.nil? && @sector.nil? + + @descr = "(#{@wilaya}-#{@sector})" end public @@ -208,7 +214,7 @@ module ColonialTwilight end def inspect - "\n#{@descr} #{@terrain} + "\n#{@descr} : #{@terrain} control : #{control} alignment : #{@alignment} terror : #{@terror} @@ -316,12 +322,14 @@ module ColonialTwilight end end + # if independent, FLN may Rally, March and Extort in these Countries, + # but their Population is never counted in the total Opposition class Country < Sector attr_reader :independent - def initialize(name, wilaya) - super(name, wilaya, nil, 1, MOUNTAIN | BORDER | COASTAL) - @descr += " #{@independent ? 'Independant' : 'French'}" + def initialize(name) + super(name, nil, nil, 1, MOUNTAIN | BORDER | COASTAL) + @descr += ' : French' end def sector? @@ -338,7 +346,7 @@ module ColonialTwilight def independent! @independent = true - @descr += " #{@independent ? 'Independant' : 'French'}" + @descr.gsub!(/French/, 'Independent') end end @@ -510,8 +518,8 @@ module ColonialTwilight add Sector, 'Laghouat', 'V', 9, 0 add Sector, 'Sidi Aissa', 'VI', 1, 0, mountain add Sector, 'Ain Oussera', 'VI', 2, 1, mountain - add Country, 'Morocco', 0 - add Country, 'Tunisia', 1 + add Country, 'Morocco' + add Country, 'Tunisia' end def adjacents(idx, *args) |