Skip to content

[1880] Add log message after SR when corp can't buy train #11691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/engine/game/g_1880/step/buy_train.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ def try_take_player_loan(entity, cost)
def log_skip(entity)
return if entity.minor?

return @log << "#{entity.name} is at train limit and cannot buy a train" unless room?(entity)
return @log << "#{entity.name} cannot afford a train" unless can_buy_train?(entity)

super
end

def log_pass(entity)
# this captures the ID of the current train available for purchase from the depot
train_id = @game.depot.depot_trains.first.id

# these log messages are returned when a corp comes out of the stock round unable to buy a train after having bought
# the last train of the previous rank
return @log << "#{entity.name} is at train limit and cannot buy a train" if !room?(entity) && train_id.end_with?('-0')
return @log << "#{entity.name} cannot afford a train" if !can_buy_train?(entity) && train_id.end_with?('-0')

super
end

Expand Down