Skip to content
Open
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
6 changes: 3 additions & 3 deletions lib/engine/game/g_1880/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,17 @@ class Game < Game::Base
).freeze

def event_float_30!
@log << "-- Event: #{EVENTS_TEXT['float_30'][1]} --"
@log << "-- Event: #{self.class::EVENTS_TEXT['float_30'][1]} --"
update_float_percent(30)
end

def event_float_40!
@log << "-- Event: #{EVENTS_TEXT['float_40'][1]} --"
@log << "-- Event: #{self.class::EVENTS_TEXT['float_40'][1]} --"
update_float_percent(40)
end

def event_float_60!
@log << "-- Event: #{EVENTS_TEXT['float_60'][1]} --"
@log << "-- Event: #{self.class::EVENTS_TEXT['float_60'][1]} --"
update_float_percent(60)
end

Expand Down
27 changes: 27 additions & 0 deletions lib/engine/game/g_1880_romania/corporation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

require_relative '../../corporation'

module Engine
module Game
module G1880Romania
class Corporation < Engine::Corporation
attr_accessor :building_permits, :fully_funded

def floated?
@floated ||= @ipo_owner.percent_of(self) <= (100 - @float_percent)
end

def percent_to_float
return 0 if @floated

@ipo_owner.percent_of(self) - (100 - @float_percent)
end

def float!
@floated = true
end
end
end
end
end
11 changes: 10 additions & 1 deletion lib/engine/game/g_1880_romania/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Game < G1880::Game

STARTING_CASH = { 3 => 600, 4 => 480, 5 => 400, 6 => 340 }.freeze

CORPORATION_CLASS = G1880Romania::Corporation

TRAINS_NOT_TRIGGERING_SR = %w[2R 8 8E].freeze

ASSIGNMENT_TOKENS = G1880::Game::ASSIGNMENT_TOKENS.merge(
Expand Down Expand Up @@ -155,13 +157,20 @@ class Game < G1880::Game
{ name: '2R', distance: 2, price: 250, num: 10, available_on: 'C2' }].freeze

EVENTS_TEXT = G1880::Game::EVENTS_TEXT.merge(
'float_30' => ['30% to Float', 'Corporation must sell 30% of shares to float'],
'float_40' => ['40% to Float', 'Corporation must sell 40% of shares to float'],
'float_60' => ['60% to Float', 'Corporation must sell 60% of shares to float'],
'signal_end_game' => ['Signal End Game', 'Game ends 3 ORs after purchase/export of last 6E train']
).freeze

GAME_END_REASONS_TEXT = {
final_train: 'Last 6E train sold',
}.freeze

def float_str(entity)
"#{entity.percent_to_float}% to float" if entity.corporation? && entity.floatable
end

def init_minors
game_minors.map { |minor| G1880::Minor.new(**minor) }
end
Expand All @@ -178,7 +187,7 @@ def new_auction_round
end

def stock_round
G1880::Round::Stock.new(self, [
G1880Romania::Round::Stock.new(self, [
Engine::Step::Exchange,
G1880Romania::Step::SpecialChoose,
G1880Romania::Step::BuySellParShares,
Expand Down
18 changes: 18 additions & 0 deletions lib/engine/game/g_1880_romania/round/stock.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

require_relative '../../../round/stock'

module Engine
module Game
module G1880Romania
module Round
class Stock < G1880::Round::Stock
def finish_round
@game.add_interest_player_loans!
super
end
end
end
end
end
end
Loading