diff options
Diffstat (limited to 'internal/casino/craps_clock.go')
| -rw-r--r-- | internal/casino/craps_clock.go | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/internal/casino/craps_clock.go b/internal/casino/craps_clock.go index bbba19e..ab28329 100644 --- a/internal/casino/craps_clock.go +++ b/internal/casino/craps_clock.go @@ -13,6 +13,10 @@ const ( // Simplified craps has no manual roll: one shared automatic countdown // starts with the first live bet and resolves every wager. crapsSimplifiedDelay = 3 * time.Second + + // A requested manual roll first shows the shake, then the outcome chart, + // then resolves the dice five ticks (three seconds) later. + crapsManualRollDelay = 3 * time.Second ) func crapsSeconds(d time.Duration) int { @@ -118,7 +122,24 @@ func (t *crapsTable) tickElapsed(elapsed time.Duration) []Event { } return events } - if elapsed <= 0 || !t.hasLiveBets() { + if elapsed <= 0 { + return events + } + if t.pendingRoll > 0 { + // A manual roll is in the air: no other deadline may fire first. Only + // the shake is announced now; the result follows when the dice land. + if !t.hasLiveBets() { + t.pendingRoll = 0 + return events + } + t.pendingRoll -= elapsed + if t.pendingRoll <= 0 { + t.pendingRoll = 0 + return append(events, t.roll()...) + } + return events + } + if !t.hasLiveBets() { return events } t.roundElapsed += elapsed |
