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
3 changes: 2 additions & 1 deletion assets/app/view/welcome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def render

def render_notification
message = <<~MESSAGE
<p><a href="https://github.com/tobymao/18xx/wiki/1880-Romania">1880 Romania</a> is now in alpha.</p>
<p><a href="https://github.com/tobymao/18xx/wiki/1880-Romania">1880 Romania</a> is now in alpha.
Including 2-player Transilvania variant.</p>

<p><a href="https://github.com/tobymao/18xx/wiki/1824">1824</a> is now in beta.</p>

Expand Down
9 changes: 9 additions & 0 deletions lib/engine/game/g_1880_romania/meta.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ module Meta
GAME_TITLE = '1880 Romania'

PLAYER_RANGE = [3, 6].freeze

GAME_VARIANTS = [
{
sym: :transilvania,
name: 'Transilvania',
title: '1880 Romania Transilvania',
desc: 'Alternate map for 2 players, shorter game',
},
].freeze
end
end
end
Expand Down
8 changes: 8 additions & 0 deletions lib/engine/game/g_1880_romania_transilvania.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

module Engine
module Game
module G1880RomaniaTransilvania
end
end
end
113 changes: 113 additions & 0 deletions lib/engine/game/g_1880_romania_transilvania/game.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# frozen_string_literal: true

require_relative 'meta'
require_relative '../g_1880_romania/game'
require_relative 'map'
require_relative '../g_1880_romania/entities'

module Engine
module Game
module G1880RomaniaTransilvania
class Game < G1880Romania::Game
include_meta(G1880RomaniaTransilvania::Meta)
include Map

CERT_LIMIT = { 2 => 11 }.freeze

STARTING_CASH = { 2 => 350 }.freeze

def game_companies
companies = COMPANIES.map(&:dup)
kept_companies = %w[P1 P3 P5 P8]
companies.select { |c| kept_companies.include?(c[:sym]) }
end

def game_minors
minors = MINORS.map(&:dup)

kept_minors = %w[1 4 5]
coordinates = {
'1' => 'D2',
'4' => 'B8',
'5' => 'J4',
}.freeze
minors
.select { |m| kept_minors.include?(m[:sym]) }
.each { |m| m[:coordinates] = coordinates[m[:sym]] }
end

def game_corporations
corporations = CORPORATIONS.map(&:dup)
kept_corporations = %w[BR CR SZ TR]
coordinates = {
'BR' => 'D6',
'CR' => 'E3',
'SZ' => 'G1',
'TR' => 'L6',
}.freeze
corporations
.select { |c| kept_corporations.include?(c[:sym]) }
.each { |m| m[:coordinates] = coordinates[m[:sym]] }
end

def game_trains
unless @train_games
@train_games = super.map(&:dup)
t_2, t_2p2, t_3, t_3p3, t_4, t_4p4, t_6, t_6e, t_8, t_8e, t_2r = @train_games
t_2[:num] = 6
t_2p2[:num] = 3
t_2p2[:events] = []
t_3[:num] = 3
t_3p3[:num] = 2
t_3p3[:events] = [{ 'type' => 'communist_takeover' }]
t_4[:num] = 2
t_4p4[:num] = 2
t_6[:num] = 2
t_6e[:num] = 1
t_6e[:events] = [{ 'type' => 'signal_end_game', 'when' => 1 }]
t_8[:num] = 1
t_8e[:num] = 'unlimited'
t_2r[:num] = 6
end
@train_games
end

def par_chart
@par_chart ||=
share_prices.sort_by { |sp| -sp.price }.to_h { |sp| [sp, [nil, nil]] }
end

def setup
super

@dummy ||= Company.new(
name: 'Dummy Company',
sym: 'DUMMY',
value: 0,
)
@dummy.close!
end

# P2 not used in this variant
def consortiu
@dummy
end

# P4 not used in this variant
def danube_port
@dummy
end

# P6 not used in this variant
def malaxa
@dummy
end

# P7 not used in this variant
def rocket
@dummy
end
end
end
end
end
91 changes: 91 additions & 0 deletions lib/engine/game/g_1880_romania_transilvania/map.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# frozen_string_literal: true

require_relative '../g_1880_romania/map'

module Engine
module Game
module G1880RomaniaTransilvania
module Map
include G1880Romania::Map

LAYOUT = :pointy
AXES = { x: :letter, y: :number }.freeze

