diff options
| author | historia <[not public]> | 2026-09-18 15:16:44 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 15:16:44 -0400 |
| commit | 7eab582d8a8ee2af1a6baae7baf0696c7005de2e (patch) | |
| tree | 902bbc8c6e39c9f62f779ca23267714ec420b9f5 /internal/casino/credits.go | |
| parent | 153acb7f644d755c45533b7c5311e3ffa47e8973 (diff) | |
| download | thehouseoficarus-7eab582d8a8ee2af1a6baae7baf0696c7005de2e.tar.gz | |
fix: harden triggers, economy, casino, world data, and admin/net paths
Diffstat (limited to 'internal/casino/credits.go')
| -rw-r--r-- | internal/casino/credits.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/casino/credits.go b/internal/casino/credits.go index 8b7cb7a..631a4bc 100644 --- a/internal/casino/credits.go +++ b/internal/casino/credits.go @@ -47,6 +47,12 @@ func MulPayout(amount int, multiplier float64) (int, error) { return MaxCredits, fmt.Errorf("payout overflow: %d * %v exceeds %d", amount, multiplier, MaxCredits) } payout := int(math.Floor(float64(amount) * multiplier)) + if payout == 0 && multiplier > 0 { + // A positive stake on a winning outcome must never pay nothing: a + // fractional multiplier (e.g. a 5% baccarat commission) at a 1-credit + // bet floors to zero, turning a win into a total loss. + payout = 1 + } if payout > MaxCredits { return MaxCredits, fmt.Errorf("payout overflow: %d * %v exceeds %d", amount, multiplier, MaxCredits) } |
