-
Notifications
You must be signed in to change notification settings - Fork 231
[1880 Romania] Add 1880 Romania Transilvania variant #12738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
perwestling
wants to merge
4
commits into
tobymao:master
Choose a base branch
from
perwestling:feature/1880_romania_transilvania
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a2e69fe
Add 1880 Romania Transilvania variant
perwestling a6bfb02
Remove open_borders event from 2+2 trains - not used in this variant
perwestling 37f3944
Add unit tests for 1880 Romania Transilvania variant
perwestling ffcfd62
Fix RuboCop style violation: Use single quotes for string literal
perwestling File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| # 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_2r2, 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_2r2[:num] = 3 | ||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
1 change: 1 addition & 0 deletions
1
public/fixtures/1880RomaniaTransilvania/1880_romania_transilvania_game_end_final_phase.json
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.