主线体力消耗

This commit is contained in:
meixiongfeng 2023-06-13 15:19:32 +08:00
parent 5683298a85
commit 81b2bf3b6c
2 changed files with 9 additions and 10 deletions

View File

@ -80,7 +80,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
}
}
if v1, ok := curChapter.Ps[req.StageId]; ok && v1 == 0 {
if v1, ok := curChapter.Ps[req.StageId]; ok && v1 != 0 {
if errdata = this.module.ConsumeRes(session, stageConf.PsMg, true); errdata != nil { // 扣1点
return
}

View File

@ -1,7 +1,6 @@
package mline
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/pb"
@ -67,14 +66,14 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
if errdata != nil {
return
}
if v, ok := curChapter.Ps[req.StageId]; !ok || v == 0 {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_HuntingLvErr,
Title: pb.ErrorCode_HuntingLvErr.ToString(),
Message: fmt.Sprintf("关卡体力参数异常,uid:%s,预扣体力:%d", session.GetUserId(), v),
}
return
}
// if v, ok := curChapter.Ps[req.StageId]; !ok || v == 0 {
// errdata = &pb.ErrorData{
// Code: pb.ErrorCode_HuntingLvErr,
// Title: pb.ErrorCode_HuntingLvErr.ToString(),
// Message: fmt.Sprintf("关卡体力参数异常,uid:%s,预扣体力:%d", session.GetUserId(), v),
// }
// return
// }
curChapter.Ps[req.StageId] = 0 // 清空预扣体力值
update["ps"] = curChapter.Ps
if !isWin { // 战斗失败返还扣除的体力