战斗事件校验 校验传送门开启后 触发新的事件导致传送门又关闭
This commit is contained in:
parent
2f3dc0aaa8
commit
6c99d9da7b
@ -22,20 +22,21 @@ func (this *apiComp) BattleOverCheck(session comm.IUserSession, req *pb.Stonehen
|
|||||||
// /挑战主线关卡
|
// /挑战主线关卡
|
||||||
func (this *apiComp) BattleOver(session comm.IUserSession, req *pb.StonehengeBattleOverReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) BattleOver(session comm.IUserSession, req *pb.StonehengeBattleOverReq) (errdata *pb.ErrorData) {
|
||||||
var (
|
var (
|
||||||
isWin bool
|
isWin bool
|
||||||
update map[string]interface{}
|
update map[string]interface{}
|
||||||
roomConf *cfg.GameStoneRoomData
|
roomConf *cfg.GameStoneRoomData
|
||||||
eventConf *cfg.GameStoneEventData
|
eventConf *cfg.GameStoneEventData
|
||||||
stone *pb.DBStonehenge
|
newEventConf *cfg.GameStoneEventData //新的事件配置
|
||||||
newEvent int32 // 是否有新的事件
|
stone *pb.DBStonehenge
|
||||||
err error
|
newEvent int32 // 是否有新的事件
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
errdata, isWin = this.module.battle.CheckBattleReport(session, req.Report)
|
errdata, isWin = this.module.battle.CheckBattleReport(session, req.Report)
|
||||||
if errdata != nil {
|
if errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !isWin {
|
if !isWin { // 战斗失败直接返回
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
update = make(map[string]interface{})
|
update = make(map[string]interface{})
|
||||||
@ -56,7 +57,6 @@ func (this *apiComp) BattleOver(session comm.IUserSession, req *pb.StonehengeBat
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
update["stageID"] = stone.StageID
|
|
||||||
if roomConf, err = this.module.configure.GetStoneRoomDataById(stone.Rooms.Roomid); err != nil {
|
if roomConf, err = this.module.configure.GetStoneRoomDataById(stone.Rooms.Roomid); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -64,17 +64,31 @@ func (this *apiComp) BattleOver(session comm.IUserSession, req *pb.StonehengeBat
|
|||||||
if eventConf, err = this.module.configure.GetStoneEventDataById(req.Eventid); err != nil {
|
if eventConf, err = this.module.configure.GetStoneEventDataById(req.Eventid); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
stone.Rooms.Eventid[req.Eventid] = true
|
||||||
// 校验事件有后续事件
|
// 校验事件有后续事件
|
||||||
if eventConf.Probability >= comm.GetRandNum(0, 1000) { // 命中
|
if eventConf.Probability >= comm.GetRandNum(0, 1000) { // 命中
|
||||||
newEvent = eventConf.PostEvent
|
newEvent = eventConf.PostEvent
|
||||||
stone.Rooms.Eventid[newEvent] = false //
|
stone.Rooms.Eventid[newEvent] = false //
|
||||||
stone.Rooms.Eventid[req.Eventid] = true //
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验是否通关
|
// 校验是否通关
|
||||||
for _, v := range roomConf.Condition {
|
for _, v := range roomConf.Condition {
|
||||||
if v == eventConf.EventType {
|
if v == eventConf.EventType {
|
||||||
stone.Rooms.Complete = true
|
stone.Rooms.Complete = true
|
||||||
|
if newEventConf, err = this.module.configure.GetStoneEventDataById(req.Eventid); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, v := range roomConf.Condition {
|
||||||
|
if v == newEventConf.EventType {
|
||||||
|
stone.Rooms.Complete = false // 判断新的事件导致传送门关闭
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user