Fix calculation in MayOK

This commit is contained in:
Trevor Slocum 2023-09-18 18:00:37 -07:00
parent 3db3cacce3
commit e6b46bf42c
2 changed files with 3 additions and 2 deletions

View file

@ -147,9 +147,10 @@ func (c *serverClient) Terminate(reason string) {
if reason != "" {
extra = ": " + reason
}
c.sendNotice("Connection terminated" + extra)
go func() {
c.sendNotice("Connection terminated" + extra)
time.Sleep(time.Second)
c.Client.Terminate(reason)
}()

View file

@ -78,7 +78,7 @@ func (g *GameState) MayRoll() bool {
// MayOK returns whether the player may send the 'ok' command.
func (g *GameState) MayOK() bool {
return g.Turn != 0 && g.Turn == g.PlayerNumber && len(g.Available) == 0
return g.Turn != 0 && g.Turn == g.PlayerNumber && g.Roll1 != 0 && len(g.Available) == 0
}
// MayReset returns whether the player may send the 'reset' command.