Skip to content

Commit

Permalink
提名投票
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzhaomax committed Mar 18, 2024
1 parent e1e1364 commit e8cf5d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions server/handler/game.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ func initGame(mux *sync.Mutex, game *model.Room, playerId string, conn *websocke
game.Log = ""
game.Executed = nil
game.CastPool = map[string][]string{}
game.VotePool = map[string]string{}
game.VoteLogs = map[string]string{}
game.VotePool = map[string]int{}
game.Nominated = nil
game.Executed = nil
game.State = model.GameState{}
// 初始化玩家状态 防止非法返回房间引起bug
for i, player := range game.Players {
Expand Down Expand Up @@ -349,7 +352,7 @@ func initStatus(players []model.Player, replaceDrunk string) []model.Player {
for i, player := range players {
players[i].Ready.Nominate = true
players[i].Ready.Nominated = true
players[i].Ready.Vote = 1
players[i].Ready.Vote = true
switch player.Character {
case Imp:
players[i].State.Evil = true
Expand Down
5 changes: 4 additions & 1 deletion server/handler/room.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ func startGame(room *model.Room) {
room.Result = ""
room.Log = ""
room.CastPool = map[string][]string{}
room.VotePool = map[string]string{}
room.VoteLogs = map[string]string{}
room.VotePool = map[string]int{}
room.Nominated = nil
room.Executed = nil
room.State = model.GameState{}
}

Expand Down

0 comments on commit e8cf5d0

Please sign in to comment.