Skip to content

Commit

Permalink
Merge pull request tobymao#10463 from carlorusso1984/18zoo_fix_bug_10462
Browse files Browse the repository at this point in the history
18zoo - Implements fixes asked inside https://github.com/tobymao/18xx…
  • Loading branch information
benjaminxscott authored Apr 2, 2024
2 parents 1e62b0b + d293b0f commit c3b77e0
Show file tree
Hide file tree
Showing 5 changed files with 4,511 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/engine/game/g_18_zoo/step/buy_sell_par_shares.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def process_buy_company(action)
def get_par_prices(_entity, _corp)
super.reject do |p|
(p.price == 9 && !@game.phase.tiles.include?(:green)) ||
(p.price == 12 && !@game.phase.tiles.include?(:brown))
(p.price == 12 && !@game.phase.tiles.include?(:brown))
end
end

Expand Down Expand Up @@ -82,7 +82,12 @@ def sell_shares(entity, shares, swap: nil)
should_move = shares.owner == shares.corporation.owner || !@round.share_sold.include?(shares)
@round.share_sold << shares if shares.owner != shares.corporation.owner && !@round.share_sold.include?(shares)

@round.players_sold[shares.owner][shares.corporation] = :now
@game.sell_shares_and_change_price(shares, swap: swap, movement: (should_move ? @game.sell_movement : :none))
return if should_move

@game.log << ("#{shares.corporation.name}'S share price protected " \
'(share protection rule: avoid the "wait-and-sell-in-player-order" technique)')
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/engine/player.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def corporation
end

def ==(other)
other&.player? && (@name == other&.name)
!!other&.player? && (@name == other.name)
end

def player?
Expand Down
Loading

0 comments on commit c3b77e0

Please sign in to comment.