From d097f95d0516015eb9fad467e9a128e4052101e8 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 4 Nov 2022 15:30:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=BF=80=E6=B4=BB=E8=B5=9B=E5=AD=A3?= =?UTF-8?q?=E5=A1=94=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pb/pagoda_msg.pb.go | 161 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 140 insertions(+), 21 deletions(-) diff --git a/pb/pagoda_msg.pb.go b/pb/pagoda_msg.pb.go index 4d494c541..cd1306b54 100644 --- a/pb/pagoda_msg.pb.go +++ b/pb/pagoda_msg.pb.go @@ -628,6 +628,92 @@ func (x *PagodaQueryRecordResp) GetData() *DBPagodaRecord { return nil } +// 激活赛季塔 +type PagodaActivateReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PagodaActivateReq) Reset() { + *x = PagodaActivateReq{} + if protoimpl.UnsafeEnabled { + mi := &file_pagoda_pagoda_msg_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PagodaActivateReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PagodaActivateReq) ProtoMessage() {} + +func (x *PagodaActivateReq) ProtoReflect() protoreflect.Message { + mi := &file_pagoda_pagoda_msg_proto_msgTypes[12] + 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 PagodaActivateReq.ProtoReflect.Descriptor instead. +func (*PagodaActivateReq) Descriptor() ([]byte, []int) { + return file_pagoda_pagoda_msg_proto_rawDescGZIP(), []int{12} +} + +type PagodaActivateResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data *DBSeasonPagoda `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` +} + +func (x *PagodaActivateResp) Reset() { + *x = PagodaActivateResp{} + if protoimpl.UnsafeEnabled { + mi := &file_pagoda_pagoda_msg_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PagodaActivateResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PagodaActivateResp) ProtoMessage() {} + +func (x *PagodaActivateResp) ProtoReflect() protoreflect.Message { + mi := &file_pagoda_pagoda_msg_proto_msgTypes[13] + 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 PagodaActivateResp.ProtoReflect.Descriptor instead. +func (*PagodaActivateResp) Descriptor() ([]byte, []int) { + return file_pagoda_pagoda_msg_proto_rawDescGZIP(), []int{13} +} + +func (x *PagodaActivateResp) GetData() *DBSeasonPagoda { + if x != nil { + return x.Data + } + return nil +} + var File_pagoda_pagoda_msg_proto protoreflect.FileDescriptor var file_pagoda_pagoda_msg_proto_rawDesc = []byte{ @@ -685,7 +771,12 @@ var file_pagoda_pagoda_msg_proto_rawDesc = []byte{ 0x61, 0x67, 0x6f, 0x64, 0x61, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x65, 0x63, - 0x6f, 0x72, 0x64, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, + 0x6f, 0x72, 0x64, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x13, 0x0a, 0x11, 0x50, 0x61, 0x67, + 0x6f, 0x64, 0x61, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x22, 0x39, + 0x0a, 0x12, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x53, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x50, 0x61, 0x67, + 0x6f, 0x64, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } @@ -701,7 +792,7 @@ func file_pagoda_pagoda_msg_proto_rawDescGZIP() []byte { return file_pagoda_pagoda_msg_proto_rawDescData } -var file_pagoda_pagoda_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_pagoda_pagoda_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_pagoda_pagoda_msg_proto_goTypes = []interface{}{ (*PagodaGetListReq)(nil), // 0: PagodaGetListReq (*PagodaGetListResp)(nil), // 1: PagodaGetListResp @@ -715,26 +806,30 @@ var file_pagoda_pagoda_msg_proto_goTypes = []interface{}{ (*PagodaRankListResp)(nil), // 9: PagodaRankListResp (*PagodaQueryRecordReq)(nil), // 10: PagodaQueryRecordReq (*PagodaQueryRecordResp)(nil), // 11: PagodaQueryRecordResp - (*DBPagoda)(nil), // 12: DBPagoda - (*BattleFormation)(nil), // 13: BattleFormation - (*BattleInfo)(nil), // 14: BattleInfo - (*BattleReport)(nil), // 15: BattleReport - (*DBPagodaRecord)(nil), // 16: DBPagodaRecord + (*PagodaActivateReq)(nil), // 12: PagodaActivateReq + (*PagodaActivateResp)(nil), // 13: PagodaActivateResp + (*DBPagoda)(nil), // 14: DBPagoda + (*BattleFormation)(nil), // 15: BattleFormation + (*BattleInfo)(nil), // 16: BattleInfo + (*BattleReport)(nil), // 17: BattleReport + (*DBPagodaRecord)(nil), // 18: DBPagodaRecord + (*DBSeasonPagoda)(nil), // 19: DBSeasonPagoda } var file_pagoda_pagoda_msg_proto_depIdxs = []int32{ - 12, // 0: PagodaGetListResp.data:type_name -> DBPagoda - 12, // 1: PagodaGetRewardResp.data:type_name -> DBPagoda - 13, // 2: PagodaChallengeReq.battle:type_name -> BattleFormation - 14, // 3: PagodaChallengeResp.info:type_name -> BattleInfo - 15, // 4: PagodaChallengeOverReq.report:type_name -> BattleReport - 12, // 5: PagodaChallengeOverResp.data:type_name -> DBPagoda - 16, // 6: PagodaRankListResp.ranks:type_name -> DBPagodaRecord - 16, // 7: PagodaQueryRecordResp.data:type_name -> DBPagodaRecord - 8, // [8:8] is the sub-list for method output_type - 8, // [8:8] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name + 14, // 0: PagodaGetListResp.data:type_name -> DBPagoda + 14, // 1: PagodaGetRewardResp.data:type_name -> DBPagoda + 15, // 2: PagodaChallengeReq.battle:type_name -> BattleFormation + 16, // 3: PagodaChallengeResp.info:type_name -> BattleInfo + 17, // 4: PagodaChallengeOverReq.report:type_name -> BattleReport + 14, // 5: PagodaChallengeOverResp.data:type_name -> DBPagoda + 18, // 6: PagodaRankListResp.ranks:type_name -> DBPagodaRecord + 18, // 7: PagodaQueryRecordResp.data:type_name -> DBPagodaRecord + 19, // 8: PagodaActivateResp.data:type_name -> DBSeasonPagoda + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_pagoda_pagoda_msg_proto_init() } @@ -889,6 +984,30 @@ func file_pagoda_pagoda_msg_proto_init() { return nil } } + file_pagoda_pagoda_msg_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PagodaActivateReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pagoda_pagoda_msg_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PagodaActivateResp); 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{ @@ -896,7 +1015,7 @@ func file_pagoda_pagoda_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pagoda_pagoda_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 14, NumExtensions: 0, NumServices: 0, }, From 39387fd874f3491325a8861a305610f40c376c7e Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 4 Nov 2022 16:50:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=B1=9E=E6=80=A7=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/model_hero.go | 73 +++++++++----------------------------- 1 file changed, 17 insertions(+), 56 deletions(-) diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 87989ed11..c9f13c175 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -3,7 +3,6 @@ package hero import ( "crypto/rand" "errors" - "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" @@ -15,7 +14,6 @@ import ( "math/big" "reflect" - mengine "github.com/dengsgo/math-engine/engine" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/x/bsonx" @@ -413,65 +411,28 @@ func (this *ModelHero) mergeAddProperty(uid string, hero *pb.DBHero, data map[st //属性计算 基础属性 //英雄基础属性 + 英雄等级基础属性 * 英雄成长系数 + 英雄星级对应等级属性 * 英雄品质系数 func (this *ModelHero) PropertyCompute(hero *pb.DBHero) { - - //英雄等级基础属性levelup - heroLvCfg := this.moduleHero.configure.GetHeroLv(hero.Lv) - if heroLvCfg == nil { - return - } - - //英雄基础配置 newhero + growCfg := this.moduleHero.configure.GetHeroLvgrow(hero.HeroID) heroCfg := this.moduleHero.configure.GetHeroConfig(hero.HeroID) - if heroCfg == nil { + lvCfg := this.moduleHero.configure.GetHeroLv(hero.Lv) + starCfg := this.moduleHero.configure.GetHeroStar(heroCfg.Star) + starLvfg := this.moduleHero.configure.GetHeroLv(starCfg.Level) + if growCfg == nil || heroCfg == nil || lvCfg == nil || starCfg == nil || starLvfg == nil { return } + atk := (starLvfg.Atk*(1+(starCfg.StarupAtk/1000)) + lvCfg.Atk + float32(growCfg.Atk)) * (growCfg.Atkgrow / 1000) + def := (starLvfg.Def*(1+(starCfg.StarupDef/1000)) + lvCfg.Def + float32(growCfg.Def)) * (growCfg.Defgrow / 1000) + hp := (starLvfg.Hp*(1+(starCfg.StarupHp/1000)) + lvCfg.Hp + float32(growCfg.Hp)) * (growCfg.Hpgrow / 1000) + speed := growCfg.Speed - //品质系数 - stargrowCfg := this.moduleHero.configure.GetHeroStar(heroCfg.Star) - if stargrowCfg == nil { - return - } - - //英雄星级对应等级属性 - heroStarCfg := this.moduleHero.configure.GetHeroLv(heroCfg.Star * comm.HeroStarLvRatio) - if heroStarCfg == nil { - return - } - - //成长系数 - lvGrow := this.moduleHero.configure.GetHeroLvgrow(hero.HeroID) - if lvGrow == nil { - return - } - - //血量 - exprHp := fmt.Sprintf("%v + %v * %v/1000 + %v * %v/1000", - lvGrow.Hp, heroLvCfg.Hp, lvGrow.Hpgrow, heroStarCfg.Hp, stargrowCfg.StarupHp) - hp, _ := mengine.ParseAndExec(exprHp) - - // 攻击 - exprAtk := fmt.Sprintf("%v +%v * %v/1000 + %v * %v/1000", - lvGrow.Atk, heroLvCfg.Atk, lvGrow.Atkgrow, heroStarCfg.Atk, stargrowCfg.StarupAtk) - atk, _ := mengine.ParseAndExec(exprAtk) - - // 防御 - exprDef := fmt.Sprintf("%v +%v * %v/1000 + %v * %v/1000", - lvGrow.Def, heroLvCfg.Def, lvGrow.Defgrow, heroStarCfg.Def, stargrowCfg.StarupDef) - def, _ := mengine.ParseAndExec(exprDef) - - // 速度 - exprSpeed := fmt.Sprintf("%v +%v * %v/1000 + %v * %v/1000", - lvGrow.Speed, 0, 0, 0, stargrowCfg.StarupSpeed) - speed, _ := mengine.ParseAndExec(exprSpeed) hero.Property = map[string]int32{ - comm.Hp: int32(math.Floor(hp)), - comm.Atk: int32(math.Floor(atk)), - comm.Def: int32(math.Floor(def)), - comm.Speed: int32(math.Floor(speed)), - comm.Cri: int32(lvGrow.Cri), //暴击 - comm.Effhit: int32(lvGrow.Effhit), //效果命中 - comm.Cridam: int32(lvGrow.Cridam), //暴击伤害 - comm.Effre: int32(lvGrow.Effre), //效果抵抗 + comm.Hp: int32(math.Floor(float64(hp))), + comm.Atk: int32(math.Floor(float64(atk))), + comm.Def: int32(math.Floor(float64(def))), + comm.Speed: int32(math.Floor(float64(speed))), + comm.Cri: int32(growCfg.Cri), //暴击 + comm.Effhit: int32(growCfg.Effhit), //效果命中 + comm.Cridam: int32(growCfg.Cridam), //暴击伤害 + comm.Effre: int32(growCfg.Effre), //效果抵抗 } this.resetTalentProperty(hero) }