Skip to content

Commit

Permalink
Merge pull request #10016 from philcampeau/1825-multiple-10-buy
Browse files Browse the repository at this point in the history
[1825] corps can only pay multiples of 10 for crossbuys
  • Loading branch information
tobymao authored Dec 28, 2023
2 parents 45a1e5b + 838f579 commit a4be93a
Show file tree
Hide file tree
Showing 4 changed files with 9,457 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/engine/game/g_1825/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ def game_trains
TILE_LAYS = [{ lay: true, upgrade: true }, { lay: :not_if_upgraded, upgrade: false }].freeze
GAME_END_CHECK = { bank: :current_or, stock_market: :immediate }.freeze
TRAIN_PRICE_MIN = 10
TRAIN_PRICE_MULTIPLE = 10
IMPASSABLE_HEX_COLORS = %i[blue sepia red].freeze
TILE_200 = '200'

Expand Down
10 changes: 10 additions & 0 deletions lib/engine/game/g_1825/step/buy_train.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ def receivership_buy(entity)
log_skip(entity)
end
end

def process_buy_train(action)
if action.train.owned_by_corporation? && !(action.price % @game.class::TRAIN_PRICE_MULTIPLE).zero?
raise GameError, 'Train purchase price must be a multiple of '\
"#{@game.format_currency(@game.class::TRAIN_PRICE_MULTIPLE)}"
end

buy_train_action(action)
pass! unless can_buy_train?(action.entity)
end
end
end
end
Expand Down
Loading

0 comments on commit a4be93a

Please sign in to comment.