From f22b30d419f4a870b79d23b37b87bb3897728767 Mon Sep 17 00:00:00 2001 From: Patrik Olesen Date: Thu, 12 Sep 2024 20:38:59 +0200 Subject: [PATCH 1/2] [18Uruguay] Allow more than 60% to cover for loans Fixes #11110 --- lib/engine/game/g_18_uruguay/step/buy_sell_par_shares.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/engine/game/g_18_uruguay/step/buy_sell_par_shares.rb b/lib/engine/game/g_18_uruguay/step/buy_sell_par_shares.rb index fdf32f3205..0683918ce4 100644 --- a/lib/engine/game/g_18_uruguay/step/buy_sell_par_shares.rb +++ b/lib/engine/game/g_18_uruguay/step/buy_sell_par_shares.rb @@ -9,9 +9,17 @@ module Step class BuySellParShares < Engine::Step::BuySellParShares def can_buy?(entity, bundle) return false if bundle&.corporation == @game.rptla && !@game.phase.status.include?('rptla_available') + return true if loan_limit(entity, bundle) super(entity, bundle) end + + def loan_limit(_entity, bundle) + return false if bundle.nil? + return false if bundle.owner.corporation? + + bundle.corporation.loans.size > @game.maximum_loans(bundle.corporation) + end end end end From 721fc9cf2089979ce3e3b16c767b77b853687435 Mon Sep 17 00:00:00 2001 From: Patrik Olesen Date: Fri, 27 Sep 2024 08:14:54 +0200 Subject: [PATCH 2/2] [18Uruguay] changed can_buy? to can_gain? and renamed function --- lib/engine/game/g_18_uruguay/step/buy_sell_par_shares.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/engine/game/g_18_uruguay/step/buy_sell_par_shares.rb b/lib/engine/game/g_18_uruguay/step/buy_sell_par_shares.rb index 0683918ce4..e3eb27f06f 100644 --- a/lib/engine/game/g_18_uruguay/step/buy_sell_par_shares.rb +++ b/lib/engine/game/g_18_uruguay/step/buy_sell_par_shares.rb @@ -7,14 +7,14 @@ module Game module G18Uruguay module Step class BuySellParShares < Engine::Step::BuySellParShares - def can_buy?(entity, bundle) + def can_gain?(entity, bundle, exchange: false) return false if bundle&.corporation == @game.rptla && !@game.phase.status.include?('rptla_available') - return true if loan_limit(entity, bundle) + return true if excess_loans?(entity, bundle) - super(entity, bundle) + super end - def loan_limit(_entity, bundle) + def excess_loans?(_entity, bundle) return false if bundle.nil? return false if bundle.owner.corporation?