Skip to content

Commit

Permalink
Merge pull request #11341 from ollybh/18ardennes-issue-shares
Browse files Browse the repository at this point in the history
[18Ardennes] Allow public companies to issue shares
  • Loading branch information
ollybh authored Nov 17, 2024
2 parents 709afba + 213147c commit 2a5c1b8
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
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

0 comments on commit 2a5c1b8

Please sign in to comment.