diff --git a/lib/engine/game/g_steam_over_holland/entities.rb b/lib/engine/game/g_steam_over_holland/entities.rb index 204bfd964e..5b18fe3787 100644 --- a/lib/engine/game/g_steam_over_holland/entities.rb +++ b/lib/engine/game/g_steam_over_holland/entities.rb @@ -116,6 +116,8 @@ module Entities type: 'train_discount', discount: 0.1, trains: %w[3 4 5], + when: 'buying_train', + owner_type: 'corporation', }, ], }, diff --git a/lib/engine/game/g_steam_over_holland/game.rb b/lib/engine/game/g_steam_over_holland/game.rb index 4e536db6c2..c98a0b82d2 100644 --- a/lib/engine/game/g_steam_over_holland/game.rb +++ b/lib/engine/game/g_steam_over_holland/game.rb @@ -421,7 +421,7 @@ def redeemable_shares(entity) end def emergency_issuable_bundles(entity) - return [] if @round.issued_shares[entity] || entity.cash >= @depot.min_depot_price + return [] if @round.issued_shares[entity] num_shares = [entity.num_player_shares, 5 - entity.num_market_shares].min diff --git a/lib/engine/game/g_steam_over_holland/step/buy_train.rb b/lib/engine/game/g_steam_over_holland/step/buy_train.rb index a5bf8f69f4..94fc05ba67 100644 --- a/lib/engine/game/g_steam_over_holland/step/buy_train.rb +++ b/lib/engine/game/g_steam_over_holland/step/buy_train.rb @@ -10,9 +10,9 @@ class BuyTrain < Engine::Step::BuyTrain def actions(entity) return [] if entity != current_entity - return ['sell_shares'] if entity == current_entity&.owner && can_ebuy_sell_shares?(current_entity) - return %w[sell_shares buy_train pass] if president_may_contribute?(entity) - return %w[buy_train pass] if can_buy_train?(entity) + return %w[sell_shares buy_train] if must_sell_shares?(entity) + return ['buy_train'] if can_afford_needed_train?(entity) + return %w[buy_train pass] if can_close_corp?(entity) || can_buy_train?(entity) [] end @@ -54,14 +54,15 @@ def process_sell_shares(action) def must_sell_shares?(corporation) return false if corporation.cash >= @game.depot.min_depot_price || !corporation.trains.empty? - can_issue?(corporation) + can_issue?(corporation) && + corporation.trains.empty? end def can_issue?(corporation) return false unless corporation.corporation? return false if @round.issued_shares[corporation] - !@game.issuable_shares(corporation).empty? + !@game.emergency_issuable_bundles(corporation).empty? end def should_buy_train?(entity)