Feat: guess limit
This commit is contained in:
		| @@ -7,6 +7,7 @@ import ( | ||||
| 	"gralias/models" | ||||
| 	"html/template" | ||||
| 	"net/http" | ||||
| 	"strconv" | ||||
| ) | ||||
|  | ||||
| func HandleCreateRoom(w http.ResponseWriter, r *http.Request) { | ||||
| @@ -143,6 +144,8 @@ func HandleStartGame(w http.ResponseWriter, r *http.Request) { | ||||
| 	fi.Room.IsRunning = true | ||||
| 	fi.Room.IsOver = false | ||||
| 	fi.Room.TeamTurn = "blue" | ||||
| 	fi.Room.OpenedThisTurn = 0 | ||||
| 	fi.Room.ThisTurnLimit = 0 | ||||
| 	loadCards(fi.Room) | ||||
| 	fi.Room.UpdateCounter() | ||||
| 	fi.Room.TeamWon = "" | ||||
| @@ -226,6 +229,11 @@ func HandleGiveClue(w http.ResponseWriter, r *http.Request) { | ||||
| 		abortWithError(w, err.Error()) | ||||
| 		return | ||||
| 	} | ||||
| 	guessLimitU64, err := strconv.ParseUint(num, 10, 8) | ||||
| 	if err != nil { | ||||
| 		abortWithError(w, err.Error()) | ||||
| 		return | ||||
| 	} | ||||
| 	// validations === | ||||
| 	if fi.State.Team != models.UserTeam(fi.Room.TeamTurn) { | ||||
| 		err = errors.New("not your team's move") | ||||
| @@ -253,6 +261,7 @@ func HandleGiveClue(w http.ResponseWriter, r *http.Request) { | ||||
| 	} | ||||
| 	fi.Room.ActionHistory = append(fi.Room.ActionHistory, action) | ||||
| 	fi.Room.MimeDone = true | ||||
| 	fi.Room.ThisTurnLimit = uint8(guessLimitU64) + 1 | ||||
| 	notify(models.NotifyBacklogPrefix+fi.Room.ID, clue+num) | ||||
| 	notifyBotIfNeeded(fi) | ||||
| 	if err := saveFullInfo(fi); err != nil { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder