diff --git a/lib/engine/game/g_18_ga/entities.rb b/lib/engine/game/g_18_ga/entities.rb index 6939c774a3..4bc83fa4f0 100644 --- a/lib/engine/game/g_18_ga/entities.rb +++ b/lib/engine/game/g_18_ga/entities.rb @@ -122,7 +122,7 @@ def game_corporations logo: '18_ga/GF', simple_logo: '18_ga/GF.alt', tokens: [0, 40], - coordinates: @optional_rules&.include?(:new_georgia_florida_home) ? 'G3' : 'H4', + coordinates: @optional_rules.include?(:new_georgia_florida_home) ? 'G3' : 'H4', color: 'deepskyblue', text_color: 'black', }, @@ -132,8 +132,8 @@ def game_corporations name: 'Georgia Railroad', logo: '18_ga/GA', simple_logo: '18_ga/GA.alt', - tokens: @optional_rules&.include?(:cotton_port) ? [0, 0, 40, 100] : [0, 40, 100, 100], - coordinates: @optional_rules&.include?(:cotton_port) ? %w[D10 E15] : 'D10', + tokens: cotton_port? ? [0, 0, 40, 100] : [0, 40, 100, 100], + coordinates: cotton_port? ? %w[D10 E15] : 'D10', city: 0, color: 'green', }, diff --git a/lib/engine/game/g_18_ga/game.rb b/lib/engine/game/g_18_ga/game.rb index ae7c1eed6b..2382594be3 100644 --- a/lib/engine/game/g_18_ga/game.rb +++ b/lib/engine/game/g_18_ga/game.rb @@ -75,7 +75,7 @@ def setup setup_company_price_50_to_150_percent @recently_floated = [] - make_train_soft_rust if @optional_rules&.include?(:soft_rust_4t) + make_train_soft_rust if @optional_rules.include?(:soft_rust_4t) # Place neutral tokens in the off board cities neutral = Corporation.new( @@ -89,7 +89,7 @@ def setup neutral.tokens.each { |token| token.type = :neutral } - corporation_by_id('CoG').tokens.pop if @optional_rules&.include?(:remove_cog_token) + corporation_by_id('CoG').tokens.pop if @optional_rules.include?(:remove_cog_token) city_by_id('E1-0-0').place_token(neutral, neutral.next_token) city_by_id('J4-0-0').place_token(neutral, neutral.next_token) @@ -108,7 +108,7 @@ def setup end def tile_lays(entity) - return super if !@optional_rules&.include?(:double_yellow_first_or) || + return super if !@optional_rules.include?(:double_yellow_first_or) || !@recently_floated&.include?(entity) [{ lay: true, upgrade: true }, { lay: :not_if_upgraded, upgrade: false }] @@ -205,7 +205,7 @@ def remove_icon_from_waycross end def georgia_railroad - corporation_by_id('GA') + @georgia_railroad ||= corporation_by_id('GA') end def savannah @@ -217,10 +217,10 @@ def charleston end def optional_hexes - return self.class::HEXES unless @optional_rules&.include?(:cotton_port) + return self.class::HEXES unless cotton_port? new_hexes = {} - HEXES.keys.each do |color| + HEXES.each_key do |color| new_map = self.class::HEXES[color].transform_keys do |coords| coords - COTTON_REMOVE_HEXES end @@ -232,9 +232,9 @@ def optional_hexes end def place_home_token(corporation) - return if corporation.tokens.first&.used == true + return if corporation.tokens.first.used - return super unless @optional_rules&.include?(:cotton_port) + return super unless cotton_port? return super unless corporation == georgia_railroad georgia_railroad.coordinates.each do |coordinate| @@ -244,6 +244,10 @@ def place_home_token(corporation) end georgia_railroad.coordinates = [georgia_railroad.coordinates.first] end + + def cotton_port? + @cotton_port || @optional_rules.include?(:cotton_port) + end end end end