From 2094830da2b925a86e31726b64631386bc28fa6b Mon Sep 17 00:00:00 2001 From: BlueChickenBoardGames Date: Wed, 28 Aug 2024 15:42:39 +0000 Subject: [PATCH 01/12] Created a copy of the System18 Poland map called Northern Italy --- lib/engine/game/g_system18/game.rb | 2 + .../map_northern_italy_customization.rb | 373 ++++++++++++++++++ lib/engine/game/g_system18/meta.rb | 8 +- .../round/northern_italy_parliament.rb | 14 + .../step/northern_italy_charter_auction.rb | 15 + 5 files changed, 411 insertions(+), 1 deletion(-) create mode 100644 lib/engine/game/g_system18/map_northern_italy_customization.rb create mode 100644 lib/engine/game/g_system18/round/northern_italy_parliament.rb create mode 100644 lib/engine/game/g_system18/step/northern_italy_charter_auction.rb diff --git a/lib/engine/game/g_system18/game.rb b/lib/engine/game/g_system18/game.rb index 2b082d4df3..dbeebb9dde 100644 --- a/lib/engine/game/g_system18/game.rb +++ b/lib/engine/game/g_system18/game.rb @@ -12,6 +12,7 @@ require_relative 'map_uk_limited_customization' require_relative 'map_china_rapid_development_customization' require_relative 'map_poland_customization' +require_relative 'map_northern_italy_customization' module Engine module Game @@ -28,6 +29,7 @@ class Game < Game::Base include MapUKLimitedCustomization include MapChinaRapidDevelopmentCustomization include MapPolandCustomization + include MapNorthernItalyCustomization register_colors(red: '#d1232a', orange: '#f58121', diff --git a/lib/engine/game/g_system18/map_northern_italy_customization.rb b/lib/engine/game/g_system18/map_northern_italy_customization.rb new file mode 100644 index 0000000000..bc4ee486b7 --- /dev/null +++ b/lib/engine/game/g_system18/map_northern_italy_customization.rb @@ -0,0 +1,373 @@ +# frozen_string_literal: true + +module Engine + module Game + module GSystem18 + module MapNorthernItalyCustomization + NORTHERN_ITALY_REGION_HEXES = { + 'Prussia' => %w[A3 A5 B2 B4 B6 C3 C5 D2 D4 E3 E5], + 'Russia' => %w[B8 C7 C9 D6 D8 D10], + 'Austria' => %w[E7 E9], + }.freeze + + NORTHERN_ITALY_CORP_REGIONS = { + 'SPX' => 'Prussia', + 'PHX' => 'Prussia', + 'GFN' => 'Russia', + 'DGN' => 'Russia', + 'KKN' => 'Austria', + }.freeze + + NORTHERN_ITALY_EWNS_BONUS = [0, 0, 0, 50, 50, 50, 60].freeze + + def map_northern_italy_game_tiles(tiles) + tiles.delete('12') + tiles.delete('13') + tiles.delete('59') + tiles.delete('64') + tiles.delete('65') + tiles.delete('66') + tiles.delete('67') + tiles.delete('68') + tiles.delete('205') + tiles.delete('206') + tiles['8'] = 4 + tiles.merge!({ + 'X1' => + { + 'count' => 1, + 'color' => 'green', + 'code' => 'city=revenue:30;path=a:0,b:_0;path=a:1,b:_0;path=a:2,b:_0;label=D', + }, + 'X2' => + { + 'count' => 1, + 'color' => 'green', + 'code' => 'city=revenue:50,loc:0.5;city=revenue:50,loc:2.5;city=revenue:50,loc:4.5;'\ + 'path=a:0,b:_0;path=a:_0,b:1;path=a:4,b:_2;path=a:_2,b:5;'\ + 'path=a:2,b:_1;path=a:_1,b:3;label=Wa', + + }, + 'X3' => + { + 'count' => 1, + 'color' => 'brown', + 'code' => 'city=revenue:70,slots:3;path=a:0,b:_0;path=a:1,b:_0;path=a:2,b:_0;'\ + 'path=a:3,b:_0;path=a:4,b:_0;path=a:5,b:_0;label=Wa', + + }, + 'X4' => + { + 'count' => 1, + 'color' => 'gray', + 'code' => 'city=revenue:100,slots:3;path=a:0,b:_0;path=a:1,b:_0;path=a:2,b:_0;'\ + 'path=a:3,b:_0;path=a:4,b:_0;path=a:5,b:_0;label=Wa', + + }, + 'X5' => + { + 'count' => 2, + 'color' => 'gray', + 'code' => 'city=revenue:70,slots:2;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ + 'path=a:5,b:_0;label=B', + }, + }) + end + + def map_northern_italy_layout + :pointy + end + + def map_northern_italy_game_location_names + { + 'A3' => '(Prussia)', + 'A5' => 'Danzig', + 'A7' => 'Königsberg', + 'B2' => 'Stettin', + 'B4' => 'Bromberg', + 'B6' => 'Ebling & Thorn', + 'B8' => '(Russia)', + 'B10' => 'St Petersburg', + 'C1' => 'Berlin', + 'C3' => 'Posen', + 'C7' => 'Warsaw', + 'C11' => 'Moscow', + 'D4' => 'Breslau', + 'D6' => 'Lodz', + 'D8' => 'Radom & Deblin', + 'D10' => 'Lublin', + 'E5' => 'Kattowitz', + 'E7' => 'Krakau', + 'E9' => '(Austria)', + 'E11' => 'Kiev', + 'F4' => 'Wien', + 'F10' => 'N-S and E-W bonuses', + } + end + + # rubocop:disable Layout/LineLength + def map_northern_italy_game_hexes + { + gray: { + %w[F6 F8] => 'path=a:2,b:3', + %w[F10] => 'offboard=revenue:yellow_0|green_0|brown_50|gray_60', + }, + + red: { + %w[A7] => 'offboard=revenue:yellow_20|green_30|brown_40|gray_40;path=a:0,b:_0;path=a:5,b:_0;label=N', + %w[B10] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_60;path=a:0,b:_0;path=a:1,b:_0;label=E', + %w[C1] => 'offboard=revenue:yellow_30|green_40|brown_60|gray_80;path=a:3,b:_0;path=a:4,b:_0;path=a:5,b:_0;label=W', + %w[C11] => 'offboard=revenue:yellow_20|green_30|brown_60|gray_90;path=a:0,b:_0;path=a:1,b:_0;label=E', + %w[E11] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_60;path=a:1,b:_0;path=a:2,b:_0;label=E', + %w[F4] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_70;path=a:2,b:_0;path=a:3,b:_0;label=S', + }, + white: { + %w[A3] => '', + %w[B8] => 'border=type:province,color:red,edge:1', + %w[C9 D2] => 'upgrade=cost:20,terrain:water', + %w[E9] => 'upgrade=cost:20,terrain:water;border=type:province,color:red,edge:2;border=type:province,color:red,edge:3', + %w[C5] => 'upgrade=cost:40,terrain:water;border=type:province,color:red,edge:4;border=type:province,color:red,edge:5', + %w[D8] => 'town=revenue:0;town=revenue:0;upgrade=cost:20,terrain:water;border=type:province,color:red,edge:0;border=type:province,color:red,edge:5', + %w[B6] => 'town=revenue:0;town=revenue:0;upgrade=cost:40,terrain:water;border=type:province,color:red,edge:4;border=type:province,color:red,edge:5', + %w[E3] => 'upgrade=cost:80,terrain:mountain', + %w[B2 B4] => 'city=revenue:0', + %w[A5] => 'city=revenue:0;future_label=label:D,color:green', + %w[D10] => 'city=revenue:0;border=type:province,color:red,edge:0', + %w[E5] => 'city=revenue:0;border=type:province,color:red,edge:4', + %w[D6] => 'city=revenue:0;border=type:province,color:red,edge:2;border=type:province,color:red,edge:1;border=type:province,color:red,edge:0', + %w[C3] => 'city=revenue:0;upgrade=cost:20,terrain:water', + }, + yellow: { + %w[C7] => 'city=revenue:40,loc:0;city=revenue:40,loc:2;city=revenue:40,loc:4;path=a:0,b:_0;path=a:2,b:_1;path=a:4,b:_2;border=type:province,color:red,edge:2;border=type:province,color:red,edge:1;label=Wa', + %w[D4] => 'city=revenue:30;path=a:1,b:_0;path=a:5,b:_0;border=type:province,color:red,edge:4;label=B', + %w[E7] => 'city=revenue:30;path=a:1,b:_0;path=a:5,b:_0;border=type:province,color:red,edge:1;border=type:province,color:red,edge:2;border=type:province,color:red,edge:3;label=B', + }, + } + end + # rubocop:enable Layout/LineLength + + def map_northern_italy_game_companies + [ + { + name: 'DGN Charter', + sym: 'DGN', + value: 0, + revenue: 0, + desc: 'Allows opening DGN corporation', + color: '#50c878', + }, + { + name: 'GFN Charter', + sym: 'GFN', + value: 0, + revenue: 0, + desc: 'Allows opening GFN corporation', + color: '#999999', + }, + { + name: 'PHX Charter', + sym: 'PHX', + value: 0, + revenue: 0, + desc: 'Allows opening PHX corporation', + color: '#ff7518', + text_color: 'black', + }, + { + name: 'KKN Charter', + sym: 'KKN', + value: 0, + revenue: 0, + desc: 'Allows opening KKN corporation', + color: '#0096ff', + }, + { + name: 'SPX Charter', + sym: 'SPX', + value: 0, + revenue: 0, + desc: 'Allows opening SPX corporation', + color: '#fafa33', + text_color: 'black', + }, + ] + end + + # DGN GFN PHX KKN SPX + def map_northern_italy_game_corporations(corps) + corps.each_with_index do |c, idx| + c[:float_percent] = 20 + c[:always_market_price] = true + c[:coordinates] = %w[C7 C7 D4 E7 B2][idx] + c[:city] = [0, 2, nil, nil, nil][idx] + end + corps + end + + def map_northern_italy_game_cash + { 2 => 480, 3 => 320, 4 => 240 } + end + + def map_northern_italy_game_cert_limit + { 2 => 20, 3 => 13, 4 => 10 } + end + + def map_northern_italy_game_capitalization + :incremental + end + + def map_northern_italy_game_market + self.class::MARKET_1D + end + + def map_northern_italy_game_trains(trains) + # don't use D trains + trains.delete(find_train(trains, 'D')) + find_train(trains, '4')[:rusts_on] = '8' + # udpate quantities + find_train(trains, '2')[:num] = 4 + find_train(trains, '3')[:num] = 3 + find_train(trains, '4')[:num] = 2 + find_train(trains, '5')[:num] = 2 + find_train(trains, '6')[:num] = 1 + find_train(trains, '8')[:num] = 10 + trains + end + + def map_northern_italy_game_phases + phases = self.class::S18_INCCAP_PHASES + phases[0][:status] = ['local_tokens'] # 2 + phases[1][:status] = ['local_tokens'] # 3 + phases[2][:status] = ['local_tokens'] # 4 + phases + end + + def map_northern_italy_constants + redef_const(:CURRENCY_FORMAT_STR, 'zł%s') + redef_const(:STATUS_TEXT, { 'local_tokens' => ['Local Tokens', 'Can only token in home country'] }) + end + + def map_northern_italy_company_header(_company) + 'CHARTER' + end + + def map_northern_italy_init_round + map_northern_italy_new_parliament_round + end + + def map_northern_italy_new_parliament_round + @log << "-- Parliament Round #{@turn} -- " + GSystem18::Round::NorthernItalyParliament.new(self, [ + GSystem18::Step::NorthernItalyCharterAuction, + ]) + end + #joost + + def map_northern_italy_next_round! + @round = + case @round + when Engine::Round::Stock + map_northern_italy_stock_round_finished + @operating_rounds = @phase.operating_rounds + reorder_players + new_operating_round + when Round::Operating + if @round.round_num < @operating_rounds + or_round_finished + new_operating_round(@round.round_num + 1) + else + @turn += 1 + or_round_finished + or_set_finished + map_northern_italy_new_parliament_round + end + else # Parliament Round + init_round_finished + new_stock_round + end + end + + # remove un-excersized charters from players + def map_northern_italy_stock_round_finished + @players.each do |player| + player.companies.dup.each do |c| + @log << "Right to open #{c.sym} lapses for #{player.name}" + player.companies.delete(c) + c.owner = nil + end + end + end + + def map_northern_italy_can_par?(corporation, entity) + !corporation.ipoed && entity.companies.find { |c| c.sym == corporation.name } + end + + def map_northern_italy_after_par(corporation) + entity = corporation.owner + + company = entity.companies.find { |c| c.sym == corporation.name } + raise GameError, 'Logic error, no matching company found' unless company + + entity.companies.delete(company) + company.close! + end + + def map_northern_italy_tokener_check_connected(entity, _city, hex) + return true if map_northern_italy_legal_token_hex?(entity, hex) + + region = NORTHERN_ITALY_CORP_REGIONS[entity&.name] + raise GameError, "#{entity.name} can only place tokens in #{region} until phase 5" + end + + def map_northern_italy_tokener_available_hex(entity, hex) + map_northern_italy_legal_token_hex?(entity, hex) + end + + def map_northern_italy_legal_token_hex?(entity, hex) + return true unless @phase.name.to_i < 5 + + region = NORTHERN_ITALY_CORP_REGIONS[entity&.name] + NORTHERN_ITALY_REGION_HEXES[region].include?(hex&.id) + end + + def map_northern_italy_extra_revenue_for(_route, stops) + map_northern_italy_east_west_north_south_bonus(stops)[:revenue] + end + + def map_northern_italy_extra_revenue_str(route) + bonus = map_northern_italy_east_west_north_south_bonus(route.stops)[:description] + bonus ? " + #{bonus}" : '' + end + + def map_northern_italy_east_west_north_south_bonus(stops) + bonus = { revenue: 0 } + + east = stops.find { |stop| stop.tile.label&.to_s == 'E' } + west = stops.find { |stop| stop.tile.label&.to_s == 'W' } + north = stops.find { |stop| stop.tile.label&.to_s == 'N' } + south = stops.find { |stop| stop.tile.label&.to_s == 'S' } + + if east && west + bonus[:revenue] += NORTHERN_ITALY_EWNS_BONUS[@phase.name.to_i - 2] + bonus[:description] = 'E/W' + end + + if north && south + bonus[:revenue] += NORTHERN_ITALY_EWNS_BONUS[@phase.name.to_i - 2] + bonus[:description] = 'N/S' + end + + bonus + end + + # FIXME: add reopen! method to Engine::Company + # + # open company associated with closed corporation + # def map_northern_italy_close_corporation_extra(corporation) + # company = companies.find { |c| c.sym == corporation.name } + # company.reopen! + # end + end + end + end +end diff --git a/lib/engine/game/g_system18/meta.rb b/lib/engine/game/g_system18/meta.rb index e7f3f7fb99..ec2acf33c1 100644 --- a/lib/engine/game/g_system18/meta.rb +++ b/lib/engine/game/g_system18/meta.rb @@ -56,10 +56,16 @@ module Meta players: [2, 3, 4], designer: 'Ian Wilson', }, + { + sym: :map_Northern_Italy, + short_name: 'Map: Northern Italy', + players: [2, 3, 4], + designer: 'Ian Wilson', + }, ].freeze MUTEX_RULES = [ - %i[map_NEUS map_France map_Twisting_Tracks map_UK_Limited map_China_Rapid_Development map_Poland], + %i[map_NEUS map_France map_Twisting_Tracks map_UK_Limited map_China_Rapid_Development map_Poland map_Northern_Italy], ].freeze end end diff --git a/lib/engine/game/g_system18/round/northern_italy_parliament.rb b/lib/engine/game/g_system18/round/northern_italy_parliament.rb new file mode 100644 index 0000000000..620a4acd38 --- /dev/null +++ b/lib/engine/game/g_system18/round/northern_italy_parliament.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +require_relative '../../../round/stock' + +module Engine + module Game + module GSystem18 + module Round + class NorthernItalyParliament < Engine::Round::Auction + end + end + end + end +end diff --git a/lib/engine/game/g_system18/step/northern_italy_charter_auction.rb b/lib/engine/game/g_system18/step/northern_italy_charter_auction.rb new file mode 100644 index 0000000000..8b02f0f1ba --- /dev/null +++ b/lib/engine/game/g_system18/step/northern_italy_charter_auction.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require_relative '../../../step/base' +require_relative 'upwards_auction' + +module Engine + module Game + module GSystem18 + module Step + class NorthernItalyCharterAuction < GSystem18::Step::UpwardsAuction + end + end + end + end +end From 618d2ef45e51a19472bfffe1c4ae0b834fb4d2af Mon Sep 17 00:00:00 2001 From: BlueChickenBoardGames Date: Tue, 10 Sep 2024 14:40:36 +0000 Subject: [PATCH 02/12] System18 Northern Italy regions, city names, tiles, map in progress --- .../map_northern_italy_customization.rb | 151 +++++++----------- 1 file changed, 62 insertions(+), 89 deletions(-) diff --git a/lib/engine/game/g_system18/map_northern_italy_customization.rb b/lib/engine/game/g_system18/map_northern_italy_customization.rb index bc4ee486b7..c4d409a99c 100644 --- a/lib/engine/game/g_system18/map_northern_italy_customization.rb +++ b/lib/engine/game/g_system18/map_northern_italy_customization.rb @@ -5,30 +5,23 @@ module Game module GSystem18 module MapNorthernItalyCustomization NORTHERN_ITALY_REGION_HEXES = { - 'Prussia' => %w[A3 A5 B2 B4 B6 C3 C5 D2 D4 E3 E5], - 'Russia' => %w[B8 C7 C9 D6 D8 D10], - 'Austria' => %w[E7 E9], + 'Piemonte' => %w[B3 B5 C4 D3 D5 E4], + 'Lombarida-Veneto' => %w[B7 B9 B11 C6 C8 C10 C12], + 'Emilia-Romagra' => %w[D7 D9 D11 E12], + 'Tuscana' => %w[E8 E10 F11], }.freeze NORTHERN_ITALY_CORP_REGIONS = { - 'SPX' => 'Prussia', - 'PHX' => 'Prussia', - 'GFN' => 'Russia', - 'DGN' => 'Russia', - 'KKN' => 'Austria', + 'SPX' => 'Emilia-Romagra', + 'PHX' => 'Piemonte', + 'GFN' => 'Lombarida-Veneto', + 'DGN' => 'Lombarida-Veneto', + 'KKN' => 'Tuscana', }.freeze - NORTHERN_ITALY_EWNS_BONUS = [0, 0, 0, 50, 50, 50, 60].freeze - def map_northern_italy_game_tiles(tiles) tiles.delete('12') tiles.delete('13') - tiles.delete('59') - tiles.delete('64') - tiles.delete('65') - tiles.delete('66') - tiles.delete('67') - tiles.delete('68') tiles.delete('205') tiles.delete('206') tiles['8'] = 4 @@ -36,40 +29,38 @@ def map_northern_italy_game_tiles(tiles) 'X1' => { 'count' => 1, - 'color' => 'green', - 'code' => 'city=revenue:30;path=a:0,b:_0;path=a:1,b:_0;path=a:2,b:_0;label=D', + 'color' => 'gray', + 'code' => 'city=revenue:70;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ + 'path=a:5,b:_0;label=Torino', }, 'X2' => { 'count' => 1, - 'color' => 'green', - 'code' => 'city=revenue:50,loc:0.5;city=revenue:50,loc:2.5;city=revenue:50,loc:4.5;'\ - 'path=a:0,b:_0;path=a:_0,b:1;path=a:4,b:_2;path=a:_2,b:5;'\ - 'path=a:2,b:_1;path=a:_1,b:3;label=Wa', - + 'color' => 'gray', + 'code' => 'city=revenue:90;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ + 'path=a:5,b:_0;label=Milano', }, 'X3' => { 'count' => 1, - 'color' => 'brown', - 'code' => 'city=revenue:70,slots:3;path=a:0,b:_0;path=a:1,b:_0;path=a:2,b:_0;'\ - 'path=a:3,b:_0;path=a:4,b:_0;path=a:5,b:_0;label=Wa', - + 'color' => 'gray', + 'code' => 'city=revenue:60;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ + 'path=a:5,b:_0;label=OO', }, - 'X4' => + '513' => { 'count' => 1, 'color' => 'gray', - 'code' => 'city=revenue:100,slots:3;path=a:0,b:_0;path=a:1,b:_0;path=a:2,b:_0;'\ - 'path=a:3,b:_0;path=a:4,b:_0;path=a:5,b:_0;label=Wa', + 'code' => 'city=revenue:60,slots:3;path=a:0,b:_0;path=a:1,b:_0;path=a:2,b:_0;'\ + 'path=a:3,b:_0;path=a:4,b:_0;path=a:5,b:_0', }, - 'X5' => + '895' => { - 'count' => 2, + 'count' => 1, 'color' => 'gray', - 'code' => 'city=revenue:70,slots:2;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ - 'path=a:5,b:_0;label=B', + 'code' => 'city=revenue:50,slots:2;path=a:0,b:_0;path=a:1,b:_0;path=a:2,b:_0;'\ + 'path=a:3,b:_0;path=a:4,b:_0;path=a:5,b:_0', }, }) end @@ -80,28 +71,29 @@ def map_northern_italy_layout def map_northern_italy_game_location_names { - 'A3' => '(Prussia)', - 'A5' => 'Danzig', - 'A7' => 'Königsberg', - 'B2' => 'Stettin', - 'B4' => 'Bromberg', - 'B6' => 'Ebling & Thorn', - 'B8' => '(Russia)', - 'B10' => 'St Petersburg', - 'C1' => 'Berlin', - 'C3' => 'Posen', - 'C7' => 'Warsaw', - 'C11' => 'Moscow', - 'D4' => 'Breslau', - 'D6' => 'Lodz', - 'D8' => 'Radom & Deblin', - 'D10' => 'Lublin', - 'E5' => 'Kattowitz', - 'E7' => 'Krakau', - 'E9' => '(Austria)', - 'E11' => 'Kiev', - 'F4' => 'Wien', - 'F10' => 'N-S and E-W bonuses', + 'A4' => 'Switzerland', + 'B7' => 'Bergamo', + 'B9' => '(Lombardia-Veneto)', + 'B11' => 'Trento & Vicenza', + 'B13' => 'Trieste', + 'C2' => 'France', + 'C4' => 'Torino', + 'C6' => 'Milano', + 'C8' => 'Brescia', + 'C10' => 'Verona', + 'C12' => 'Padova & Venzéia', + 'D5' => 'Genova', + 'D7' => '(Emilia-Romagra)', + 'D9' => 'Parma & Modena', + 'D11' => 'Bologna', + 'E2' => 'France', + 'E4' => '(Piemonte)', + 'E8' => 'La Spezia & Livorno', + 'E10' => 'Firenze', + 'E12' => 'Ravenna & Rimini', + 'F9' => 'Roma', + 'F11' => '(Tuscana)', + 'F13' => 'Ancona', } end @@ -109,20 +101,22 @@ def map_northern_italy_game_location_names def map_northern_italy_game_hexes { gray: { - %w[F6 F8] => 'path=a:2,b:3', - %w[F10] => 'offboard=revenue:yellow_0|green_0|brown_50|gray_60', + %w[A8] => 'junction;path=a:0,b:_0,terminal:1', + %w[A10] => 'junction;path=a:5,b:_0,terminal:1', + %w[D13] => 'path=a:0,b:1;path=a:1,b:2', }, red: { - %w[A7] => 'offboard=revenue:yellow_20|green_30|brown_40|gray_40;path=a:0,b:_0;path=a:5,b:_0;label=N', - %w[B10] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_60;path=a:0,b:_0;path=a:1,b:_0;label=E', - %w[C1] => 'offboard=revenue:yellow_30|green_40|brown_60|gray_80;path=a:3,b:_0;path=a:4,b:_0;path=a:5,b:_0;label=W', - %w[C11] => 'offboard=revenue:yellow_20|green_30|brown_60|gray_90;path=a:0,b:_0;path=a:1,b:_0;label=E', - %w[E11] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_60;path=a:1,b:_0;path=a:2,b:_0;label=E', - %w[F4] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_70;path=a:2,b:_0;path=a:3,b:_0;label=S', + %w[A4] => 'junction;path=a:5,b:_0,terminal:1', + %w[A6] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_70;path=a:5,b:_0;path=a:0,b:_0', + %w[B13] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_60;path=a:0,b:_0;path=a:1,b:_0', + %w[C2] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_70;path=a:4,b:_0', + %w[E2] => 'junction;path=a:3,b:_0,terminal:1;path=a:4,b:_0,terminal:1', + %w[F9] => 'offboard=revenue:yellow_30|green_50|brown_70|gray_100;path=a:2,b:_0;path=a:3,b:_0', + %w[F9] => 'offboard=revenue:yellow_20|green_30|brown_40|gray_50;path=a:2,b:_0', }, white: { - %w[A3] => '', + %w[E4 E6] => '', %w[B8] => 'border=type:province,color:red,edge:1', %w[C9 D2] => 'upgrade=cost:20,terrain:water', %w[E9] => 'upgrade=cost:20,terrain:water;border=type:province,color:red,edge:2;border=type:province,color:red,edge:3', @@ -138,9 +132,9 @@ def map_northern_italy_game_hexes %w[C3] => 'city=revenue:0;upgrade=cost:20,terrain:water', }, yellow: { - %w[C7] => 'city=revenue:40,loc:0;city=revenue:40,loc:2;city=revenue:40,loc:4;path=a:0,b:_0;path=a:2,b:_1;path=a:4,b:_2;border=type:province,color:red,edge:2;border=type:province,color:red,edge:1;label=Wa', - %w[D4] => 'city=revenue:30;path=a:1,b:_0;path=a:5,b:_0;border=type:province,color:red,edge:4;label=B', - %w[E7] => 'city=revenue:30;path=a:1,b:_0;path=a:5,b:_0;border=type:province,color:red,edge:1;border=type:province,color:red,edge:2;border=type:province,color:red,edge:3;label=B', + %w[C12] => 'city=revenue:30,loc:0;city=revenue:30,loc:2;path=a:1,b:_0;border=type:province,color:red,edge:0;border=type:province,color:red,edge:5;label=OO', + %w[C6] => 'city=revenue:30;path=a:4,b:_0;border=type:province,color:red,edge:0;border=type:province,color:red,edge:2;label=B', + %w[C4] => 'city=revenue:30;path=a:5,b:_0;border=type:province,color:red,edge:4;label=B', }, } end @@ -339,27 +333,6 @@ def map_northern_italy_extra_revenue_str(route) bonus ? " + #{bonus}" : '' end - def map_northern_italy_east_west_north_south_bonus(stops) - bonus = { revenue: 0 } - - east = stops.find { |stop| stop.tile.label&.to_s == 'E' } - west = stops.find { |stop| stop.tile.label&.to_s == 'W' } - north = stops.find { |stop| stop.tile.label&.to_s == 'N' } - south = stops.find { |stop| stop.tile.label&.to_s == 'S' } - - if east && west - bonus[:revenue] += NORTHERN_ITALY_EWNS_BONUS[@phase.name.to_i - 2] - bonus[:description] = 'E/W' - end - - if north && south - bonus[:revenue] += NORTHERN_ITALY_EWNS_BONUS[@phase.name.to_i - 2] - bonus[:description] = 'N/S' - end - - bonus - end - # FIXME: add reopen! method to Engine::Company # # open company associated with closed corporation From e69c722542f3e38e36255ed6017754dde8cb339b Mon Sep 17 00:00:00 2001 From: BlueChickenBoardGames Date: Tue, 10 Sep 2024 21:01:12 +0000 Subject: [PATCH 03/12] System18 Northern Italy finished map and other stuff, still number of issues to fix --- .../map_northern_italy_customization.rb | 83 +++++++++---------- 1 file changed, 39 insertions(+), 44 deletions(-) diff --git a/lib/engine/game/g_system18/map_northern_italy_customization.rb b/lib/engine/game/g_system18/map_northern_italy_customization.rb index c4d409a99c..d429937004 100644 --- a/lib/engine/game/g_system18/map_northern_italy_customization.rb +++ b/lib/engine/game/g_system18/map_northern_italy_customization.rb @@ -30,21 +30,21 @@ def map_northern_italy_game_tiles(tiles) { 'count' => 1, 'color' => 'gray', - 'code' => 'city=revenue:70;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ - 'path=a:5,b:_0;label=Torino', + 'code' => 'city=revenue:70,slots:2;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ + 'path=a:5,b:_0;label=B', }, 'X2' => { 'count' => 1, 'color' => 'gray', - 'code' => 'city=revenue:90;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ - 'path=a:5,b:_0;label=Milano', + 'code' => 'city=revenue:90,slots:2;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ + 'path=a:5,b:_0;label=B', }, 'X3' => { 'count' => 1, 'color' => 'gray', - 'code' => 'city=revenue:60;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ + 'code' => 'city=revenue:60,slots:2;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ 'path=a:5,b:_0;label=OO', }, '513' => @@ -113,23 +113,24 @@ def map_northern_italy_game_hexes %w[C2] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_70;path=a:4,b:_0', %w[E2] => 'junction;path=a:3,b:_0,terminal:1;path=a:4,b:_0,terminal:1', %w[F9] => 'offboard=revenue:yellow_30|green_50|brown_70|gray_100;path=a:2,b:_0;path=a:3,b:_0', - %w[F9] => 'offboard=revenue:yellow_20|green_30|brown_40|gray_50;path=a:2,b:_0', + %w[F13] => 'offboard=revenue:yellow_20|green_30|brown_40|gray_50;path=a:2,b:_0', }, white: { - %w[E4 E6] => '', - %w[B8] => 'border=type:province,color:red,edge:1', - %w[C9 D2] => 'upgrade=cost:20,terrain:water', - %w[E9] => 'upgrade=cost:20,terrain:water;border=type:province,color:red,edge:2;border=type:province,color:red,edge:3', - %w[C5] => 'upgrade=cost:40,terrain:water;border=type:province,color:red,edge:4;border=type:province,color:red,edge:5', - %w[D8] => 'town=revenue:0;town=revenue:0;upgrade=cost:20,terrain:water;border=type:province,color:red,edge:0;border=type:province,color:red,edge:5', - %w[B6] => 'town=revenue:0;town=revenue:0;upgrade=cost:40,terrain:water;border=type:province,color:red,edge:4;border=type:province,color:red,edge:5', - %w[E3] => 'upgrade=cost:80,terrain:mountain', - %w[B2 B4] => 'city=revenue:0', - %w[A5] => 'city=revenue:0;future_label=label:D,color:green', - %w[D10] => 'city=revenue:0;border=type:province,color:red,edge:0', - %w[E5] => 'city=revenue:0;border=type:province,color:red,edge:4', - %w[D6] => 'city=revenue:0;border=type:province,color:red,edge:2;border=type:province,color:red,edge:1;border=type:province,color:red,edge:0', - %w[C3] => 'city=revenue:0;upgrade=cost:20,terrain:water', + %w[B3] => 'upgrade=cost:120,terrain:mountain', + %w[B7 D5] => 'city=revenue:0;upgrade=cost:40,terrain:mountain', + %w[B5] => 'upgrade=cost:40,terrain:mountain;border=type:province,color:red,edge:4', + %w[B9 D3] => 'upgrade=cost:80,terrain:mountain', + %w[B11] => 'town=revenue:0;town=revenue:0;upgrade=cost:40,terrain:mountain', + %w[C8 C10] => 'city=revenue:0;upgrade=cost:20,terrain:water', + %w[D7] => 'upgrade=cost:40,terrain:mountain;border=type:province,color:red,edge:1;border=type:province,color:red,edge:2;border=type:province,color:red,edge:3', + %w[D9] => 'town=revenue:0;town=revenue:0;border=type:province,color:red,edge:2;border=type:province,color:red,edge:3', + %w[D11] => 'city=revenue:0;upgrade=cost:20,terrain:water;border=type:province,color:red,edge:0;border=type:province,color:red,edge:2', + %w[E4] => '', + %w[E8] => 'town=revenue:0;town=revenue:0;border=type:province,color:red,edge:3;border=edge:3,type:mountain,cost:40;border=type:province,color:red,edge:2', + %w[E6] => 'border=type:impassable,color:black,edge:1;border=type:province,color:red,edge:3;border=type:province,color:red,edge:4', + %w[E10] => 'city=revenue:0;border=type:province,color:red,edge:2;border=edge:2,type:mountain,cost:40;border=type:province,color:red,edge:3;border=edge:3,type:mountain,cost:40', + %w[E12] => 'town=revenue:0;town=revenue:0;border=type:province,color:red,edge:1;border=edge:1,type:mountain,cost:40', + %w[F11] => 'upgrade=cost:40,terrain:mountain;border=type:province,color:red,edge:3', }, yellow: { %w[C12] => 'city=revenue:30,loc:0;city=revenue:30,loc:2;path=a:1,b:_0;border=type:province,color:red,edge:0;border=type:province,color:red,edge:5;label=OO', @@ -192,8 +193,8 @@ def map_northern_italy_game_corporations(corps) corps.each_with_index do |c, idx| c[:float_percent] = 20 c[:always_market_price] = true - c[:coordinates] = %w[C7 C7 D4 E7 B2][idx] - c[:city] = [0, 2, nil, nil, nil][idx] + c[:coordinates] = %w[C6 C12 C4 E10 D11][idx] + c[:city] = [nil, 0, nil, nil, nil][idx] end corps end @@ -211,20 +212,23 @@ def map_northern_italy_game_capitalization end def map_northern_italy_game_market - self.class::MARKET_1D + self.class::MARKET_2D end def map_northern_italy_game_trains(trains) - # don't use D trains - trains.delete(find_train(trains, 'D')) - find_train(trains, '4')[:rusts_on] = '8' - # udpate quantities - find_train(trains, '2')[:num] = 4 - find_train(trains, '3')[:num] = 3 - find_train(trains, '4')[:num] = 2 + #rusting + find_train(trains, '3')[:rusts_on] = '5' + find_train(trains, '5')[:rusts_on] = 'D' + #price + find_train(trains, '5')[:price] = 450 + # update quantities + find_train(trains, '2')[:num] = 5 + find_train(trains, '3')[:num] = 4 + find_train(trains, '4')[:num] = 3 find_train(trains, '5')[:num] = 2 find_train(trains, '6')[:num] = 1 - find_train(trains, '8')[:num] = 10 + find_train(trains, '8')[:num] = 1 + find_train(trains, 'D')[:num] = 10 trains end @@ -237,8 +241,8 @@ def map_northern_italy_game_phases end def map_northern_italy_constants - redef_const(:CURRENCY_FORMAT_STR, 'zł%s') - redef_const(:STATUS_TEXT, { 'local_tokens' => ['Local Tokens', 'Can only token in home country'] }) + redef_const(:CURRENCY_FORMAT_STR, '$%s') + redef_const(:STATUS_TEXT, { 'local_tokens' => ['Local Tokens', 'Can only token in home region'] }) end def map_northern_italy_company_header(_company) @@ -255,8 +259,7 @@ def map_northern_italy_new_parliament_round GSystem18::Step::NorthernItalyCharterAuction, ]) end - #joost - + def map_northern_italy_next_round! @round = case @round @@ -319,20 +322,12 @@ def map_northern_italy_tokener_available_hex(entity, hex) def map_northern_italy_legal_token_hex?(entity, hex) return true unless @phase.name.to_i < 5 + return true if @phase.name == 'D' region = NORTHERN_ITALY_CORP_REGIONS[entity&.name] NORTHERN_ITALY_REGION_HEXES[region].include?(hex&.id) end - def map_northern_italy_extra_revenue_for(_route, stops) - map_northern_italy_east_west_north_south_bonus(stops)[:revenue] - end - - def map_northern_italy_extra_revenue_str(route) - bonus = map_northern_italy_east_west_north_south_bonus(route.stops)[:description] - bonus ? " + #{bonus}" : '' - end - # FIXME: add reopen! method to Engine::Company # # open company associated with closed corporation From 670d48701a47c53913b7f0805c688f2f8ae11c19 Mon Sep 17 00:00:00 2001 From: BlueChickenBoardGames Date: Wed, 11 Sep 2024 15:20:02 +0000 Subject: [PATCH 04/12] System18 Northern Italy: map fixes, phases, share price movement as full cap, share issueing --- lib/engine/game/g_system18/game.rb | 18 +++++- .../map_northern_italy_customization.rb | 63 +++++++++++++++---- lib/engine/game/g_system18/step/dividend.rb | 2 +- .../game/g_system18/step/issue_shares.rb | 17 +++++ 4 files changed, 86 insertions(+), 14 deletions(-) create mode 100644 lib/engine/game/g_system18/step/issue_shares.rb diff --git a/lib/engine/game/g_system18/game.rb b/lib/engine/game/g_system18/game.rb index dbeebb9dde..21073eab41 100644 --- a/lib/engine/game/g_system18/game.rb +++ b/lib/engine/game/g_system18/game.rb @@ -369,7 +369,15 @@ def game_phases end def half_dividend_by_map? - game_capitalization == :incremental + return game_capitalization == :incremental unless respond_to?("map_#{map_name}_half_dividend") + + send("map_#{map_name}_half_dividend") + end + + def share_price_change_as_full_cap_by_map? + return game_capitalization == :incremental unless respond_to?("map_#{map_name}_share_price_change_as_full_cap") + + send("map_#{map_name}_share_price_change_as_full_cap") end def redef_const(const, value) @@ -627,6 +635,14 @@ def timeline def ipo_name(_corp) game_capitalization == :incremental ? 'Treasury' : 'IPO' end + + def issuable_shares(entity) + return [] unless entity.operating_history.size > 1 + return [] unless entity.corporation? + + bundles_for_corporation(entity, entity) + .select { |bundle| @share_pool.fit_in_bank?(bundle) } + end end end end diff --git a/lib/engine/game/g_system18/map_northern_italy_customization.rb b/lib/engine/game/g_system18/map_northern_italy_customization.rb index d429937004..8a0adea580 100644 --- a/lib/engine/game/g_system18/map_northern_italy_customization.rb +++ b/lib/engine/game/g_system18/map_northern_italy_customization.rb @@ -31,14 +31,14 @@ def map_northern_italy_game_tiles(tiles) 'count' => 1, 'color' => 'gray', 'code' => 'city=revenue:70,slots:2;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ - 'path=a:5,b:_0;label=B', + 'path=a:5,b:_0;label=To', }, 'X2' => { 'count' => 1, 'color' => 'gray', 'code' => 'city=revenue:90,slots:2;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ - 'path=a:5,b:_0;label=B', + 'path=a:5,b:_0;label=Mi', }, 'X3' => { @@ -107,11 +107,11 @@ def map_northern_italy_game_hexes }, red: { - %w[A4] => 'junction;path=a:5,b:_0,terminal:1', - %w[A6] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_70;path=a:5,b:_0;path=a:0,b:_0', + %w[A4] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_70,hide:1,groups:Switzerland;path=a:5,b:_0', + %w[A6] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_70,groups:Switzerland;path=a:5,b:_0;path=a:0,b:_0', %w[B13] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_60;path=a:0,b:_0;path=a:1,b:_0', - %w[C2] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_70;path=a:4,b:_0', - %w[E2] => 'junction;path=a:3,b:_0,terminal:1;path=a:4,b:_0,terminal:1', + %w[C2] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_70,groups:France;path=a:4,b:_0', + %w[E2] => 'offboard=revenue:yellow_30|green_40|brown_50|gray_70,hide:1,groups:France;path=a:3,b:_0,terminal:1;path=a:4,b:_0', %w[F9] => 'offboard=revenue:yellow_30|green_50|brown_70|gray_100;path=a:2,b:_0;path=a:3,b:_0', %w[F13] => 'offboard=revenue:yellow_20|green_30|brown_40|gray_50;path=a:2,b:_0', }, @@ -123,19 +123,19 @@ def map_northern_italy_game_hexes %w[B11] => 'town=revenue:0;town=revenue:0;upgrade=cost:40,terrain:mountain', %w[C8 C10] => 'city=revenue:0;upgrade=cost:20,terrain:water', %w[D7] => 'upgrade=cost:40,terrain:mountain;border=type:province,color:red,edge:1;border=type:province,color:red,edge:2;border=type:province,color:red,edge:3', - %w[D9] => 'town=revenue:0;town=revenue:0;border=type:province,color:red,edge:2;border=type:province,color:red,edge:3', - %w[D11] => 'city=revenue:0;upgrade=cost:20,terrain:water;border=type:province,color:red,edge:0;border=type:province,color:red,edge:2', + %w[D9] => 'town=revenue:0;town=revenue:0;border=type:province,color:red,edge:2;border=type:province,color:red,edge:3;border=edge:0,type:mountain,cost:40;border=edge:5,type:mountain,cost:40', + %w[D11] => 'city=revenue:0;upgrade=cost:20,terrain:water;border=type:province,color:red,edge:0;border=type:province,color:red,edge:2;border=edge:0,type:mountain,cost:40', %w[E4] => '', %w[E8] => 'town=revenue:0;town=revenue:0;border=type:province,color:red,edge:3;border=edge:3,type:mountain,cost:40;border=type:province,color:red,edge:2', %w[E6] => 'border=type:impassable,color:black,edge:1;border=type:province,color:red,edge:3;border=type:province,color:red,edge:4', - %w[E10] => 'city=revenue:0;border=type:province,color:red,edge:2;border=edge:2,type:mountain,cost:40;border=type:province,color:red,edge:3;border=edge:3,type:mountain,cost:40', + %w[E10] => 'city=revenue:0;border=type:province,color:red,edge:2;border=edge:2,type:mountain,cost:40;border=type:province,color:red,edge:3;border=edge:3,type:mountain,cost:40;border=edge:4,type:mountain,cost:40', %w[E12] => 'town=revenue:0;town=revenue:0;border=type:province,color:red,edge:1;border=edge:1,type:mountain,cost:40', %w[F11] => 'upgrade=cost:40,terrain:mountain;border=type:province,color:red,edge:3', }, yellow: { %w[C12] => 'city=revenue:30,loc:0;city=revenue:30,loc:2;path=a:1,b:_0;border=type:province,color:red,edge:0;border=type:province,color:red,edge:5;label=OO', - %w[C6] => 'city=revenue:30;path=a:4,b:_0;border=type:province,color:red,edge:0;border=type:province,color:red,edge:2;label=B', - %w[C4] => 'city=revenue:30;path=a:5,b:_0;border=type:province,color:red,edge:4;label=B', + %w[C6] => 'city=revenue:30;path=a:4,b:_0;border=type:province,color:red,edge:0;border=type:province,color:red,edge:2;future_label=label:Mi,color:gray;label=B', + %w[C4] => 'city=revenue:30;path=a:5,b:_0;border=type:province,color:red,edge:4;future_label=label:To,color:gray;label=B', }, } end @@ -211,6 +211,14 @@ def map_northern_italy_game_capitalization :incremental end + def map_northern_italy_half_dividend + return false + end + + def map_northern_italy_hare_price_change_as_full_cap + return false + end + def map_northern_italy_game_market self.class::MARKET_2D end @@ -221,6 +229,8 @@ def map_northern_italy_game_trains(trains) find_train(trains, '5')[:rusts_on] = 'D' #price find_train(trains, '5')[:price] = 450 + #discount + find_train(trains, 'D')[:discount] = { '4' => 200, '5' => 200, '6' => 200, '8' => 200 } # update quantities find_train(trains, '2')[:num] = 5 find_train(trains, '3')[:num] = 4 @@ -233,16 +243,27 @@ def map_northern_italy_game_trains(trains) end def map_northern_italy_game_phases - phases = self.class::S18_INCCAP_PHASES + phases = Array.new(self.class::S18_INCCAP_PHASES) phases[0][:status] = ['local_tokens'] # 2 phases[1][:status] = ['local_tokens'] # 3 phases[2][:status] = ['local_tokens'] # 4 + + phases << { + name: 'D', + on: 'D', + train_limit: 2, + tiles: %i[yellow green brown gray], + operating_rounds: 2, + } + phases end def map_northern_italy_constants redef_const(:CURRENCY_FORMAT_STR, '$%s') redef_const(:STATUS_TEXT, { 'local_tokens' => ['Local Tokens', 'Can only token in home region'] }) + redef_const(:SELL_MOVEMENT, :down_share) + redef_const(:SOLD_OUT_INCREASE, true) end def map_northern_italy_company_header(_company) @@ -328,6 +349,24 @@ def map_northern_italy_legal_token_hex?(entity, hex) NORTHERN_ITALY_REGION_HEXES[region].include?(hex&.id) end + def map_northern_italy_operating_steps + [ + GSystem18::Step::Bankrupt, + Engine::Step::Exchange, + Engine::Step::SpecialTrack, + Engine::Step::SpecialToken, + Engine::Step::BuyCompany, + Engine::Step::HomeToken, + GSystem18::Step::Track, + GSystem18::Step::Token, + Engine::Step::Route, + GSystem18::Step::Dividend, + Engine::Step::DiscardTrain, + GSystem18::Step::BuyTrain, + GSystem18::Step::IssueShares, + ] + end + # FIXME: add reopen! method to Engine::Company # # open company associated with closed corporation diff --git a/lib/engine/game/g_system18/step/dividend.rb b/lib/engine/game/g_system18/step/dividend.rb index e4ca8d9b1a..7461069418 100644 --- a/lib/engine/game/g_system18/step/dividend.rb +++ b/lib/engine/game/g_system18/step/dividend.rb @@ -12,7 +12,7 @@ class Dividend < Engine::Step::Dividend include Engine::Step::HalfPay def share_price_change(entity, revenue = 0) - return super unless @game.game_capitalization == :incremental + return super if @game.share_price_change_as_full_cap_by_map? price = entity.share_price.price LOGGER.debug { "price: #{price}, revenue: #{revenue}" } diff --git a/lib/engine/game/g_system18/step/issue_shares.rb b/lib/engine/game/g_system18/step/issue_shares.rb new file mode 100644 index 0000000000..4b026564d0 --- /dev/null +++ b/lib/engine/game/g_system18/step/issue_shares.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +require_relative '../../../step/issue_shares' + +module Engine + module Game + module GSystem18 + module Step + class IssueShares < Engine::Step::IssueShares + def process_sell_shares(action) + @game.sell_shares_and_change_price(action.bundle) + end + end + end + end + end +end From 56c7ec014521c1ba33c2053814d2a0bd3977c62c Mon Sep 17 00:00:00 2001 From: BlueChickenBoardGames Date: Thu, 12 Sep 2024 18:58:44 +0000 Subject: [PATCH 05/12] System18 Northern Italy small fixes --- lib/engine/game/g_system18/game.rb | 2 +- .../game/g_system18/map_northern_italy_customization.rb | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/engine/game/g_system18/game.rb b/lib/engine/game/g_system18/game.rb index 21073eab41..32e982ae26 100644 --- a/lib/engine/game/g_system18/game.rb +++ b/lib/engine/game/g_system18/game.rb @@ -375,7 +375,7 @@ def half_dividend_by_map? end def share_price_change_as_full_cap_by_map? - return game_capitalization == :incremental unless respond_to?("map_#{map_name}_share_price_change_as_full_cap") + return game_capitalization == :full unless respond_to?("map_#{map_name}_share_price_change_as_full_cap") send("map_#{map_name}_share_price_change_as_full_cap") end diff --git a/lib/engine/game/g_system18/map_northern_italy_customization.rb b/lib/engine/game/g_system18/map_northern_italy_customization.rb index 8a0adea580..4a3de24b4a 100644 --- a/lib/engine/game/g_system18/map_northern_italy_customization.rb +++ b/lib/engine/game/g_system18/map_northern_italy_customization.rb @@ -215,8 +215,8 @@ def map_northern_italy_half_dividend return false end - def map_northern_italy_hare_price_change_as_full_cap - return false + def map_northern_italy_share_price_change_as_full_cap + return true end def map_northern_italy_game_market @@ -226,11 +226,12 @@ def map_northern_italy_game_market def map_northern_italy_game_trains(trains) #rusting find_train(trains, '3')[:rusts_on] = '5' - find_train(trains, '5')[:rusts_on] = 'D' + find_train(trains, '4')[:rusts_on] = '8' + find_train(trains, '5')[:rusts_on] = 'D' #price find_train(trains, '5')[:price] = 450 #discount - find_train(trains, 'D')[:discount] = { '4' => 200, '5' => 200, '6' => 200, '8' => 200 } + find_train(trains, 'D')[:discount] = {'5' => 200, '6' => 200, '8' => 200 } # update quantities find_train(trains, '2')[:num] = 5 find_train(trains, '3')[:num] = 4 From 802fbd0fd0fc67ac8206c4f76ddb8016bf186f58 Mon Sep 17 00:00:00 2001 From: BlueChickenBoardGames Date: Mon, 16 Sep 2024 18:34:31 +0000 Subject: [PATCH 06/12] System18 Northern Italy: fixed docker issues and fixed spelling mistakes --- lib/engine/game/g_system18/game.rb | 4 +- .../map_northern_italy_customization.rb | 46 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/engine/game/g_system18/game.rb b/lib/engine/game/g_system18/game.rb index 32e982ae26..0925b9fe50 100644 --- a/lib/engine/game/g_system18/game.rb +++ b/lib/engine/game/g_system18/game.rb @@ -371,13 +371,13 @@ def game_phases def half_dividend_by_map? return game_capitalization == :incremental unless respond_to?("map_#{map_name}_half_dividend") - send("map_#{map_name}_half_dividend") + send("map_#{map_name}_half_dividend") end def share_price_change_as_full_cap_by_map? return game_capitalization == :full unless respond_to?("map_#{map_name}_share_price_change_as_full_cap") - send("map_#{map_name}_share_price_change_as_full_cap") + send("map_#{map_name}_share_price_change_as_full_cap") end def redef_const(const, value) diff --git a/lib/engine/game/g_system18/map_northern_italy_customization.rb b/lib/engine/game/g_system18/map_northern_italy_customization.rb index 4a3de24b4a..8b30e06460 100644 --- a/lib/engine/game/g_system18/map_northern_italy_customization.rb +++ b/lib/engine/game/g_system18/map_northern_italy_customization.rb @@ -31,21 +31,21 @@ def map_northern_italy_game_tiles(tiles) 'count' => 1, 'color' => 'gray', 'code' => 'city=revenue:70,slots:2;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ - 'path=a:5,b:_0;label=To', + 'path=a:5,b:_0;label=To', }, 'X2' => { 'count' => 1, 'color' => 'gray', 'code' => 'city=revenue:90,slots:2;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ - 'path=a:5,b:_0;label=Mi', + 'path=a:5,b:_0;label=Mi', }, 'X3' => { 'count' => 1, 'color' => 'gray', 'code' => 'city=revenue:60,slots:2;path=a:0,b:_0;path=a:2,b:_0;path=a:3,b:_0;path=a:4,b:_0;'\ - 'path=a:5,b:_0;label=OO', + 'path=a:5,b:_0;label=OO', }, '513' => { @@ -81,9 +81,9 @@ def map_northern_italy_game_location_names 'C6' => 'Milano', 'C8' => 'Brescia', 'C10' => 'Verona', - 'C12' => 'Padova & Venzéia', + 'C12' => 'Padova & Venezia', 'D5' => 'Genova', - 'D7' => '(Emilia-Romagra)', + 'D7' => '(Emilia-Romagna)', 'D9' => 'Parma & Modena', 'D11' => 'Bologna', 'E2' => 'France', @@ -92,7 +92,7 @@ def map_northern_italy_game_location_names 'E10' => 'Firenze', 'E12' => 'Ravenna & Rimini', 'F9' => 'Roma', - 'F11' => '(Tuscana)', + 'F11' => '(Toscana)', 'F13' => 'Ancona', } end @@ -212,11 +212,11 @@ def map_northern_italy_game_capitalization end def map_northern_italy_half_dividend - return false + false end def map_northern_italy_share_price_change_as_full_cap - return true + true end def map_northern_italy_game_market @@ -224,14 +224,14 @@ def map_northern_italy_game_market end def map_northern_italy_game_trains(trains) - #rusting + # rusting find_train(trains, '3')[:rusts_on] = '5' find_train(trains, '4')[:rusts_on] = '8' - find_train(trains, '5')[:rusts_on] = 'D' - #price + find_train(trains, '5')[:rusts_on] = 'D' + # price find_train(trains, '5')[:price] = 450 - #discount - find_train(trains, 'D')[:discount] = {'5' => 200, '6' => 200, '8' => 200 } + # discount + find_train(trains, 'D')[:discount] = { '5' => 200, '6' => 200, '8' => 200 } # update quantities find_train(trains, '2')[:num] = 5 find_train(trains, '3')[:num] = 4 @@ -248,15 +248,15 @@ def map_northern_italy_game_phases phases[0][:status] = ['local_tokens'] # 2 phases[1][:status] = ['local_tokens'] # 3 phases[2][:status] = ['local_tokens'] # 4 - + phases << { - name: 'D', - on: 'D', - train_limit: 2, - tiles: %i[yellow green brown gray], - operating_rounds: 2, - } - + name: 'D', + on: 'D', + train_limit: 2, + tiles: %i[yellow green brown gray], + operating_rounds: 2, + } + phases end @@ -277,11 +277,11 @@ def map_northern_italy_init_round def map_northern_italy_new_parliament_round @log << "-- Parliament Round #{@turn} -- " - GSystem18::Round::NorthernItalyParliament.new(self, [ + GSystem18::Round::NorthernItalyParliament.new(self, [ GSystem18::Step::NorthernItalyCharterAuction, ]) end - + def map_northern_italy_next_round! @round = case @round From e3f5b0619550f63150e771b675e2c1bf77160342 Mon Sep 17 00:00:00 2001 From: BlueChickenBoardGames Date: Fri, 11 Oct 2024 18:55:23 +0000 Subject: [PATCH 07/12] System18 NorthernItaly: use general Parliament round --- .../g_system18/map_northern_italy_customization.rb | 4 ++-- .../g_system18/round/northern_italy_parliament.rb | 14 -------------- 2 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 lib/engine/game/g_system18/round/northern_italy_parliament.rb diff --git a/lib/engine/game/g_system18/map_northern_italy_customization.rb b/lib/engine/game/g_system18/map_northern_italy_customization.rb index 8b30e06460..b4e932aecf 100644 --- a/lib/engine/game/g_system18/map_northern_italy_customization.rb +++ b/lib/engine/game/g_system18/map_northern_italy_customization.rb @@ -277,8 +277,8 @@ def map_northern_italy_init_round def map_northern_italy_new_parliament_round @log << "-- Parliament Round #{@turn} -- " - GSystem18::Round::NorthernItalyParliament.new(self, [ - GSystem18::Step::NorthernItalyCharterAuction, + GSystem18::Round::Parliament.new(self, [ + GSystem18::Step::CharterAuction, ]) end diff --git a/lib/engine/game/g_system18/round/northern_italy_parliament.rb b/lib/engine/game/g_system18/round/northern_italy_parliament.rb deleted file mode 100644 index 620a4acd38..0000000000 --- a/lib/engine/game/g_system18/round/northern_italy_parliament.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../../round/stock' - -module Engine - module Game - module GSystem18 - module Round - class NorthernItalyParliament < Engine::Round::Auction - end - end - end - end -end From 1fd8506a9071dd9fb3e4edd3bdad3d4011d1a755 Mon Sep 17 00:00:00 2001 From: BlueChickenBoardGames Date: Fri, 11 Oct 2024 19:07:55 +0000 Subject: [PATCH 08/12] System18 NorthernItaly: fix merge mistake --- lib/engine/game/g_system18/game.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/engine/game/g_system18/game.rb b/lib/engine/game/g_system18/game.rb index 4f30ec9a44..bdff2a789d 100644 --- a/lib/engine/game/g_system18/game.rb +++ b/lib/engine/game/g_system18/game.rb @@ -662,6 +662,7 @@ def issuable_shares(entity) bundles_for_corporation(entity, entity) .select { |bundle| @share_pool.fit_in_bank?(bundle) } + end def can_remove_icon?(entity) return false unless respond_to?("map_#{map_name}_can_remove_icon?") From e0c387cd37d72eec85fa18246c0bed10731b7e6f Mon Sep 17 00:00:00 2001 From: BlueChickenBoardGames Date: Fri, 11 Oct 2024 19:39:35 +0000 Subject: [PATCH 09/12] System18 NorthernItaly: docker rubocop fixes --- lib/engine/game/g_system18/game.rb | 1 - lib/engine/game/g_system18/meta.rb | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/engine/game/g_system18/game.rb b/lib/engine/game/g_system18/game.rb index bdff2a789d..c66da1adb3 100644 --- a/lib/engine/game/g_system18/game.rb +++ b/lib/engine/game/g_system18/game.rb @@ -15,7 +15,6 @@ require_relative 'map_britain_customization' require_relative 'map_northern_italy_customization' - module Engine module Game module GSystem18 diff --git a/lib/engine/game/g_system18/meta.rb b/lib/engine/game/g_system18/meta.rb index ad452705ec..094593bde1 100644 --- a/lib/engine/game/g_system18/meta.rb +++ b/lib/engine/game/g_system18/meta.rb @@ -71,7 +71,8 @@ module Meta ].freeze MUTEX_RULES = [ - %i[map_NEUS map_France map_Twisting_Tracks map_UK_Limited map_China_Rapid_Development map_Poland map_Britain map_Northern_Italy], + %i[map_NEUS map_France map_Twisting_Tracks map_UK_Limited map_China_Rapid_Development map_Poland map_Britain + map_Northern_Italy], ].freeze end end From 206b502dbcb8a40fabfd2b79b765a3374aff5431 Mon Sep 17 00:00:00 2001 From: BlueChickenBoardGames Date: Sun, 13 Oct 2024 15:19:55 +0000 Subject: [PATCH 10/12] System18 NorthernItaly: delete specific charter auction --- .../step/northern_italy_charter_auction.rb | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 lib/engine/game/g_system18/step/northern_italy_charter_auction.rb diff --git a/lib/engine/game/g_system18/step/northern_italy_charter_auction.rb b/lib/engine/game/g_system18/step/northern_italy_charter_auction.rb deleted file mode 100644 index 8b02f0f1ba..0000000000 --- a/lib/engine/game/g_system18/step/northern_italy_charter_auction.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../../step/base' -require_relative 'upwards_auction' - -module Engine - module Game - module GSystem18 - module Step - class NorthernItalyCharterAuction < GSystem18::Step::UpwardsAuction - end - end - end - end -end From db9edb1a6fe9dd7bd28b74d6415d70b01c4b7095 Mon Sep 17 00:00:00 2001 From: BlueChickenBoardGames Date: Wed, 6 Nov 2024 21:01:29 +0000 Subject: [PATCH 11/12] System18 Northern Italy: issuing shares during EMR drops the price once per share issued --- lib/engine/game/g_system18/step/buy_train.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/engine/game/g_system18/step/buy_train.rb b/lib/engine/game/g_system18/step/buy_train.rb index 44723313e5..f0420fb67d 100644 --- a/lib/engine/game/g_system18/step/buy_train.rb +++ b/lib/engine/game/g_system18/step/buy_train.rb @@ -28,7 +28,13 @@ def process_sell_shares(action) action.bundle) @emr_issue = true - @game.sell_shares_and_change_price(action.bundle, movement: :left_block) + + if @game.share_price_change_as_full_cap_by_map? + @game.sell_shares_and_change_price(action.bundle, movement: :down_share) + else + @game.sell_shares_and_change_price(action.bundle, movement: :left_block) + end + end def process_buy_train(action) From e68883483481020aa402388fcba71327d17d2593 Mon Sep 17 00:00:00 2001 From: BlueChickenBoardGames Date: Wed, 13 Nov 2024 21:42:10 +0000 Subject: [PATCH 12/12] System18 Northern Italy: Improved issuing shares during EMR drops the price once per share issued --- lib/engine/game/g_system18/game.rb | 12 +++++++++--- .../g_system18/map_northern_italy_customization.rb | 6 +++++- lib/engine/game/g_system18/step/buy_train.rb | 7 ++----- lib/engine/game/g_system18/step/dividend.rb | 2 +- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/engine/game/g_system18/game.rb b/lib/engine/game/g_system18/game.rb index df2aade1d7..4877a6d42d 100644 --- a/lib/engine/game/g_system18/game.rb +++ b/lib/engine/game/g_system18/game.rb @@ -382,10 +382,16 @@ def half_dividend_by_map? send("map_#{map_name}_half_dividend") end - def share_price_change_as_full_cap_by_map? - return game_capitalization == :full unless respond_to?("map_#{map_name}_share_price_change_as_full_cap") + def share_price_change_for_dividend_as_full_cap_by_map? + return game_capitalization == :full unless respond_to?("map_#{map_name}_share_price_change_for_dividend_as_full_cap") - send("map_#{map_name}_share_price_change_as_full_cap") + send("map_#{map_name}_share_price_change_for_dividend_as_full_cap") + end + + def movement_type_at_emr_share_issue_by_map + return :left_block unless respond_to?("map_#{map_name}_movement_type_at_emr_share_issue") + + send("map_#{map_name}_movement_type_at_emr_share_issue") end def redef_const(const, value) diff --git a/lib/engine/game/g_system18/map_northern_italy_customization.rb b/lib/engine/game/g_system18/map_northern_italy_customization.rb index b4e932aecf..46d583e00d 100644 --- a/lib/engine/game/g_system18/map_northern_italy_customization.rb +++ b/lib/engine/game/g_system18/map_northern_italy_customization.rb @@ -215,10 +215,14 @@ def map_northern_italy_half_dividend false end - def map_northern_italy_share_price_change_as_full_cap + def map_northern_italy_share_price_for_dividend_change_as_full_cap true end + def map_northern_italy_movement_type_at_emr_share_issue + :down_share + end + def map_northern_italy_game_market self.class::MARKET_2D end diff --git a/lib/engine/game/g_system18/step/buy_train.rb b/lib/engine/game/g_system18/step/buy_train.rb index f0420fb67d..ed84749513 100644 --- a/lib/engine/game/g_system18/step/buy_train.rb +++ b/lib/engine/game/g_system18/step/buy_train.rb @@ -29,12 +29,9 @@ def process_sell_shares(action) @emr_issue = true - if @game.share_price_change_as_full_cap_by_map? - @game.sell_shares_and_change_price(action.bundle, movement: :down_share) - else - @game.sell_shares_and_change_price(action.bundle, movement: :left_block) - end + movement_type = @game.movement_type_at_emr_share_issue_by_map + @game.sell_shares_and_change_price(action.bundle, movement: movement_type) end def process_buy_train(action) diff --git a/lib/engine/game/g_system18/step/dividend.rb b/lib/engine/game/g_system18/step/dividend.rb index 7461069418..9f66af4cb2 100644 --- a/lib/engine/game/g_system18/step/dividend.rb +++ b/lib/engine/game/g_system18/step/dividend.rb @@ -12,7 +12,7 @@ class Dividend < Engine::Step::Dividend include Engine::Step::HalfPay def share_price_change(entity, revenue = 0) - return super if @game.share_price_change_as_full_cap_by_map? + return super if @game.share_price_change_for_dividend_as_full_cap_by_map? price = entity.share_price.price LOGGER.debug { "price: #{price}, revenue: #{revenue}" }