Skip to content

Commit

Permalink
18NY - fix salvage rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminxscott committed Apr 24, 2023
1 parent 4523b91 commit bc2f862
Show file tree
Hide file tree
Showing 6 changed files with 13,606 additions and 4 deletions.
2 changes: 2 additions & 0 deletions assets/app/view/game/discard_trains.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def render
}
step = @game.active_step
overflow = step.crowded_corps.map do |corporation|
salvagable = step.trains(corporation)&.any?(&:salvage)
@verb = salvagable ? 'Salvage' : 'Discard'
trains = step.trains(corporation).map do |train|
train_props = {
style: {
Expand Down
10 changes: 6 additions & 4 deletions lib/engine/game/g_18_ny_1e/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ class Game < G18NY::Game
].freeze

TRAINS = [
{ name: '2H', num: 11, distance: 2, price: 100, rusts_on: '6H' },
{ name: '4H', num: 6, distance: 4, price: 200, rusts_on: '5DE', events: [{ 'type' => 'float_30' }] },
{ name: '6H', num: 4, distance: 6, price: 300, rusts_on: 'D', events: [{ 'type' => 'float_40' }] },
{ name: '2H', num: 11, distance: 2, price: 100, rusts_on: '6H', salvage: 25 },
{ name: '4H', num: 6, distance: 4, price: 200, rusts_on: '5DE', salvage: 50, events: [{ 'type' => 'float_30' }] },
{ name: '6H', num: 4, distance: 6, price: 300, rusts_on: 'D', salvage: 75, events: [{ 'type' => 'float_40' }] },
{
name: '12H',
num: 3,
distance: 12,
price: 600,
salvage: 150,
events: [{ 'type' => 'float_50' }, { 'type' => 'close_companies' }, { 'type' => 'nyc_formation' },
{ 'type' => 'capitalization_round', 'when' => 3 }],
},
Expand All @@ -76,9 +77,10 @@ class Game < G18NY::Game
num: 2,
distance: [{ 'nodes' => %w[city offboard town], 'pay' => 5, 'visit' => 99, 'multiplier' => 2 }],
price: 800,
salvage: 200,
events: [{ 'type' => 'float_60' }],
},
{ name: 'D', num: 20, distance: 99, price: 1000 },
{ name: 'D', num: 20, distance: 99, price: 1000, salvage: 250 },
].freeze

def second_edition?
Expand Down
9 changes: 9 additions & 0 deletions spec/assets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@
[nil,
'endgame',
['1860: Phase 9 - Operating Round 8.4 (Nationalization) - Game Over - Nationalization complete']]]],
['18NY',
118_662,
[[524,
'discard_train',
['!!<div>Salvage Trains']],
120_048,
[277,
'scrap_train',
['!!<div>Trains to Scrap']]]],
].freeze

AUTO_ACTIONS_TEST_CASES = [
Expand Down
Loading

0 comments on commit bc2f862

Please sign in to comment.