From 3ce529cbdac660e9a07cd1c33cd084ad3167fdf8 Mon Sep 17 00:00:00 2001 From: Michael Brandt Date: Sun, 1 Dec 2024 13:29:49 -0700 Subject: [PATCH] [18RoyalGorge] don't skip player if they can buy shares via private discount Fixes #11363 --- .../g_18_royal_gorge/step/buy_sell_par_shares.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/engine/game/g_18_royal_gorge/step/buy_sell_par_shares.rb b/lib/engine/game/g_18_royal_gorge/step/buy_sell_par_shares.rb index cb752d8411..ff437a443b 100644 --- a/lib/engine/game/g_18_royal_gorge/step/buy_sell_par_shares.rb +++ b/lib/engine/game/g_18_royal_gorge/step/buy_sell_par_shares.rb @@ -105,6 +105,20 @@ def can_sell?(entity, bundle) super end + + def can_buy_any?(entity) + super || can_buy_company_discounted_bundles?(entity) + end + + def can_buy_company_discounted_bundles?(entity) + return false if bought? + + cash = available_cash(entity) + bundles = company_discounted_bundles(@game.gold_corp) + company_discounted_bundles(@game.steel_corp) + bundles.any? do |_, bundle| + cash >= modify_purchase_price(bundle) + end + end end end end