if the other player is already readyed up, start the game

This commit is contained in:
stryan 2021-09-26 14:05:15 -04:00
parent ba328c6847
commit 351e5eebc6

View File

@ -158,6 +158,11 @@ func (g *Game) PlayerStateAct(id int, cmd string) *GameView {
return NewView(id, g) return NewView(id, g)
case "b": case "b":
//begin game //begin game
if id == SentinalID {
g.SentinalPlayer.Ready = true
} else if id == ScourgeID {
g.ScourgePlayer.Ready = true
}
if g.SentinalPlayer.Ready && g.ScourgePlayer.Ready && g.Status == StatusLobby { if g.SentinalPlayer.Ready && g.ScourgePlayer.Ready && g.Status == StatusLobby {
g.Status = StatusReady g.Status = StatusReady
if id == SentinalID { if id == SentinalID {
@ -175,12 +180,6 @@ func (g *Game) PlayerStateAct(id int, cmd string) *GameView {
g.ScourgeDeck.Cards = g.ScourgeDeck.Cards[0 : len(g.ScourgeDeck.Cards)-5] g.ScourgeDeck.Cards = g.ScourgeDeck.Cards[0 : len(g.ScourgeDeck.Cards)-5]
g.CurrentTurn = ScourgeID g.CurrentTurn = ScourgeID
} }
} else {
if id == SentinalID {
g.SentinalPlayer.Ready = true
} else if id == ScourgeID {
g.ScourgePlayer.Ready = true
}
} }
case "s": case "s":
//start turn //start turn