Skip to content

Commit

Permalink
Merge pull request #10153 from michaeljb/1822CA-bugs
Browse files Browse the repository at this point in the history
[1822CA] fix a few small bugs
  • Loading branch information
michaeljb authored Jan 20, 2024
2 parents 1a2043a + 51c47b2 commit 2416279
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/engine/game/g_1822/step/minor_acquisition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,15 @@ def process_choose(action)
after_acquire_bank_minor(action.entity)
else
acquire_entity_minor(action.entity, action.choice)
after_acquire_entity_minor(action.entity)
after_acquire_entity_minor(action.entity, action.choice)
end
@acquire_state = :select_minor
pass!
end
end

def after_acquire_bank_minor(entity); end
def after_acquire_entity_minor(entity); end
def after_acquire_entity_minor(entity, token_choice); end

def entity_connects?(entity, minor)
if (!minor.owner || minor.owner == @bank) && minor.id == @game.class::MINOR_14_ID
Expand Down
9 changes: 8 additions & 1 deletion lib/engine/game/g_1822_ca/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class Game < G1822::Game
'P7' => { acquire: %i[major], phase: 3 },
'P8' => { acquire: %i[major minor], phase: 2 },
'P9' => { acquire: %i[major minor], phase: 2 },
'P10' => { acquire: %i[major minor], phase: 3 },
'P10' => { acquire: %i[major], phase: 3 },
'P11' => { acquire: [], phase: 8 },
'P12' => { acquire: %i[major minor], phase: 1 },
'P13' => { acquire: %i[major], phase: 3 },
Expand Down Expand Up @@ -350,6 +350,13 @@ def operating_round(round_num)
], round_num: round_num)
end

def stock_round
G1822CA::Round::Stock.new(self, [
Engine::Step::DiscardTrain,
G1822::Step::BuySellParShares,
])
end

def must_remove_town?(entity)
%w[P29 P30].include?(entity.id)
end
Expand Down
17 changes: 17 additions & 0 deletions lib/engine/game/g_1822_ca/round/stock.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

require_relative '../../g_1822/round/stock'

module Engine
module Game
module G1822CA
module Round
class Stock < Engine::Game::G1822::Round::Stock
def sold_out_stock_movement(corp)
@game.stock_market.move_right(corp)
end
end
end
end
end
end
6 changes: 5 additions & 1 deletion lib/engine/game/g_1822_ca/step/minor_acquisition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ def after_acquire_bank_minor(entity)
@round.acquiring_major = entity
end

def after_acquire_entity_minor(entity)
def after_acquire_entity_minor(entity, token_choice)
@round.acquiring_major = entity

# reset graph for the AcquisitionTrack step; when token is replaced
# the graph is already reset by the base 1822 step
@game.graph.clear_graph_for(entity) if token_choice == 'exchange'
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/engine/game/g_1822_ca/step/special_track.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require_relative '../../g_1822/step/special_track'
require_relative 'acquisition_track'
require_relative 'tracker'

module Engine
Expand All @@ -25,6 +26,7 @@ def available_hex(entity_or_entities, hex)
end

def actions(entity)
return [] if @round.active_step.is_a?(G1822CA::Step::AcquisitionTrack)
return [] unless entity.company?

super
Expand Down

0 comments on commit 2416279

Please sign in to comment.