From 18cfac815820714fb6fd063d115b7584d6c276a3 Mon Sep 17 00:00:00 2001 From: Phil Campeau Date: Tue, 20 Aug 2024 21:22:50 -0400 Subject: [PATCH 1/3] [SteamOverHolland] fixes revenue bugs --- lib/engine/game/g_steam_over_holland/game.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/engine/game/g_steam_over_holland/game.rb b/lib/engine/game/g_steam_over_holland/game.rb index 0b952cdd6a..2fb9df888a 100644 --- a/lib/engine/game/g_steam_over_holland/game.rb +++ b/lib/engine/game/g_steam_over_holland/game.rb @@ -369,12 +369,13 @@ def check_distance(route, visits, train = nil) def revenue_for(route, stops) revenue = super - abilities = Array(abilities(route.corporation, :hex_bonus)) - return revenue if abilities.empty? + route.corporation.companies.each do |company| + abilities(company, :hex_bonus) do |ability| + revenue += stops.sum { |s| ability.hexes.include?(s.hex.id) ? ability.amount : 0 } + end + end - bonus_hexes = abilities.flat_map(&:hexes) - bonus = 20 * stops.map(&:hex).map(&:coordinates).intersect(bonus_hexes).size - revenue + bonus + revenue end def sell_shares_and_change_price(bundle, allow_president_change: true, swap: nil, movement: nil) From 71ef9afdca07a4fc7a6c2aca09d1b09ead09a7ae Mon Sep 17 00:00:00 2001 From: Phil Campeau Date: Sat, 24 Aug 2024 13:01:15 -0400 Subject: [PATCH 2/3] adjusts revenue_for method --- lib/engine/game/g_steam_over_holland/game.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/engine/game/g_steam_over_holland/game.rb b/lib/engine/game/g_steam_over_holland/game.rb index 2fb9df888a..969ef6d210 100644 --- a/lib/engine/game/g_steam_over_holland/game.rb +++ b/lib/engine/game/g_steam_over_holland/game.rb @@ -369,10 +369,8 @@ def check_distance(route, visits, train = nil) def revenue_for(route, stops) revenue = super - route.corporation.companies.each do |company| - abilities(company, :hex_bonus) do |ability| - revenue += stops.sum { |s| ability.hexes.include?(s.hex.id) ? ability.amount : 0 } - end + abilities(route.corporation, :hex_bonus) do |ability| + revenue += ability.amount * stops.count { |s| ability.hexes.include?(s.hex.id) } end revenue From 11d9936e1a1a82f5135b584cd8b9141f1f574a99 Mon Sep 17 00:00:00 2001 From: Phil Campeau Date: Mon, 26 Aug 2024 22:05:05 -0400 Subject: [PATCH 3/3] new fixes --- lib/engine/game/g_steam_over_holland/game.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/engine/game/g_steam_over_holland/game.rb b/lib/engine/game/g_steam_over_holland/game.rb index 969ef6d210..4e536db6c2 100644 --- a/lib/engine/game/g_steam_over_holland/game.rb +++ b/lib/engine/game/g_steam_over_holland/game.rb @@ -369,7 +369,7 @@ def check_distance(route, visits, train = nil) def revenue_for(route, stops) revenue = super - abilities(route.corporation, :hex_bonus) do |ability| + Array(abilities(route.corporation, :hex_bonus)).each do |ability| revenue += ability.amount * stops.count { |s| ability.hexes.include?(s.hex.id) } end