buff 三选一

This commit is contained in:
meixiongfeng 2023-07-27 20:19:28 +08:00
parent 317f374799
commit 6f09a394fe
4 changed files with 87 additions and 12 deletions

View File

@ -78,12 +78,30 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
this.module.Debugf("Mline lotteryward DispenseRes err:+%v", lotteryward) this.module.Debugf("Mline lotteryward DispenseRes err:+%v", lotteryward)
} }
} }
} else if eventConf.EventType == EventType25 {
lenSelect := len(stone.Rooms.Selectbuff)
if lenSelect == 0 || lenSelect <= int(req.Param1) {
return
}
stone.Rooms.Selectbuff = []int32{}
stone.Userbuff[stone.Rooms.Selectbuff[req.Param1]] = 1
update["userbuff"] = stone.Userbuff
} }
// 校验事件有后续事件 // 校验事件有后续事件
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 // stone.Rooms.Eventid[req.Eventid] = true //
// 如果新的事件是3选1
if newEventConf.EventType == EventType25 {
for _, v := range stone.Addweight {
ownerbuff := make(map[int32]struct{}, 0)
for k := range stone.Userbuff {
ownerbuff[k] = struct{}{}
}
stone.Rooms.Selectbuff = this.module.configure.GetBuffGroupDataByLottery(eventConf.Value1, v, ownerbuff)
}
}
} }
// 校验是否通关 // 校验是否通关

View File

@ -28,7 +28,7 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.StonehengeFinishR
update["stageID"] = stone.StageID update["stageID"] = stone.StageID
stone.CurRoomIndes = 0 stone.CurRoomIndes = 0
update["curRoomIndes"] = stone.CurRoomIndes update["curRoomIndes"] = stone.CurRoomIndes
stone.Rooms = &pb.RoomData{} stone.Rooms = nil
update["rooms"] = stone.Rooms update["rooms"] = stone.Rooms
stone.Webuff = make([]int32, 0) stone.Webuff = make([]int32, 0)
update["webuff"] = stone.Webuff update["webuff"] = stone.Webuff

View File

@ -3,6 +3,7 @@ package stonehenge
import ( import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
) )
//参数校验 //参数校验
@ -18,9 +19,14 @@ func (this *apiComp) GotoRoomCheck(session comm.IUserSession, req *pb.Stonehenge
func (this *apiComp) GotoRoom(session comm.IUserSession, req *pb.StonehengeGotoRoomReq) (errdata *pb.ErrorData) { func (this *apiComp) GotoRoom(session comm.IUserSession, req *pb.StonehengeGotoRoomReq) (errdata *pb.ErrorData) {
var ( var (
stone *pb.DBStonehenge stone *pb.DBStonehenge
update map[string]interface{} update map[string]interface{}
bCheck bool bCheck bool
curRoomConf *cfg.GameStoneRoomData // 当前房间
confStage *cfg.GameStoneStageData
szEvent []int32
szBuff []int32
err error
) )
update = make(map[string]interface{}) update = make(map[string]interface{})
if errdata = this.GotoRoomCheck(session, req); errdata != nil { if errdata = this.GotoRoomCheck(session, req); errdata != nil {
@ -52,20 +58,70 @@ func (this *apiComp) GotoRoom(session comm.IUserSession, req *pb.StonehengeGotoR
return return
} }
stone.CurRoomIndes += 1 stone.CurRoomIndes += 1
if curRoomConf, err = this.module.configure.GetStoneRoomDataById(req.Portal); err != nil {
update["curRoomIndes"] = stone.CurRoomIndes errdata = &pb.ErrorData{
stone.Rooms = &pb.RoomData{ Code: pb.ErrorCode_ConfigNoFound,
Eventid: map[int32]bool{}, Title: pb.ErrorCode_ConfigNoFound.ToString(),
Roomid: req.Portal, Message: err.Error(),
Index: stone.CurRoomIndes, }
return
} }
update["curRoomIndes"] = stone.CurRoomIndes
confStage = this.module.configure.GetStageConfByStageid(stone.StageID, stone.CurRoomIndes)
if confStage == nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
}
return
}
stone.Rooms = &pb.RoomData{
Eventid: map[int32]bool{},
Portal: this.module.configure.GetRoomGroupDataByLottery(confStage.PortalGroup),
Selectbuff: []int32{},
Complete: false,
Index: stone.CurRoomIndes,
Roomid: curRoomConf.RoomId, // 第一个房间的房间id读配置
}
if curRoomConf.EventrewardGroup != 0 { // 垃圾事件组
szEvent = append(szEvent, curRoomConf.EventrewardGroup)
}
if curRoomConf.EventBattleGroup != 0 { // 战斗事件组
szEvent = append(szEvent, curRoomConf.EventBattleGroup)
}
if curRoomConf.EventStoryNpcGroup != 0 { // 剧情NPC事件组
szEvent = append(szEvent, curRoomConf.EventStoryNpcGroup)
}
if curRoomConf.EventTreasureGroup != 0 { // 宝箱奖励事件组
szEvent = append(szEvent, curRoomConf.EventTreasureGroup)
}
if curRoomConf.EventStoreGroup != 0 { // 商店事件组
szEvent = append(szEvent, curRoomConf.EventStoreGroup)
}
if len(szEvent) > 0 {
szBuff = this.module.configure.GetEventGroupDataByLottery(szEvent...)
for _, v := range szBuff {
stone.Rooms.Eventid[v] = false
}
}
stone.Rooms.Portal = this.module.configure.GetRoomGroupDataByLottery(req.Portal) stone.Rooms.Portal = this.module.configure.GetRoomGroupDataByLottery(req.Portal)
// 校验是否进boss // 校验是否进boss
if this.module.configure.GetFloorConfByStageId(stone.StageID)-1 == stone.CurRoomIndes { if this.module.configure.GetFloorConfByStageId(stone.StageID)-1 == stone.CurRoomIndes {
if stage := this.module.modelStonehenge.GetStoneBoosData(stone.StageID); stage != nil { if stage := this.module.modelStonehenge.GetStoneBoosData(stone.StageID); stage != nil {
stone.Rooms.Portal = []int32{stage.Roomid} stone.Rooms.Portal = []int32{stage.Roomid}
} }
}
// 进boss
if this.module.configure.GetFloorConfByStageId(stone.StageID) == stone.CurRoomIndes {
if c := this.module.configure.GetStageConfByStageid(stone.StageID, stone.CurRoomIndes); c != nil {
stone.Rooms.Portal = []int32{c.PortalGroup}
}
} }
update["rooms"] = stone.Rooms update["rooms"] = stone.Rooms
this.module.modelStonehenge.ChangeStonehengeData(session.GetUserId(), update) this.module.modelStonehenge.ChangeStonehengeData(session.GetUserId(), update)

View File

@ -1,5 +1,6 @@
package stonehenge package stonehenge
const ( const (
EventType16 = 16 EventType16 = 16 // 捡垃圾事件
EventType25 = 25 // buff三选一
) )