diff options
| author | historia <[not public]> | 2026-10-06 12:57:23 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-10-06 12:57:23 -0400 |
| commit | 9666676766bf21364f4fc4d0d1d336e72f2a91b4 (patch) | |
| tree | 0cade34091d7602790dc38cd44053f0b74bbadf2 /internal/casino/baccarat.go | |
| parent | 4bc1daaf259e0c19c5fe4a12ec8bc7f6e5a735c1 (diff) | |
| download | thehouseoficarus-9666676766bf21364f4fc4d0d1d336e72f2a91b4.tar.gz | |
refactor: split casino.go, dedup helpers, remove audit docs
Diffstat (limited to 'internal/casino/baccarat.go')
| -rw-r--r-- | internal/casino/baccarat.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/casino/baccarat.go b/internal/casino/baccarat.go index d385834..94d960a 100644 --- a/internal/casino/baccarat.go +++ b/internal/casino/baccarat.go @@ -264,6 +264,11 @@ func (t *baccaratTable) rebetAll(name string, wallet Wallet) []Event { if !p.hasLastBet() { return []Event{t.private(name, "Bet on what? Try bet N on "+t.Rules.betChoices()+".")} } + // Require the main wager before committing remembered side bets: a + // side-only memory would otherwise charge the sides and never deal. + if p.mainSpot == "" || p.lastBets[p.mainSpot] <= 0 { + return []Event{t.private(name, "Your last bet had no main wager. Use bet N on " + t.Rules.betChoices() + ".")} + } var events []Event for _, spot := range t.Rules.spots() { if baccaratIsMainSpot(spot) { @@ -374,7 +379,7 @@ func (t *baccaratTable) unbetAllLocked(name string) []Event { return []Event{t.private(name, "Nothing to take back.")} } if p.Wallet != nil { - if err := p.Wallet.PayCredits(total, ids...); err != nil { + if err := p.Wallet.RefundStakes(ids...); err != nil { return []Event{t.private(name, payoutFailedMessage())} } } @@ -399,7 +404,7 @@ func (t *baccaratTable) refundSidesLocked(p *baccaratPlayer) []Event { return nil } if p.Wallet != nil { - if err := p.Wallet.PayCredits(total, ids...); err != nil { + if err := p.Wallet.RefundStakes(ids...); err != nil { return []Event{t.private(p.Name, "Your side bets could not be returned just now; the stake stays pending and will be refunded after the next server restart.")} } } @@ -476,7 +481,7 @@ func (t *baccaratTable) deal() []Event { settlement := t.playerAction(p.Name, publicResult, privateResult) // Returning players get their balance in the next bet menu; only // departures/sit-outs need it attached to the settlement. - settlement.ShowBalance = !payoutFailed && (p.LeaveAfter || p.SitOutAfter || !p.Connected) + settlement.ShowBalance = p.SettlementBalanceNeeded(payoutFailed) if !payoutFailed { settlement.Settlement = lines switch { |
