Skip to content

Commit

Permalink
Merge pull request #11331 from roseundy/s18_britain_4d
Browse files Browse the repository at this point in the history
S18 Britain - fix 4Ds
  • Loading branch information
ollybh authored Nov 11, 2024
2 parents afe7d68 + 74064e3 commit 67425ef
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/engine/game/g_system18/map_britain_customization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -415,23 +415,23 @@ def map_britain_bonuses(route, stops)
end
non_scotland_city = stops.find { |stop| !BRITAIN_REGION_HEXES['Scotland'].include?(stop.hex.id) && stop.city? }
if scotland_city && non_scotland_city
bonus[:revenue] += @scotland_bonus_val.route_revenue(@phase, train) * (train.name == '4D' ? 2 : 1)
bonus[:revenue] += @scotland_bonus_val.route_revenue(@phase, train)
desc << 'Scotland'
end

# Wales (doubles with 4D)
wales_city = stops.find { |stop| BRITAIN_REGION_HEXES['Wales'].include?(stop.hex.id) && (stop.city? || stop.offboard?) }
non_wales_city = stops.find { |stop| !BRITAIN_REGION_HEXES['Wales'].include?(stop.hex.id) && stop.city? }
if wales_city && non_wales_city
bonus[:revenue] += @wales_bonus_val.route_revenue(@phase, train) * (train.name == '4D' ? 2 : 1)
bonus[:revenue] += @wales_bonus_val.route_revenue(@phase, train)
desc << 'Wales'
end

# London-Port (doubles with 4D)
london = stops.find { |stop| stop.hex.id == BRITAIN_LONDON_HEX }
port = stops.find { |stop| stop.tile.icons.any? { |i| i.name == 'port' } }
if london && port
bonus[:revenue] += @london_bonus_val.route_revenue(@phase, train) * (train.name == '4D' ? 2 : 1)
bonus[:revenue] += @london_bonus_val.route_revenue(@phase, train)
desc << 'London-Port'
end

Expand All @@ -443,7 +443,10 @@ def map_britain_mine_bonus(routes)
valid_route = routes.find { |r| !r.stops.empty? }
train = valid_route&.train
if train && @britain_corps_with_mines[train.owner.name]
@mine_bonus_val.route_revenue(@phase, train)
rev = @mine_bonus_val.route_revenue(@phase, train)
# undo automatic doubling of revenue with a diesel
rev /= 2 if train.name == '4D'
rev
else
0
end
Expand Down

0 comments on commit 67425ef

Please sign in to comment.