Skip to content

Commit

Permalink
updates suggested by ollybh
Browse files Browse the repository at this point in the history
  • Loading branch information
philcampeau committed Oct 8, 2024
1 parent 289d659 commit f6d483c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
6 changes: 3 additions & 3 deletions lib/engine/game/g_18_ga/entities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
Expand All @@ -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',
},
Expand Down
20 changes: 12 additions & 8 deletions lib/engine/game/g_18_ga/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
Expand All @@ -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 }]
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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|
Expand All @@ -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
Expand Down

0 comments on commit f6d483c

Please sign in to comment.