Skip to content

Commit

Permalink
Merge pull request #10057 from michaeljb/1868WY-ames
Browse files Browse the repository at this point in the history
[1868WY] fix Ames double share protection
  • Loading branch information
michaeljb authored Dec 30, 2023
2 parents b3d770d + c0fa34e commit b197941
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/engine/game/g_1868_wy/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1979,6 +1979,10 @@ def after_sell_up(bundle, before)
net_sold = before[:num_shares] - num_buyable
share_price = @stock_market.find_relative_share_price(before[:share_price], bundle.corporation, [:up] * net_sold)

# if UP was ledged before being dumped, the new price after protection
# can't be higher than the pre-dump price
share_price = before[:share_price] if share_price.price > before[:share_price].price

after = {
president: president,
num_buyable: num_buyable,
Expand Down
2 changes: 1 addition & 1 deletion lib/engine/game/g_1868_wy/step/double_share_protection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def process_choose(action)
@game.swap_up_double_share_and_presidency!
@log << "#{player.name} swaps the Ames Brothers 20% share for the UP president's certificate"
else
old_price = @game.union_pacific.share_price.price
old_price = @game.union_pacific.share_price

swap = @game.up_protection_player_bundle

Expand Down

0 comments on commit b197941

Please sign in to comment.