diff options
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) } |
