From de765f0e709925c99e19b67ce50f449a171f373f Mon Sep 17 00:00:00 2001 From: Phil Campeau Date: Mon, 8 Jun 2026 16:24:20 -0400 Subject: [PATCH] [1880 Romania] Game uses standard float --- lib/engine/game/g_1880/game.rb | 6 ++--- lib/engine/game/g_1880_romania/corporation.rb | 27 +++++++++++++++++++ lib/engine/game/g_1880_romania/game.rb | 11 +++++++- lib/engine/game/g_1880_romania/round/stock.rb | 18 +++++++++++++ 4 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 lib/engine/game/g_1880_romania/corporation.rb create mode 100644 lib/engine/game/g_1880_romania/round/stock.rb diff --git a/lib/engine/game/g_1880/game.rb b/lib/engine/game/g_1880/game.rb index 42459a00f0..e52ed6d8d5 100644 --- a/lib/engine/game/g_1880/game.rb +++ b/lib/engine/game/g_1880/game.rb @@ -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 diff --git a/lib/engine/game/g_1880_romania/corporation.rb b/lib/engine/game/g_1880_romania/corporation.rb new file mode 100644 index 0000000000..335c42db88 --- /dev/null +++ b/lib/engine/game/g_1880_romania/corporation.rb @@ -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 diff --git a/lib/engine/game/g_1880_romania/game.rb b/lib/engine/game/g_1880_romania/game.rb index 7428177982..f2c77e3603 100644 --- a/lib/engine/game/g_1880_romania/game.rb +++ b/lib/engine/game/g_1880_romania/game.rb @@ -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( @@ -155,6 +157,9 @@ 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 @@ -162,6 +167,10 @@ class Game < G1880::Game 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 @@ -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, diff --git a/lib/engine/game/g_1880_romania/round/stock.rb b/lib/engine/game/g_1880_romania/round/stock.rb new file mode 100644 index 0000000000..ef70806669 --- /dev/null +++ b/lib/engine/game/g_1880_romania/round/stock.rb @@ -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