aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/machine.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-15 13:56:10 -0400
committerhistoria <[not public]>2026-09-15 13:56:48 -0400
commitb3568f03e4103dd46db2ccc680fbab0a6454d604 (patch)
treedb3f6bb4f3d7c1deefbcd50de0f5022756d6b9ae /internal/casino/machine.go
parentf4ea40c4b3589104dfaced3481ba19c5735889ae (diff)
downloadthehouseoficarus-b3568f03e4103dd46db2ccc680fbab0a6454d604.tar.gz
fix: telnet buffer reuse, bank stack handling,
transport casino gate, and admin cache invalidation
Diffstat (limited to 'internal/casino/machine.go')
-rw-r--r--internal/casino/machine.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/internal/casino/machine.go b/internal/casino/machine.go
index 2f8b753..15c612d 100644
--- a/internal/casino/machine.go
+++ b/internal/casino/machine.go
@@ -26,6 +26,7 @@ type Machine struct {
reel int
clock int
freeSpins int
+ inFreeSpins bool
spinBet int
payoutRemainder float64
profile SlotProfile
@@ -237,8 +238,13 @@ func (m *Machine) finishSpin() []Event {
winEvents[0].Color = "casino_win"
events = append(events, winEvents...)
}
- if m.spin.ScatterCount >= 3 && m.freeSpins == 0 {
+ // A paid feature in progress never retriggers: scatters landing during a
+ // free spin are ignored, matching the CalculateRTP model (the feature is
+ // a fixed number of automatic spins). Retriggering only on a paid spin
+ // keeps the machine's actual return aligned with that model.
+ if m.spin.ScatterCount >= 3 && m.freeSpins == 0 && !m.inFreeSpins {
m.freeSpins = m.profile.FreeSpinCount
+ m.inFreeSpins = true
events = append(events, m.public(fmt.Sprintf("Three scatter symbols trigger %d free spins!", m.profile.FreeSpinCount))...)
}
if m.freeSpins > 0 {
@@ -247,8 +253,11 @@ func (m *Machine) finishSpin() []Event {
m.spin = generateSlotSpinWithProfile(m.rng, m.spinBet, m.profile)
m.reel, m.clock, m.suspense = 0, 0, false
events = append(events, m.public(fmt.Sprintf("%d free spins remain.", m.freeSpins))...)
- } else if !m.autoBet {
- events = append(events, m.menuEvents("")...)
+ } else {
+ m.inFreeSpins = false
+ if !m.autoBet {
+ events = append(events, m.menuEvents("")...)
+ }
}
return events
}
@@ -277,6 +286,7 @@ func (m *Machine) resetSeat() {
m.phase = machineReady
m.reel, m.clock, m.suspense = 0, 0, false
m.freeSpins = 0
+ m.inFreeSpins = false
m.payoutRemainder = 0
m.autoBet, m.autoCountdown = false, 0
}