战斗事件校验 校验传送门开启后 触发新的事件导致传送门又关闭
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) {
|
||||
var (
|
||||
isWin bool
|
||||
update map[string]interface{}
|
||||
roomConf *cfg.GameStoneRoomData
|
||||
eventConf *cfg.GameStoneEventData
|
||||
stone *pb.DBStonehenge
|
||||
newEvent int32 // 是否有新的事件
|
||||
err error
|
||||
isWin bool
|
||||
update map[string]interface{}
|
||||
roomConf *cfg.GameStoneRoomData
|
||||
eventConf *cfg.GameStoneEventData
|
||||
newEventConf *cfg.GameStoneEventData //新的事件配置
|
||||
stone *pb.DBStonehenge
|
||||
newEvent int32 // 是否有新的事件
|
||||
err error
|
||||
)
|
||||
|
||||
errdata, isWin = this.module.battle.CheckBattleReport(session, req.Report)
|
||||
if errdata != nil {
|
||||
return
|
||||
}
|
||||
if !isWin {
|
||||
if !isWin { // 战斗失败直接返回
|
||||
return
|
||||
}
|
||||
update = make(map[string]interface{})
|
||||
@ -56,7 +57,6 @@ func (this *apiComp) BattleOver(session comm.IUserSession, req *pb.StonehengeBat
|
||||
}
|
||||
return
|
||||
}
|
||||
update["stageID"] = stone.StageID
|
||||
if roomConf, err = this.module.configure.GetStoneRoomDataById(stone.Rooms.Roomid); err != nil {
|
||||
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 {
|
||||
return
|
||||
}
|
||||
stone.Rooms.Eventid[req.Eventid] = true
|
||||
// 校验事件有后续事件
|
||||
if eventConf.Probability >= comm.GetRandNum(0, 1000) { // 命中
|
||||
newEvent = eventConf.PostEvent
|
||||
stone.Rooms.Eventid[newEvent] = false //
|
||||
stone.Rooms.Eventid[req.Eventid] = true //
|
||||
stone.Rooms.Eventid[newEvent] = false //
|
||||
}
|
||||
|
||||
// 校验是否通关
|
||||
for _, v := range roomConf.Condition {
|
||||
if v == eventConf.EventType {
|
||||
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