LOCATION_NAMES = {
'G1' => 'Satu Mare',
'K1' => 'Sighetu Marmației',
'Q1' => 'Czernowitz',
'D2' => 'Viena / Budapešta',
'J2' => 'Baia-Mare',
'P2' => 'Rădăuți',
'E3' => 'Oradea',
'G3' => 'Margita / Simleu',
'I3' => 'Zalău',
'K3' => 'Dej',
'K7' => 'Istanbul',
'M3' => 'Bistrița',
'J4' => 'Cluj-Napoca',
'L4' => 'Târgu Mureș',
'D19' => 'Bacău',
'A5' => 'Sinnicolau Mare',
'C5' => 'Arad',
'K5' => 'Turda',
'M5' => 'Mediaș',
'D6' => 'Timișoara',
'H6' => 'Deva / Hunedoara',
'J6' => 'Alba Iulia',
'L6' => 'Sibiu',
'N6' => 'Făgăraș',
'P6' => 'Brașov',
'E7' => 'Reșița',
'B8' => 'Belgrad',
'D8' => 'Oravița / Moldova Veche',
}.freeze

HEXES = {
white: {
# no cities or towns
%w[I1 F2 H2 D4 F4 E5 B6 F6 C7 F8] => '',
%w[L2 N2 O3 G5 I5 G7] => 'upgrade=cost:40,terrain:mountain',
%w[H4 N4 I7] => 'upgrade=cost:30,terrain:mountain',
['O5'] => 'upgrade=cost:20,terrain:mountain',

# town
['K1'] => 'town=revenue:0;upgrade=cost:40,terrain:mountain',
%w[M3 N6] => 'town=revenue:0;upgrade=cost:30,terrain:mountain',
%w[K3 K5 M5] => 'town=revenue:0;upgrade=cost:10,terrain:mountain',

# double towns
['G3'] => 'town=revenue:0;town=revenue:0',
['D8'] => 'town=revenue:0;town=revenue:0;icon=image:port',
['H6'] => 'town=revenue:0;town=revenue:0;upgrade=cost:20,terrain:mountain',

# city
%w[E3 J4 L4 C5 D6] => 'city=revenue:0',
['G1'] => 'city=revenue:0;label=T',
['L6'] => 'city=revenue:0;upgrade=cost:20,terrain:mountain',

# town and city
%w[J2 I3] => 'town=revenue:0;city=revenue:0',
['J6'] => 'town=revenue:0;city=revenue:0;upgrade=cost:20,terrain:mountain',
['E7'] => 'town=revenue:0;city=revenue:0;upgrade=cost:40,terrain:mountain',
},
gray: {
['P2'] => 'town=revenue:20;path=a:0,b:_0;path=a:1,b:_0;path=a:3,b:_0',
['A5'] => 'town=revenue:20;path=a:4,b:_0;path=a:5,b:_0',
['P6'] => 'city=revenue:yellow_20|green_30|brown_40|gray_50;path=a:1,b:_0;path=a:2,b:_0',
},
red: {
['D2'] => 'city=revenue:yellow_20|green_30|brown_50|gray_70;path=a:4,b:_0,terminal:1;path=a:5,b:_0,terminal:1',
['B8'] => 'city=revenue:yellow_20|green_30|brown_40|gray_60;path=a:3,b:_0,terminal:1;path=a:4,b:_0,terminal:1',
['Q1'] => 'city=revenue:yellow_30|green_40|brown_50|gray_60;path=a:0,b:_0,terminal:1',
['K7'] => 'offboard=revenue:yellow_10|green_20|brown_40|gray_50,hide:1,groups:Istanbul;'\
'path=a:3,b:_0,terminal:1;border=edge:4',
['M7'] => 'offboard=revenue:yellow_10|green_30|brown_40|gray_50,groups:Istanbul;path=a:2,b:_0,terminal:1;'\
'border=edge:1',
},
}.freeze
end
end
end
end
26 changes: 26 additions & 0 deletions lib/engine/game/g_1880_romania_transilvania/meta.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

require_relative '../meta'
require_relative '../g_1880_romania/meta'

module Engine
module Game
module G1880RomaniaTransilvania
module Meta
include Game::Meta
include G1880Romania::Meta

DEPENDS_ON = '1880 Romania'

DEV_STAGE = :alpha

GAME_IS_VARIANT_OF = G1880Romania::Meta
GAME_INFO_URL = 'https://github.com/tobymao/18xx/wiki/1880-Romania-Transilvania-map'.freeze
GAME_TITLE = '1880 Romania Transilvania'.freeze

PLAYER_RANGE = [2, 2].freeze
OPTIONAL_RULES = [].freeze
end
end
end
end

Large diffs are not rendered by default.

Loading
Loading