初始玩家体力

This commit is contained in:
meixiongfeng 2023-10-23 15:58:02 +08:00
parent 48d84dc0bc
commit 90a1daf23a

View File

@ -241,6 +241,10 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
this.curPower = this.NexPower
case "ready":
if len(this.szSession) == 1 { // AI对战的话直接开始游戏
this.NexPower = this.player1.Uid
this.curPower = this.player1.Uid
this.player1.Ps = MaxPs
this.player2.Ps = MaxPs
if err := this.module.SendMsgToSession(string(this.module.GetType()), "startgame", &pb.EntertainStartGamePush{
User1: this.player1,
User2: this.player2,
@ -251,8 +255,7 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
}, this.szSession...); err != nil {
this.Errorln(err)
}
this.NexPower = this.player1.Uid
this.curPower = this.player1.Uid
this.operatetimer = timewheel.Add(time.Second*MaxTime, this.operateTimeOut)
}
}