diff --git a/lib/engine/game/g_18_india/step/sell_once_then_buy_certs.rb b/lib/engine/game/g_18_india/step/sell_once_then_buy_certs.rb index a3cdee9b0c..4c28ccb395 100644 --- a/lib/engine/game/g_18_india/step/sell_once_then_buy_certs.rb +++ b/lib/engine/game/g_18_india/step/sell_once_then_buy_certs.rb @@ -170,7 +170,8 @@ def can_buy_company?(entity, company) return false if @game.in_ipo?(company) && !can_buy_from_ipo?(entity, company) return false if current_entity.hand.include?(company) && !can_buy_from_hand?(entity, company) - (available_cash(entity) >= company.value) + price = current_entity.hand.include?(company) ? hand_price(company) : company.value + (available_cash(entity) >= price) end def can_buy_from_market?(entity, company) @@ -196,10 +197,20 @@ def can_buy_from_hand?(entity, company) prior.name == company.name end else - (available_cash(entity) >= company.value) + (available_cash(entity) >= hand_price(company)) end end + def hand_price(company) + return company.value unless %i[share president].include?(company.type) + + share = company.treasury + par = share.corporation.par_price + return company.value unless par + + (par.price * share.num_shares(ceil: false)).ceil + end + def can_buy_from_ipo?(entity, company) return false if @game.round_counter == 1 return false if @round.bought_from_market