战斗结束高星覆盖低星
This commit is contained in:
parent
624a53324d
commit
6efdfa4fb1
@ -96,16 +96,35 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断是不是首通
|
// 判断是不是首通
|
||||||
if _, ok := curChapter.Star[req.StageId]; !ok {
|
if _, ok := curChapter.Star[req.StageId]; !ok {
|
||||||
first = true
|
first = true
|
||||||
curChapter.Star[req.StageId] = star // 星级赋值
|
curChapter.Star[req.StageId] = star // 星级赋值
|
||||||
update["star"] = curChapter.Star
|
update["star"] = curChapter.Star
|
||||||
}
|
}
|
||||||
if curChapter.Star[req.StageId] > 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
|
curChapter.Star[req.StageId] = star
|
||||||
update["star"] = curChapter.Star
|
update["star"] = curChapter.Star
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
curChapter.Ps[req.StageId] = 0 // 清空预扣体力值
|
curChapter.Ps[req.StageId] = 0 // 清空预扣体力值
|
||||||
update["ps"] = curChapter.Ps
|
update["ps"] = curChapter.Ps
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user