Skip to content
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

[1849] modification to code for variants #11417

Merged
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
10 changes: 5 additions & 5 deletions lib/engine/game/g_1849/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -517,15 +517,15 @@ def operating_round(round_num)
G1849::Step::Token,
Engine::Step::Route,
G1849::Step::Dividend,
acquiring_station_tokens? ? G1849::Step::BuyToken : nil,
electric_dreams? ? G1849::Step::BuyEToken : nil,
G1849::Step::BuyToken,
G1849::Step::BuyEToken,
Engine::Step::DiscardTrain,
G1849::Step::BuyTrain,
G1849::Step::IssueShares,
bonds? ? G1849::Step::BondInterestPayment : nil,
bonds? ? G1849::Step::Bond : nil,
G1849::Step::BondInterestPayment,
G1849::Step::Bond,
[Engine::Step::BuyCompany, { blocks: true }],
].compact, round_num: round_num)
], round_num: round_num)
end

def next_round!
Expand Down
8 changes: 6 additions & 2 deletions lib/engine/game/g_1849/step/bond.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module G1849
module Step
class Bond < Engine::Step::Base
def actions(entity)
return [] if !entity.corporation? || entity != current_entity
return [] if !@game.bonds? || !entity.corporation? || entity != current_entity

actions = []
actions << 'payoff_loan' if can_payoff_loan?(entity)
Expand All @@ -30,7 +30,11 @@ def description
end

def log_skip(entity)
super if @game.bonds? && @game.issue_bonds_enabled
super if @game.bonds?
end

def log_pass(entity)
super if @game.bonds?
end

def take_loan_text
Expand Down
12 changes: 12 additions & 0 deletions lib/engine/game/g_1849/step/bond_interest_payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ def actions(_entity)
[]
end

def log_skip(entity)
super if @game.bonds?
end

def log_pass(entity)
super if @game.bonds?
end

def blocks?
false
end

def skip!
pass!
entity = current_entity
Expand Down
8 changes: 6 additions & 2 deletions lib/engine/game/g_1849/step/buy_e_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module G1849
module Step
class BuyEToken < Engine::Step::Base
def actions(entity)
return [] if !entity.corporation? || entity != current_entity
return [] if !@game.electric_dreams? || !entity.corporation? || entity != current_entity

actions = []
actions += %w[choose pass] if can_buy_e_token?(entity)
Expand All @@ -34,7 +34,11 @@ def choice_name
end

def log_skip(entity)
super if @game.electric_dreams? && @game.e_tokens_enabled
super if @game.electric_dreams?
end

def log_pass(entity)
super if @game.electric_dreams?
end

def e_token_cost
Expand Down
10 changes: 9 additions & 1 deletion lib/engine/game/g_1849/step/buy_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class BuyToken < Engine::Step::Base
MIN_PRICE = 1

def actions(entity)
return [] if entity != current_entity
return [] if [email protected]_station_tokens? || !entity.corporation? || entity != current_entity

ACTIONS
end
Expand Down Expand Up @@ -50,6 +50,14 @@ def any_buyable_tokens_placed?(entity)
false
end

def log_skip(entity)
super if @game.acquiring_station_tokens?
end

def log_pass(entity)
super if @game.acquiring_station_tokens?
end

def auto_actions(entity)
return [Engine::Action::Pass.new(entity)] unless any_buyable_tokens_placed?(entity)

Expand Down
Loading