战斗结束高星覆盖低星

This commit is contained in:
meixiongfeng 2023-01-13 19:16:18 +08:00
parent 624a53324d
commit 6efdfa4fb1

View File

@ -96,16 +96,35 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
}
}
}
// 判断是不是首通
if _, ok := curChapter.Star[req.StageId]; !ok {
first = true
curChapter.Star[req.StageId] = star // 星级赋值
update["star"] = curChapter.Star
}
if curChapter.Star[req.StageId] > star { // 给最高星
curChapter.Star[req.StageId] = star
update["star"] = curChapter.Star
// 判断星数
var (
totalStar int32
preStar int32
)
if curChapter.Star[req.StageId] != star {
for _, v := range szStar {
if star&v == v {
totalStar++
}
if curChapter.Star[req.StageId]&v == v {
preStar++
}
}
if totalStar >= preStar { // 给最高星
curChapter.Star[req.StageId] = star
update["star"] = curChapter.Star
}
}
curChapter.Ps[req.StageId] = 0 // 清空预扣体力值
update["ps"] = curChapter.Ps