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

[18Ardennes] Allow public companies to issue shares #11341

Merged
merged 5 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions lib/engine/game/g_18_ardennes/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def operating_round(round_num)
G18Ardennes::Step::DeclineTrains,
G18Ardennes::Step::DeclineForts,
G18Ardennes::Step::PostConversionShares,
G18Ardennes::Step::IssueShares,
G18Ardennes::Step::Track,
G18Ardennes::Step::Token,
G18Ardennes::Step::CollectForts,
Expand Down Expand Up @@ -252,6 +253,18 @@ def convert!(corporation)
@log << "Certificate limit increases to #{new_limit}."
end

# Shares that can be issued as part of a public company's operating
# turn. This is not allowed on a public company's first turn.
def issuable_shares(corporation)
return [] unless corporation.corporation?
return [] if corporation.type == :minor
return [] if corporation.operating_history.empty?

bundles_for_corporation(corporation, corporation).select do |bundle|
@share_pool.fit_in_bank?(bundle)
end
end

private

def bankrupt_sell_companies(player)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def sellable_companies(entity)
# exchange for the minor company.
def exchangeable_pool_shares(corporation, ability)
minor = ability.owner
shares = @game.share_pool.shares_by_corporation[corporation]
shares = @game.share_pool.shares_by_corporation[corporation].take(1)
return [] if shares.empty?
return shares if corporation.owner == minor.owner
return shares if corporation.receivership?
Expand Down
35 changes: 35 additions & 0 deletions lib/engine/game/g_18_ardennes/step/issue_shares.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# frozen_string_literal: true

require_relative '../../../step/issue_shares'

module Engine
module Game
module G18Ardennes
module Step
class IssueShares < Engine::Step::IssueShares
def description
'Issue Shares'
end

def pass_description
'Skip (Issue Shares)'
end

def log_skip(entity)
super unless entity.type == :minor
end

def process_sell_shares(action)
super

corporation = action.entity
bundle = action.bundle
old_price = corporation.share_price
bundle.num_shares.times { @game.stock_market.move_left(corporation) }
@game.log_share_price(corporation, old_price)
end
end
end
end
end
end
Loading