diff options
Diffstat (limited to 'internal/casino/craps.go')
| -rw-r--r-- | internal/casino/craps.go | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/internal/casino/craps.go b/internal/casino/craps.go index 410a372..e9b87ec 100644 --- a/internal/casino/craps.go +++ b/internal/casino/craps.go @@ -37,6 +37,7 @@ type crapsTable struct { roundElapsed time.Duration multiplayer bool lastCall bool + countdown int // simplified craps: automatic-roll countdown lines emitted } type CrapsBetView struct { Name, Target string @@ -73,9 +74,14 @@ func crapsTarget(b *crapsBet) string { } func (t *crapsTable) view() *CrapsSnapshot { s := &CrapsSnapshot{Variant: t.Config.Craps.variant(), Phase: string(t.phase), Point: t.point, Dice: t.dice, Queue: append([]string(nil), t.queue...), Field12: t.Config.Craps.Field12} - if t.hasLiveBets() && t.multiplayer { - s.ShootIn = crapsSeconds(crapsBetDelay - t.roundElapsed) - s.DealerIn = crapsSeconds(crapsBetDelay + crapsDealerDelay - t.roundElapsed) + if t.hasLiveBets() { + if t.Config.Craps.variant() == "simplified" { + // One automatic roll: the snapshot counts down the shared window. + s.ShootIn = crapsSeconds(crapsSimplifiedDelay - t.roundElapsed) + } else if t.multiplayer { + s.ShootIn = crapsSeconds(crapsBetDelay - t.roundElapsed) + s.DealerIn = crapsSeconds(crapsBetDelay + crapsDealerDelay - t.roundElapsed) + } } if p := t.shooter(); p != nil && p.autoRoll { s.AutoRoll = true @@ -116,6 +122,7 @@ func (t *crapsTable) join(name string) []Event { return append([]Event{e, t.menu(name)}, timing...) } func (t *crapsTable) remove(name string) { + t.countdown = 0 t.removeSeatLocked(name) for i, n := range t.queue { if n == name { @@ -126,6 +133,7 @@ func (t *crapsTable) remove(name string) { if t.players.count() == 0 { t.point = 0 t.rolled = false + t.countdown = 0 t.made = map[int]bool{} t.seen = map[int]bool{} t.phase = phaseWaiting @@ -186,6 +194,10 @@ func (t *crapsTable) bet(name, spot string, amount int, w Wallet) []Event { if spot == "" { spot = p.lastSpot } + if spot == "" && t.Config.Craps.variant() == "simplified" { + // Pass is the only target, so "bet <amount>" needs no target at all. + spot = "pass" + } spot = strings.ToLower(strings.TrimSpace(spot)) if amount < t.Config.MinBet || amount > t.Config.MaxBet { return reject("Craps bets must be " + betRangeText(t.Config.MinBet, t.Config.MaxBet) + ".") @@ -446,6 +458,9 @@ func (t *crapsTable) action(name, action string) []Event { events = append(events, t.finishCrapsControls()...) return append(events, t.syncRoundClock()...) } + if t.Config.Craps.variant() == "simplified" && (action == "roll" || action == "autoroll") { + return []Event{t.private(name, "Simplified craps rolls by itself 3 seconds after a bet; there is no manual roll.")} + } if action == "autoroll" { if !p.HasBet { return []Event{t.private(name, "Place a bet before enabling autoroll.")} @@ -616,6 +631,7 @@ func (t *crapsTable) refundAll() []Event { } t.point = 0 t.rolled = false + t.countdown = 0 t.made = map[int]bool{} t.seen = map[int]bool{} t.phase = phaseWaiting |
