This commit is contained in:
liwei 2023-07-31 14:06:29 +08:00
commit 14d23b28b9
9 changed files with 206 additions and 43 deletions

View File

@ -320,7 +320,7 @@ type (
//校验战报
CheckBattleReport(session IUserSession, report *pb.BattleReport) (errdata *pb.ErrorData, iswin bool)
///创建石阵秘境战斗
CreateStoneBattle(session IUserSession, diBuff []*pb.DySkillData, format []int32, role []*pb.BattleRole, leadpos int32) (errdata *pb.ErrorData, record *pb.DBBattleRecord)
CreateStoneBattle(session IUserSession, stoneBattle *pb.StroneBattleReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord)
}
IGm interface {
CreateCmd(session IUserSession, cmd string) (errdata *pb.ErrorData)

View File

@ -936,10 +936,20 @@ func (this *modelBattleComp) getGlobalBuff(uid string) (buff *cfg.GamePandamasBu
}
// 创建石阵秘境战斗
func (this *modelBattleComp) creatStoneBattle(session comm.IUserSession, diBuff []*pb.DySkillData, format []int32, role []*pb.BattleRole, leadpos int32) (record *pb.DBBattleRecord, errdata *pb.ErrorData) {
func (this *modelBattleComp) creatStoneBattle(session comm.IUserSession, stoneBattle *pb.StroneBattleReq) (record *pb.DBBattleRecord, errdata *pb.ErrorData) {
var (
heros []*pb.DBHero = make([]*pb.DBHero, 5)
conf *cfg.GameBattleReadyData
err error
)
if conf, err = this.module.configure.GetBattleReady(stoneBattle.BattleEvents); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(),
}
return
}
record = &pb.DBBattleRecord{
Id: primitive.NewObjectID().Hex(),
Title: "",
@ -949,14 +959,15 @@ func (this *modelBattleComp) creatStoneBattle(session comm.IUserSession, diBuff
RedCompId: session.GetUserId(),
Redflist: make([]*pb.DBBattleFormt, 1),
BlueCompId: "",
Buleflist: make([]*pb.DBBattleFormt, len(format)),
Buleflist: make([]*pb.DBBattleFormt, len(stoneBattle.Format)),
Tasks: conf.BattleEvents,
}
record.Redflist[0] = &pb.DBBattleFormt{
Leadpos: leadpos,
Team: role,
Leadpos: stoneBattle.Leadpos,
Team: stoneBattle.Role,
}
if ok := this.checkBattlereadyCapskill(leadpos, heros); !ok {
if ok := this.checkBattlereadyCapskill(stoneBattle.Leadpos, heros); !ok {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_BattleCapskillCheckFailed,
Title: pb.ErrorCode_BattleCapskillCheckFailed.ToString(),
@ -967,13 +978,13 @@ func (this *modelBattleComp) creatStoneBattle(session comm.IUserSession, diBuff
captain int32
masters []*pb.BattleRole
)
for i, v := range format {
for i, v := range stoneBattle.Format {
if captain, masters, errdata = this.createMasterRoles(200, i, v); errdata != nil {
return
}
for _, v1 := range masters {
if v1 != nil {
v1.BattleBeforeSkill = diBuff
v1.BattleBeforeSkill = stoneBattle.DiBuff
}
}

View File

@ -526,9 +526,9 @@ func (this *Battle) CheckBattleReport(session comm.IUserSession, report *pb.Batt
}
// 创建石阵秘境战斗
func (this *Battle) CreateStoneBattle(session comm.IUserSession, diBuff []*pb.DySkillData, format []int32, role []*pb.BattleRole, leadpos int32) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
func (this *Battle) CreateStoneBattle(session comm.IUserSession, stoneBattle *pb.StroneBattleReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
if record, errdata = this.modelBattle.creatStoneBattle(session, diBuff, format, role, leadpos); errdata != nil {
if record, errdata = this.modelBattle.creatStoneBattle(session, stoneBattle); errdata != nil {
return
}

View File

@ -177,6 +177,8 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
for i := 1; i <= int(req.DrawCount); i++ { // 一张一张的抽
heroRecord.Race[req.DrawType] += 1
drawCount++
heroRecord.Baodi5[req.DrawType]++
heroRecord.Baodi4[req.DrawType]++
if v, ok := appointmap[drawCount]; ok { // 优先校验是否是指定抽
strPool = append(strPool, v) //找到了
continue
@ -237,8 +239,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
}
continue
}
heroRecord.Baodi5[req.DrawType]++
heroRecord.Baodi4[req.DrawType]++
if req.DrawCount == 10 {
if star4Count >= cfgGlobal.Draw10Star4Max { // 10连抽最大4星数量
if IsBaodiPool {

View File

@ -97,11 +97,28 @@ func (this *apiComp) Battle(session comm.IUserSession, req *pb.StonehengeBattleR
}
return
}
} else {
szHero = append(szHero, nil)
}
}
stoneBattle := &pb.StroneBattleReq{
DiBuff: diBuff,
Format: battleConf.FormatList,
Role: szHero,
Leadpos: req.Battle.Leadpos,
Btype: pb.BattleType_pve,
Ptype: pb.PlayType_stone,
BattleEvents: battleConf.BattleReadyID,
}
// 石阵秘境战斗前准备
errdata, record := this.module.battle.CreateStoneBattle(session, diBuff, battleConf.FormatList, szHero, req.Battle.Leadpos)
// errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
// Rulesid: battleConf.BattleReadyID,
// Ptype: pb.PlayType_mainline,
// Title: "",
// Format: req.Battle,
// Mformat: battleConf.FormatList,
// })
errdata, record := this.module.battle.CreateStoneBattle(session, stoneBattle)
if errdata != nil {
return
}

View File

@ -74,6 +74,7 @@ func (this *apiComp) EnterLevel(session comm.IUserSession, req *pb.StonehengeEnt
}
if len(roles) == len(req.Hid) {
for i, v := range req.Hid {
roles[i].Tid = 100 + int32(i)
stone.Hero[v] = roles[i]
}
}

View File

@ -118,6 +118,7 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
for _, v := range req.Report.Alive { // 注意 阵亡英雄不在存货列表内
stone.Hero[v.Oid] = v
}
update["hero"] = stone.Hero
}
stone.Rooms.Eventid[req.Eventid] = true //
// 校验事件有后续事件

View File

@ -1771,6 +1771,101 @@ func (x *BattleStateInfo) GetInputCmds() []*BattleCmd {
return nil
}
type StroneBattleReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
DiBuff []*DySkillData `protobuf:"bytes,1,rep,name=diBuff,proto3" json:"diBuff"`
Format []int32 `protobuf:"varint,2,rep,packed,name=format,proto3" json:"format"`
Role []*BattleRole `protobuf:"bytes,3,rep,name=role,proto3" json:"role"`
Leadpos int32 `protobuf:"varint,4,opt,name=leadpos,proto3" json:"leadpos"`
Btype BattleType `protobuf:"varint,5,opt,name=Btype,proto3,enum=BattleType" json:"Btype"`
Ptype PlayType `protobuf:"varint,6,opt,name=Ptype,proto3,enum=PlayType" json:"Ptype"`
BattleEvents int32 `protobuf:"varint,7,opt,name=BattleEvents,proto3" json:"BattleEvents"`
}
func (x *StroneBattleReq) Reset() {
*x = StroneBattleReq{}
if protoimpl.UnsafeEnabled {
mi := &file_battle_battle_msg_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StroneBattleReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StroneBattleReq) ProtoMessage() {}
func (x *StroneBattleReq) ProtoReflect() protoreflect.Message {
mi := &file_battle_battle_msg_proto_msgTypes[25]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StroneBattleReq.ProtoReflect.Descriptor instead.
func (*StroneBattleReq) Descriptor() ([]byte, []int) {
return file_battle_battle_msg_proto_rawDescGZIP(), []int{25}
}
func (x *StroneBattleReq) GetDiBuff() []*DySkillData {
if x != nil {
return x.DiBuff
}
return nil
}
func (x *StroneBattleReq) GetFormat() []int32 {
if x != nil {
return x.Format
}
return nil
}
func (x *StroneBattleReq) GetRole() []*BattleRole {
if x != nil {
return x.Role
}
return nil
}
func (x *StroneBattleReq) GetLeadpos() int32 {
if x != nil {
return x.Leadpos
}
return 0
}
func (x *StroneBattleReq) GetBtype() BattleType {
if x != nil {
return x.Btype
}
return BattleType_nil
}
func (x *StroneBattleReq) GetPtype() PlayType {
if x != nil {
return x.Ptype
}
return PlayType_null
}
func (x *StroneBattleReq) GetBattleEvents() int32 {
if x != nil {
return x.BattleEvents
}
return 0
}
var File_battle_battle_msg_proto protoreflect.FileDescriptor
var file_battle_battle_msg_proto_rawDesc = []byte{
@ -1983,8 +2078,23 @@ var file_battle_battle_msg_proto_rawDesc = []byte{
0x6f, 0x75, 0x74, 0x43, 0x6d, 0x64, 0x73, 0x12, 0x28, 0x0a, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74,
0x43, 0x6d, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x42, 0x61, 0x74,
0x74, 0x6c, 0x65, 0x43, 0x6d, 0x64, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x43, 0x6d, 0x64,
0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
0x73, 0x22, 0xf2, 0x01, 0x0a, 0x0f, 0x53, 0x74, 0x72, 0x6f, 0x6e, 0x65, 0x42, 0x61, 0x74, 0x74,
0x6c, 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x06, 0x64, 0x69, 0x42, 0x75, 0x66, 0x66, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x44, 0x79, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x44,
0x61, 0x74, 0x61, 0x52, 0x06, 0x64, 0x69, 0x42, 0x75, 0x66, 0x66, 0x12, 0x16, 0x0a, 0x06, 0x66,
0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x66, 0x6f, 0x72,
0x6d, 0x61, 0x74, 0x12, 0x1f, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04,
0x72, 0x6f, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, 0x18,
0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, 0x12, 0x21,
0x0a, 0x05, 0x42, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0b, 0x2e,
0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x42, 0x74, 0x79, 0x70,
0x65, 0x12, 0x1f, 0x0a, 0x05, 0x50, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e,
0x32, 0x09, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x50, 0x74, 0x79,
0x70, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x45, 0x76, 0x65, 0x6e,
0x74, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65,
0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1999,7 +2109,7 @@ func file_battle_battle_msg_proto_rawDescGZIP() []byte {
return file_battle_battle_msg_proto_rawDescData
}
var file_battle_battle_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 25)
var file_battle_battle_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 26)
var file_battle_battle_msg_proto_goTypes = []interface{}{
(*LineUp)(nil), // 0: LineUp
(*BattleFormation)(nil), // 1: BattleFormation
@ -2026,39 +2136,41 @@ var file_battle_battle_msg_proto_goTypes = []interface{}{
(*BattleConcedeReq)(nil), // 22: BattleConcedeReq
(*BattleConcedeResp)(nil), // 23: BattleConcedeResp
(*BattleStateInfo)(nil), // 24: BattleStateInfo
(PlayType)(0), // 25: PlayType
(*DBHero)(nil), // 26: DBHero
(*BattleRole)(nil), // 27: BattleRole
(BattleType)(0), // 28: BattleType
(*DBBattleFormt)(nil), // 29: DBBattleFormt
(*anypb.Any)(nil), // 30: google.protobuf.Any
(*StroneBattleReq)(nil), // 25: StroneBattleReq
(PlayType)(0), // 26: PlayType
(*DBHero)(nil), // 27: DBHero
(*BattleRole)(nil), // 28: BattleRole
(BattleType)(0), // 29: BattleType
(*DBBattleFormt)(nil), // 30: DBBattleFormt
(*anypb.Any)(nil), // 31: google.protobuf.Any
(*DySkillData)(nil), // 32: DySkillData
}
var file_battle_battle_msg_proto_depIdxs = []int32{
25, // 0: BattleEVEReq.ptype:type_name -> PlayType
26, // 0: BattleEVEReq.ptype:type_name -> PlayType
1, // 1: BattleEVEReq.format:type_name -> BattleFormation
25, // 2: BattlePVEReq.ptype:type_name -> PlayType
26, // 2: BattlePVEReq.ptype:type_name -> PlayType
1, // 3: BattlePVEReq.format:type_name -> BattleFormation
26, // 4: PVPFormation.format:type_name -> DBHero
25, // 5: BattlePVPReq.ptype:type_name -> PlayType
27, // 4: PVPFormation.format:type_name -> DBHero
26, // 5: BattlePVPReq.ptype:type_name -> PlayType
4, // 6: BattlePVPReq.redformat:type_name -> PVPFormation
4, // 7: BattlePVPReq.buleformat:type_name -> PVPFormation
25, // 8: BattleRTPVPReq.ptype:type_name -> PlayType
26, // 8: BattleRTPVPReq.ptype:type_name -> PlayType
1, // 9: BattleRTPVPReq.redformat:type_name -> BattleFormation
1, // 10: BattleRTPVPReq.bulefformat:type_name -> BattleFormation
25, // 11: BattleLPVEReq.ptype:type_name -> PlayType
26, // 11: BattleLPVEReq.ptype:type_name -> PlayType
1, // 12: BattleLPVEReq.format:type_name -> BattleFormation
27, // 13: BattleLPVEReq.monsters:type_name -> BattleRole
25, // 14: BattlePVBReq.ptype:type_name -> PlayType
28, // 13: BattleLPVEReq.monsters:type_name -> BattleRole
26, // 14: BattlePVBReq.ptype:type_name -> PlayType
1, // 15: BattlePVBReq.format:type_name -> BattleFormation
28, // 16: BattleInfo.btype:type_name -> BattleType
25, // 17: BattleInfo.ptype:type_name -> PlayType
29, // 18: BattleInfo.redflist:type_name -> DBBattleFormt
29, // 19: BattleInfo.buleflist:type_name -> DBBattleFormt
29, // 16: BattleInfo.btype:type_name -> BattleType
26, // 17: BattleInfo.ptype:type_name -> PlayType
30, // 18: BattleInfo.redflist:type_name -> DBBattleFormt
30, // 19: BattleInfo.buleflist:type_name -> DBBattleFormt
9, // 20: BattleReport.info:type_name -> BattleInfo
10, // 21: BattleReport.incmd:type_name -> BattleCmd
10, // 22: BattleReport.outcmd:type_name -> BattleCmd
27, // 23: BattleReport.alive:type_name -> BattleRole
30, // 24: BattleRpcMessage.data:type_name -> google.protobuf.Any
28, // 23: BattleReport.alive:type_name -> BattleRole
31, // 24: BattleRpcMessage.data:type_name -> google.protobuf.Any
24, // 25: BattleGetInfoResp.info:type_name -> BattleStateInfo
9, // 26: BattleCreateServerReq.info:type_name -> BattleInfo
10, // 27: BattleInCmdReq.in:type_name -> BattleCmd
@ -2067,11 +2179,15 @@ var file_battle_battle_msg_proto_depIdxs = []int32{
9, // 30: BattleStateInfo.info:type_name -> BattleInfo
10, // 31: BattleStateInfo.outCmds:type_name -> BattleCmd
10, // 32: BattleStateInfo.inputCmds:type_name -> BattleCmd
33, // [33:33] is the sub-list for method output_type
33, // [33:33] is the sub-list for method input_type
33, // [33:33] is the sub-list for extension type_name
33, // [33:33] is the sub-list for extension extendee
0, // [0:33] is the sub-list for field type_name
32, // 33: StroneBattleReq.diBuff:type_name -> DySkillData
28, // 34: StroneBattleReq.role:type_name -> BattleRole
29, // 35: StroneBattleReq.Btype:type_name -> BattleType
26, // 36: StroneBattleReq.Ptype:type_name -> PlayType
37, // [37:37] is the sub-list for method output_type
37, // [37:37] is the sub-list for method input_type
37, // [37:37] is the sub-list for extension type_name
37, // [37:37] is the sub-list for extension extendee
0, // [0:37] is the sub-list for field type_name
}
func init() { file_battle_battle_msg_proto_init() }
@ -2382,6 +2498,18 @@ func file_battle_battle_msg_proto_init() {
return nil
}
}
file_battle_battle_msg_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StroneBattleReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -2389,7 +2517,7 @@ func file_battle_battle_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_battle_battle_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 25,
NumMessages: 26,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -83,4 +83,8 @@ const (
GameBuffType_HACKER_FORESIGHT = 71
GameBuffType_FROST_STONE = 72
GameBuffType_BLEED = 73
GameBuffType_LOSEHPADDPRO = 74
GameBuffType_RESISTBUFF = 75
GameBuffType_NODEF = 76
GameBuffType_TREUP = 77
)