Feat: card counter
This commit is contained in:
		| @@ -65,6 +65,17 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { | ||||
| 		Revealed: true, | ||||
| 	} | ||||
| 	fi.Room.RevealSpecificWord(word) | ||||
| 	fi.Room.UpdateCounter() | ||||
| 	// if opened card is of color of opp team, change turn | ||||
| 	switch color { | ||||
| 	case "black": | ||||
| 		// game over | ||||
| 		fi.Room.IsRunning = false | ||||
| 		fi.Room.IsOver = true | ||||
| 	case "white", fi.Room.GetOppositeTeamColor(): | ||||
| 		// end turn | ||||
| 		fi.Room.TeamTurn = fi.Room.GetOppositeTeamColor() | ||||
| 	} | ||||
| 	if err := saveFullInfo(fi); err != nil { | ||||
| 		abortWithError(w, err.Error()) | ||||
| 		return | ||||
|   | ||||
| @@ -196,6 +196,7 @@ func HandleStartGame(w http.ResponseWriter, r *http.Request) { | ||||
| 		abortWithError(w, err.Error()) | ||||
| 		return | ||||
| 	} | ||||
| 	fi.Room.UpdateCounter() | ||||
| 	// reveal all cards | ||||
| 	if fi.State.Role == "mime" { | ||||
| 		fi.Room.RevealAllCards() | ||||
|   | ||||
| @@ -70,6 +70,8 @@ func HandleHome(w http.ResponseWriter, r *http.Request) { | ||||
| 	if fi != nil && fi.Room != nil && fi.State != nil { | ||||
| 		if fi.State.Role == "mime" { | ||||
| 			fi.Room.RevealAllCards() | ||||
| 		} else { | ||||
| 			fi.Room.UpdateCounter() | ||||
| 		} | ||||
| 	} | ||||
| 	if fi != nil && fi.Room == nil { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder