From e4ac3692ec24f05685afdae7e6f87645299ae0f2 Mon Sep 17 00:00:00 2001 From: Phil Campeau Date: Fri, 22 Nov 2024 17:08:03 -0500 Subject: [PATCH 1/2] [1849] fix for the Bonds variant --- lib/engine/game/g_1849/step/bond.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/engine/game/g_1849/step/bond.rb b/lib/engine/game/g_1849/step/bond.rb index dbee45a1a6..bc78f8dcb4 100644 --- a/lib/engine/game/g_1849/step/bond.rb +++ b/lib/engine/game/g_1849/step/bond.rb @@ -7,8 +7,6 @@ module Game module G1849 module Step class Bond < Engine::Step::Base - attr_reader :issued_bond, :redeemed_bond - def actions(entity) return [] if !entity.corporation? || entity != current_entity @@ -21,8 +19,10 @@ def actions(entity) end def round_state - @issued_bond = {} - @redeemed_bond = {} + { + issued_bond: nil, + redeemed_bond: nil, + } end def description @@ -47,7 +47,7 @@ def take_loan(entity, loan) @log << "#{entity.name} issues its bond and receives #{@game.format_currency(@game.loan_value)}" @game.bank.spend(@game.loan_value, entity) entity.loans << loan - @issued_bond[entity] = true + @round.issued_bond = true initial_sp = entity.share_price.price @game.stock_market.move_left(entity) @@ -59,12 +59,12 @@ def can_take_loan?(entity) @game.bonds? && @game.issue_bonds_enabled && entity.corporation? && - !@redeemed_bond[entity] && + !@round.redeemed_bond && entity.loans.size < @game.maximum_loans(entity) end def can_payoff_loan?(entity) - !@issued_bond[entity] && + !@round.issued_bond && !entity.loans.empty? && entity.cash >= entity.loans.first.amount end @@ -86,7 +86,7 @@ def process_payoff_loan(action) entity.loans.delete(loan) - @redeemed_bond[entity] = true + @round.redeemed_bond = true initial_sp = entity.share_price.price @game.stock_market.move_right(entity) From 4d8e4d22dfb0309cfd7a7070c58ac0fc655b2ae0 Mon Sep 17 00:00:00 2001 From: Phil Campeau Date: Sun, 24 Nov 2024 15:15:58 -0500 Subject: [PATCH 2/2] change nil to false --- lib/engine/game/g_1849/step/bond.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/engine/game/g_1849/step/bond.rb b/lib/engine/game/g_1849/step/bond.rb index bc78f8dcb4..4121e3a580 100644 --- a/lib/engine/game/g_1849/step/bond.rb +++ b/lib/engine/game/g_1849/step/bond.rb @@ -20,8 +20,8 @@ def actions(entity) def round_state { - issued_bond: nil, - redeemed_bond: nil, + issued_bond: false, + redeemed_bond: false, } end