aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/credits.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 15:16:44 -0400
committerhistoria <[not public]>2026-09-18 15:16:44 -0400
commit7eab582d8a8ee2af1a6baae7baf0696c7005de2e (patch)
tree902bbc8c6e39c9f62f779ca23267714ec420b9f5 /internal/casino/credits.go
parent153acb7f644d755c45533b7c5311e3ffa47e8973 (diff)
downloadthehouseoficarus-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.go6
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)
}