Skip to content
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

21Moon: must sell in blocks; fix terminal bonus #10220

Merged
merged 1 commit into from
Feb 1, 2024
Merged
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
16 changes: 15 additions & 1 deletion lib/engine/game/g_21_moon/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Game < Game::Base
STARTING_CASH = { 2 => 600, 3 => 540, 4 => 410, 5 => 340 }.freeze
CAPITALIZATION = :incremental
SELL_AFTER = :any_time
MUST_SELL_IN_BLOCKS = false
MUST_SELL_IN_BLOCKS = true
SELL_MOVEMENT = :down_block
SOLD_OUT_INCREASE = true
POOL_SHARE_DROP = :down_block
Expand Down Expand Up @@ -640,6 +640,20 @@ def operated_operators
@corporations.select(&:operated?)
end

def check_distance(route, visits, train = nil)
train ||= route.train
distance = train.distance

route_distance = visits.sum(&:visit_cost)

# Getting terminal bonus also allow visiting one additional stop
east = visits.find { |stop| stop.groups.include?('E') }
terminal = visits.find { |stop| stop.hex.id == T_HEX }
route_distance -= 1 if east && terminal

raise RouteTooLong, "#{route_distance} is too many stops for #{distance} train" if distance < route_distance
end

def route_bonus(stops)
bonus = { revenue: 0 }

Expand Down
Loading