diff --git a/bin/json/game_fightingcapacity.json b/bin/json/game_fightingcapacity.json index 4f9ab318e..6fb47df0f 100644 --- a/bin/json/game_fightingcapacity.json +++ b/bin/json/game_fightingcapacity.json @@ -1,34 +1,34 @@ [ { - "id": 3, + "id": 53, "value": 100 }, { - "id": 4, + "id": 56, "value": 1400 }, { - "id": 5, + "id": 59, "value": 1400 }, { - "id": 6, + "id": 62, "value": 13500 }, { - "id": 7, + "id": 65, "value": 15500 }, { - "id": 8, + "id": 68, "value": 11400 }, { - "id": 9, + "id": 71, "value": 14000 }, { - "id": 10, + "id": 74, "value": 14000 }, { diff --git a/bin/json/game_hero.json b/bin/json/game_hero.json index 3e7b5d32c..cc1f8c844 100644 --- a/bin/json/game_hero.json +++ b/bin/json/game_hero.json @@ -6793,6 +6793,178 @@ "text": "传说中的守护者“香塔尔杜布瓦队长手下2号”,拥有不俗的战斗能力" } }, + { + "hid": "51008", + "name": { + "key": "hero_main_name_51008", + "text": "暴躁的村民" + }, + "star": 3, + "color": 2, + "race": 4, + "job": 3, + "type": 2, + "ip": 1, + "sd": 1, + "handbook": false, + "prefab": "51002", + "rotation": "0|0|0", + "revolve": 0, + "scale": [ + 1, + 1, + 1 + ], + "icon": "51002", + "vocal": "51002", + "tujing": [ + 107 + ], + "detailwindow": "effect_huaidanlianmeng_daiji", + "intr": { + "key": "", + "text": "" + }, + "events": "hero_51002", + "cite": "", + "effectstay": [], + "hpspace": { + "x": 0, + "y": 0, + "z": 0 + }, + "capskillrule": 101, + "skill": 0, + "skill1": 151002111, + "skill2": 151002211, + "skill3": 0, + "skill4": 0, + "skill5": 0, + "skill6": 0, + "txt": { + "key": "atlas_51008", + "text": "" + }, + "enteranivalue": 0, + "camerainterval": 0, + "equiprcom": [ + 1, + 2, + 10 + ], + "angle": 0, + "deviation": 0, + "show": 2, + "herofrag": [ + { + "a": "item", + "t": "12025001", + "n": 1 + } + ], + "herofragnum": 6, + "heroskillup": [ + "10000004" + ], + "expitem": [ + { + "a": "item", + "t": "10000011", + "n": 1 + } + ], + "expitemnum": 7, + "herointr": { + "key": "hero_main_herointr_51008", + "text": "传说中的守护者“暴躁的村民”,拥有不俗的战斗能力" + } + }, + { + "hid": "51009", + "name": { + "key": "hero_main_name_51009", + "text": "慌张的村民" + }, + "star": 3, + "color": 2, + "race": 4, + "job": 3, + "type": 2, + "ip": 1, + "sd": 1, + "handbook": false, + "prefab": "51003", + "rotation": "0|0|0", + "revolve": 0, + "scale": [ + 1, + 1, + 1 + ], + "icon": "51003", + "vocal": "51003", + "tujing": [ + 107 + ], + "detailwindow": "effect_chezhan_daiji", + "intr": { + "key": "", + "text": "" + }, + "events": "hero_51003", + "cite": "", + "effectstay": [], + "hpspace": { + "x": 0, + "y": 0, + "z": 0 + }, + "capskillrule": 101, + "skill": 0, + "skill1": 151003111, + "skill2": 151003211, + "skill3": 0, + "skill4": 0, + "skill5": 0, + "skill6": 0, + "txt": { + "key": "atlas_51009", + "text": "" + }, + "enteranivalue": 0, + "camerainterval": 0, + "equiprcom": [ + 1, + 2, + 10 + ], + "angle": 0, + "deviation": 0, + "show": 2, + "herofrag": [ + { + "a": "item", + "t": "12025001", + "n": 1 + } + ], + "herofragnum": 6, + "heroskillup": [ + "10000004" + ], + "expitem": [ + { + "a": "item", + "t": "10000011", + "n": 1 + } + ], + "expitemnum": 7, + "herointr": { + "key": "hero_main_herointr_51009", + "text": "传说中的守护者“慌张的村民”,拥有不俗的战斗能力" + } + }, { "hid": "54005", "name": { diff --git a/bin/json/game_monsterformat.json b/bin/json/game_monsterformat.json index f08595b4e..7e193f44f 100644 --- a/bin/json/game_monsterformat.json +++ b/bin/json/game_monsterformat.json @@ -123776,12 +123776,12 @@ "newskill": [], "lv": 65, "hppro": 18, - "atkpro": 1.65, - "defpro": 0.5, + "atkpro": 1.7, + "defpro": 0.8, "skill1": 1, "skill2": 1, "skill3": 1, - "speed": 145, + "speed": 155, "modelsize": 1 }, { @@ -123801,7 +123801,7 @@ "skill1": 1, "skill2": 1, "skill3": 1, - "speed": 155, + "speed": 165, "modelsize": 1 }, { diff --git a/bin/json/game_skillpassive.json b/bin/json/game_skillpassive.json index 373608b15..6ea20ee96 100644 --- a/bin/json/game_skillpassive.json +++ b/bin/json/game_skillpassive.json @@ -13431,7 +13431,7 @@ "icon": "", "When": 16, "FromCheck": "Target=3", - "TargetCheck": "Target=2,HasBuff=391000116,OverlayNum=25", + "TargetCheck": "Target=2,BuffTotalOverlayNumLess=391000116,OverlayNum=25", "MainSkillCheck": "SkillPos=5", "AfterSkillCheck": "", "BuffCheck": "", @@ -13457,7 +13457,7 @@ "icon": "", "When": 16, "FromCheck": "Target=3", - "TargetCheck": "Target=2,HasBuff=391000123,OverlayNum=25", + "TargetCheck": "Target=2,BuffTotalOverlayNumLess=391000123,OverlayNum=25", "MainSkillCheck": "SkillPos=5", "AfterSkillCheck": "", "BuffCheck": "", @@ -13483,7 +13483,7 @@ "icon": "", "When": 16, "FromCheck": "Target=3", - "TargetCheck": "Target=2,HasBuff=391000127,OverlayNum=25", + "TargetCheck": "Target=2,BuffTotalOverlayNumLess=391000127,OverlayNum=25", "MainSkillCheck": "SkillPos=5", "AfterSkillCheck": "", "BuffCheck": "", diff --git a/bin/json/game_vikingrecommend.json b/bin/json/game_vikingrecommend.json index 5dab430e9..acfcc24b8 100644 --- a/bin/json/game_vikingrecommend.json +++ b/bin/json/game_vikingrecommend.json @@ -7,25 +7,25 @@ }, "recommendtype1": { "key": "vikingexpedition_recommend_recommendtype1_1", - "text": "输出" + "text": "生存输出" }, "herolist1": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "35001", + "15003", + "35005", + "14003", + "13004" ], "recommendtype2": { "key": "vikingexpedition_recommend_recommendtype2_1", - "text": "治疗" + "text": "生存治疗" }, "herolist2": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "25004", + "15005", + "45003", + "43006", + "13004" ] }, { @@ -36,25 +36,25 @@ }, "recommendtype1": { "key": "vikingexpedition_recommend_recommendtype1_2", - "text": "单段输出" + "text": "多段输出" }, "herolist1": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "15003", + "14003", + "35005", + "35002", + "14007" ], "recommendtype2": { "key": "vikingexpedition_recommend_recommendtype2_2", - "text": "净化" + "text": "辅助控制" }, "herolist2": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "15005", + "45003", + "14007", + "24001", + "25004" ] }, { @@ -65,25 +65,25 @@ }, "recommendtype1": { "key": "vikingexpedition_recommend_recommendtype1_3", - "text": "多段输出" + "text": "单段输出" }, "herolist1": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "44001", + "44006", + "24003", + "35001", + "24005" ], "recommendtype2": { "key": "vikingexpedition_recommend_recommendtype2_3", - "text": "治疗" + "text": "辅助净化" }, "herolist2": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "24005", + "24003", + "15005", + "35001", + "13004" ] }, { @@ -94,25 +94,25 @@ }, "recommendtype1": { "key": "vikingexpedition_recommend_recommendtype1_4", - "text": "限制" + "text": "限制出手" }, "herolist1": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "14003", + "44001", + "15004", + "24001", + "43002" ], "recommendtype2": { "key": "vikingexpedition_recommend_recommendtype2_4", - "text": "辅助" + "text": "辅助控制" }, "herolist2": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "24005", + "43002", + "35006", + "24003", + "15005" ] }, { @@ -123,25 +123,25 @@ }, "recommendtype1": { "key": "vikingexpedition_recommend_recommendtype1_5", - "text": "爆发" + "text": "爆发输出" }, "herolist1": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "44001", + "35001", + "35005", + "15003", + "35001" ], "recommendtype2": { "key": "vikingexpedition_recommend_recommendtype2_5", - "text": "禁疗" + "text": "辅助禁疗" }, "herolist2": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "43004", + "35001", + "35006", + "35005", + "44001" ] }, { @@ -155,22 +155,22 @@ "text": "无视防御" }, "herolist1": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "35004", + "44001", + "35001", + "35005", + "15003" ], "recommendtype2": { "key": "vikingexpedition_recommend_recommendtype2_6", - "text": "中毒" + "text": "辅助中毒" }, "herolist2": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "24002", + "13002", + "35005", + "15005", + "34005" ] }, { @@ -181,25 +181,25 @@ }, "recommendtype1": { "key": "vikingexpedition_recommend_recommendtype1_7", - "text": "中毒" + "text": "中毒输出" }, "herolist1": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "34005", + "24002", + "13002", + "33003", + "35005" ], "recommendtype2": { "key": "vikingexpedition_recommend_recommendtype2_7", - "text": "治疗" + "text": "生存治疗" }, "herolist2": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "15005", + "45003", + "43006", + "13004", + "25004" ] }, { @@ -210,25 +210,25 @@ }, "recommendtype1": { "key": "vikingexpedition_recommend_recommendtype1_8", - "text": "群体伤害" + "text": "群体爆发" }, "herolist1": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "15004", + "35001", + "15003", + "35005", + "14003" ], "recommendtype2": { "key": "vikingexpedition_recommend_recommendtype2_8", - "text": "爆发" + "text": "控制输出" }, "herolist2": [ - "25001", - "25001", - "25001", - "25001", - "25001" + "14003", + "44001", + "24005", + "24003", + "15004" ] } ] \ No newline at end of file diff --git a/modules/hero/api_awaken.go b/modules/hero/api_awaken.go index c041cc335..11831e987 100644 --- a/modules/hero/api_awaken.go +++ b/modules/hero/api_awaken.go @@ -72,6 +72,7 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e if len(awakenData.Phasebonus) > 0 { this.module.modelHero.resetJuexingProperty(_hero) + this.module.modelHero.calFigthValue(_hero) } // 校验 有没有技能 if awakenData.Skill != 0 { @@ -84,6 +85,7 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e } _heroMap["juexingLv"] = _hero.JuexingLv _heroMap["juexProperty"] = _hero.JuexProperty + _heroMap["fightvalue"] = _hero.Fightvalue // 保存数据 err = this.module.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap) if err != nil { diff --git a/modules/hero/api_strengthenUpSkill.go b/modules/hero/api_strengthenUpSkill.go index 5a088f092..2fc2cd9f6 100644 --- a/modules/hero/api_strengthenUpSkill.go +++ b/modules/hero/api_strengthenUpSkill.go @@ -27,6 +27,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt _hero *pb.DBHero // 操作的英雄 cost []*cfg.Gameatn // 技能升级消耗 lvUpCount int32 // 技能升级的次数 + //skillValue int32 // 战斗力 ) if errdata = this.StrengthenUpSkillCheck(session, req); errdata != nil { return @@ -105,9 +106,10 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt if errdata = this.module.ConsumeRes(session, cost, true); errdata != nil { return } - + this.module.modelHero.calFigthValue(_hero) _heroMap := map[string]interface{}{ "normalSkill": _hero.NormalSkill, + "fightvalue": _hero.Fightvalue, } err = this.module.modelHero.ChangeList(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息 if err != nil { diff --git a/modules/hero/api_strengthenUpStar.go b/modules/hero/api_strengthenUpStar.go index 843173a05..dfb30a43a 100644 --- a/modules/hero/api_strengthenUpStar.go +++ b/modules/hero/api_strengthenUpStar.go @@ -78,6 +78,7 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr "property": _hero.Property, "juexProperty": _hero.JuexProperty, "horoscopeProperty": _hero.HoroscopeProperty, + "fightvalue": _hero.Fightvalue, } // 保存数据 diff --git a/modules/hero/api_talentlearn.go b/modules/hero/api_talentlearn.go index 459f7e592..ad3d27164 100644 --- a/modules/hero/api_talentlearn.go +++ b/modules/hero/api_talentlearn.go @@ -179,6 +179,7 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe // 同步修改属性 this.module.modelHero.setTalentProperty(hero, talentConf) + chanegCard = append(chanegCard, hero) // 添加推送属性变化信息 session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: chanegCard}) diff --git a/modules/hero/configure_comp.go b/modules/hero/configure_comp.go index 3fcf8ac96..74ef663cb 100644 --- a/modules/hero/configure_comp.go +++ b/modules/hero/configure_comp.go @@ -43,6 +43,12 @@ const ( draw_reward = "game_drawreward.json" //新手招募奖励 game_herolevelupreward = "game_herolevelupreward.json" //英雄升级奖励 + + // 战力相关配置读取 + game_fightingcapacity = "game_fightingcapacity.json" + game_fightingskill = "game_fightingskill.json" + game_fightingskilllv = "game_fightingskilllv.json" + game_fightingskillstar = "game_fightingskillstar.json" ) type CondData struct { @@ -94,7 +100,12 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp draw_reward: cfg.NewGamedrawReward, game_herolevelupreward: cfg.NewGameHeroLevelupreward, //hero_cardweight: cfg.NewGameDrawWeight, + game_fightingcapacity: cfg.NewGameFightingCapacity, + game_fightingskill: cfg.NewGameFightingSkill, + game_fightingskilllv: cfg.NewGameFightingSkilllv, + game_fightingskillstar: cfg.NewGameFightingSkillStar, }) + //this.drawCardCfg = make(map[string]map[int32][]*cfg.GameDrawCardData, 0) //configure.RegisterConfigure(hero_drawcard, cfg.NewGameDrawCard, this.SetHeroDrawConfig) this.awakenMap = make(map[int64]*cfg.GameHeroAwakenData, 0) @@ -604,3 +615,79 @@ func (this *configureComp) GetHeroLvUpWardData(star int32, lv int32) (conf *cfg. err = fmt.Errorf("no found") return } + +// 转map 类型 方便计算 +func (this *configureComp) GetGameFightingCapacityData() (m map[int32]int32) { + var ( + v interface{} + err error + ) + m = make(map[int32]int32) + if v, err = this.GetConfigure(game_fightingcapacity); err == nil { + if confg, ok := v.(*cfg.GameFightingCapacity); ok { + for _, v1 := range confg.GetDataList() { + m[v1.Id] = v1.Value + } + } + } + return +} +func (this *configureComp) GetGameFightingCapacity(id int32) (conf *cfg.GameFightingCapacityData, err error) { + var ( + v interface{} + ) + if v, err = this.GetConfigure(game_fightingcapacity); err == nil { + if confg, ok := v.(*cfg.GameFightingCapacity); ok { + if conf = confg.Get(id); conf != nil { + return + } + } + } + err = comm.NewNotFoundConfErr(moduleName, game_fightingcapacity, id) + return +} + +func (this *configureComp) GetGameFightingSkill(lv int32) (conf *cfg.GameFightingSkillData, err error) { + var ( + v interface{} + ) + if v, err = this.GetConfigure(game_fightingskill); err == nil { + if confg, ok := v.(*cfg.GameFightingSkill); ok { + if conf = confg.Get(lv); conf != nil { + return + } + } + } + err = comm.NewNotFoundConfErr(moduleName, game_fightingskill, lv) + return +} + +func (this *configureComp) GetGameFightingSkilllv(skillId int32) (conf *cfg.GameFightingSkilllvData, err error) { + var ( + v interface{} + ) + if v, err = this.GetConfigure(game_fightingskilllv); err == nil { + if confg, ok := v.(*cfg.GameFightingSkilllv); ok { + if conf = confg.Get(skillId); conf != nil { + return + } + } + } + err = comm.NewNotFoundConfErr(moduleName, game_fightingskill, skillId) + return +} + +func (this *configureComp) GetGameFightingSkillStar(star int32) (conf *cfg.GameFightingSkillStarData, err error) { + var ( + v interface{} + ) + if v, err = this.GetConfigure(game_fightingskillstar); err == nil { + if confg, ok := v.(*cfg.GameFightingSkillStar); ok { + if conf = confg.Get(star); conf != nil { + return + } + } + } + err = comm.NewNotFoundConfErr(moduleName, game_fightingskill, star) + return +} diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index b1bf29f86..a42c7176e 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -37,6 +37,153 @@ func (this *ModelHero) Init(service core.IService, module core.IModule, comp cor return } +// 计算英雄战力 +func (this *ModelHero) calFigthValue(hero *pb.DBHero) (addValue int32, err error) { + var ( + skillValue int32 // 技能战力 + baseValue int32 // 基础战力 + heroCfg *cfg.GameHeroData //英雄配置 + tmpHero *pb.DBHero + preValue int32 + skillpos *cfg.GameFightingSkilllvData + skilllv *cfg.GameFightingSkilllvData + skillStar *cfg.GameFightingSkillStarData + ) + tmpHero = new(pb.DBHero) + *tmpHero = *hero // 克隆一个对象 + preValue = hero.Fightvalue + if heroCfg, err = this.module.configure.GetHeroConfig(tmpHero.HeroID); err != nil { + return + } + + for k, v := range tmpHero.Property { + switch k { + case cfg.GamePropertyType_Base_MaxHp_Per: + tmpHero.Property[cfg.GamePropertyType_Base_MaxHp_Per] = 0 + tmpHero.Property[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_MaxHp_Base]))) + case cfg.GamePropertyType_Base_Atk_Per: + tmpHero.Property[cfg.GamePropertyType_Base_Atk_Per] = 0 + tmpHero.Property[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Atk_Base]))) + case cfg.GamePropertyType_Base_Def_Per: + tmpHero.Property[cfg.GamePropertyType_Base_Def_Per] = 0 + tmpHero.Property[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Def_Base]))) + case cfg.GamePropertyType_Base_Speed_Per: + tmpHero.Property[cfg.GamePropertyType_Base_Speed_Per] = 0 + tmpHero.Property[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Speed_Base]))) + } + } + + for k, v := range tmpHero.AddProperty { + switch k { + case cfg.GamePropertyType_Base_MaxHp_Per: + tmpHero.AddProperty[cfg.GamePropertyType_Base_MaxHp_Per] = 0 + tmpHero.AddProperty[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_MaxHp_Base]))) + case cfg.GamePropertyType_Base_Atk_Per: + tmpHero.AddProperty[cfg.GamePropertyType_Base_Atk_Per] = 0 + tmpHero.AddProperty[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Atk_Base]))) + case cfg.GamePropertyType_Base_Def_Per: + tmpHero.AddProperty[cfg.GamePropertyType_Base_Def_Per] = 0 + tmpHero.AddProperty[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Def_Base]))) + case cfg.GamePropertyType_Base_Speed_Per: + tmpHero.AddProperty[cfg.GamePropertyType_Base_Speed_Per] = 0 + tmpHero.AddProperty[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Speed_Base]))) + } + } + + for k, v := range tmpHero.JuexProperty { + switch k { + case cfg.GamePropertyType_Base_MaxHp_Per: + tmpHero.JuexProperty[cfg.GamePropertyType_Base_MaxHp_Per] = 0 + tmpHero.JuexProperty[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_MaxHp_Base]))) + case cfg.GamePropertyType_Base_Atk_Per: + tmpHero.JuexProperty[cfg.GamePropertyType_Base_Atk_Per] = 0 + tmpHero.JuexProperty[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Atk_Base]))) + case cfg.GamePropertyType_Base_Def_Per: + tmpHero.JuexProperty[cfg.GamePropertyType_Base_Def_Per] = 0 + tmpHero.JuexProperty[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Def_Base]))) + case cfg.GamePropertyType_Base_Speed_Per: + tmpHero.JuexProperty[cfg.GamePropertyType_Base_Speed_Per] = 0 + tmpHero.JuexProperty[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Speed_Base]))) + } + } + + for k, v := range tmpHero.HoroscopeProperty { + switch k { + case cfg.GamePropertyType_Base_MaxHp_Per: + tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_MaxHp_Per] = 0 + tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_MaxHp_Base]))) + case cfg.GamePropertyType_Base_Atk_Per: + tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_Atk_Per] = 0 + tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Atk_Base]))) + case cfg.GamePropertyType_Base_Def_Per: + tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_Def_Per] = 0 + tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Def_Base]))) + case cfg.GamePropertyType_Base_Speed_Per: + tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_Speed_Per] = 0 + tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Speed_Base]))) + } + } + + for k, v := range tmpHero.TalentProperty { + switch k { + case cfg.GamePropertyType_Base_MaxHp_Per: + tmpHero.TalentProperty[cfg.GamePropertyType_Base_MaxHp_Per] = 0 + tmpHero.TalentProperty[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_MaxHp_Base]))) + case cfg.GamePropertyType_Base_Atk_Per: + tmpHero.TalentProperty[cfg.GamePropertyType_Base_Atk_Per] = 0 + tmpHero.TalentProperty[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Atk_Base]))) + case cfg.GamePropertyType_Base_Def_Per: + tmpHero.TalentProperty[cfg.GamePropertyType_Base_Def_Per] = 0 + tmpHero.TalentProperty[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Def_Base]))) + case cfg.GamePropertyType_Base_Speed_Per: + tmpHero.TalentProperty[cfg.GamePropertyType_Base_Speed_Per] = 0 + tmpHero.TalentProperty[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Speed_Base]))) + } + } + + // 属性汇总 + for k, v := range tmpHero.TalentProperty { + tmpHero.Property[k] += v + } + for k, v := range tmpHero.HoroscopeProperty { + tmpHero.Property[k] += v + } + for k, v := range tmpHero.JuexProperty { + tmpHero.Property[k] += v + } + for k, v := range tmpHero.AddProperty { + tmpHero.Property[k] += v + } + + // 算基础属性 + for k, v := range this.module.configure.GetGameFightingCapacityData() { + if _, ok := tmpHero.Property[k]; ok { + baseValue += tmpHero.Property[k] * v / 1000 + } + } + + for pos, v := range tmpHero.NormalSkill { + if skillpos, err = this.module.configure.GetGameFightingSkilllv(int32(pos + 1)); err == nil { + if skilllv, err = this.module.configure.GetGameFightingSkilllv(v.SkillLv); err == nil { + skillValue += skillpos.Value * skilllv.Value / 1000 + } else { + return + } + } else { + return + } + } + + // 乘以星级系数 + if skillStar, err = this.module.configure.GetGameFightingSkillStar(heroCfg.Star); err == nil { + skillValue = skillValue * skillStar.Value / 1000 + } + + hero.Fightvalue = skillValue + baseValue + addValue = hero.Fightvalue - preValue + return +} + //17 // 初始化英雄 func (this *ModelHero) InitHero(uid string, heroCfgId string) *pb.DBHero { @@ -64,8 +211,9 @@ func (this *ModelHero) InitHero(uid string, heroCfgId string) *pb.DBHero { HoroscopeProperty: make(map[int32]int32), Fetters: make(map[int32]int32), } - this.PropertyCompute(newHero) this.initHeroSkill(newHero) + this.PropertyCompute(newHero) + return newHero } @@ -216,6 +364,7 @@ func (this *ModelHero) resetJuexingProperty(hero *pb.DBHero) { } } } + } // 设置装备属性 @@ -340,7 +489,7 @@ func (this *ModelHero) PropertyCompute(hero *pb.DBHero) { starLvfg := this.module.configure.GetHeroLv(starCfg.Level) if growCfg == nil || heroCfg == nil || lvCfg == nil || starCfg == nil || starLvfg == nil { - this.module.Debugf("hero PropertyCompute Configure Info err:heroid :%s, herolv:=%d,heroStar:%d,", hero.HeroID, hero.Lv, hero.Star) + this.module.Debugf("hero propertyCompute Configure Info err:heroid :%s, herolv:=%d,heroStar:%d,", hero.HeroID, hero.Lv, hero.Star) return } @@ -371,24 +520,7 @@ func (this *ModelHero) PropertyCompute(hero *pb.DBHero) { this.module.moduleHoroscope.ComputeHeroNumeric(hero.Uid, hero) } this.resetJuexingProperty(hero) -} - -// 重新计算英雄属性 -func (this *ModelHero) ChangeHeroProperty(session comm.IUserSession, hero *pb.DBHero) (err error) { - this.PropertyCompute(hero) //重新计算 property 的值 - update := map[string]interface{}{ - "property": hero.Property, - "talentProperty": hero.TalentProperty, - "juexProperty": hero.JuexProperty, - "horoscopeProperty": hero.HoroscopeProperty, - } - - if err = this.ChangeList(session.GetUserId(), hero.Id, update); err != nil { - this.module.Errorf("ChangeHeroProperty err:%v", err) - return - } - - return + this.calFigthValue(hero) } func (this *ModelHero) cleanData(uid string) { @@ -534,6 +666,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero, update["horoscopeProperty"] = hero.HoroscopeProperty update["talentProperty"] = hero.TalentProperty update["juexProperty"] = hero.JuexProperty + update["fightvalue"] = hero.Fightvalue } changeupdate[hero.Id] = update @@ -675,8 +808,8 @@ func (this *ModelHero) InitMonsterHero(heroCfgId string, star, lv int32) *pb.DBH TalentProperty: make(map[int32]int32), HoroscopeProperty: make(map[int32]int32), } - this.PropertyCompute(newHero) this.initHeroSkill(newHero) + this.PropertyCompute(newHero) return newHero } @@ -695,6 +828,8 @@ func (this *ModelHero) setTalentProperty(hero *pb.DBHero, conf *cfg.GameHeroTale _heroMap := make(map[string]interface{}, 0) _heroMap["talentProperty"] = hero.TalentProperty + this.module.modelHero.calFigthValue(hero) + _heroMap["fightvalue"] = hero.Fightvalue if err := this.ChangeList(hero.Uid, hero.Id, _heroMap); err != nil { this.module.Errorf("mergeenegryProperty err %v", err) } diff --git a/modules/hero/module.go b/modules/hero/module.go index 5d676f01e..f44f98372 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -523,6 +523,7 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession) (errdata *pb.ErrorDat "juexProperty": hero.JuexProperty, "awakenskill": hero.Awakenskill, "talentskill": hero.Talentskill, + "fightvalue": hero.Fightvalue, } // 保存数据 diff --git a/pb/hero_db.pb.go b/pb/hero_db.pb.go index 2ab7b6b21..b1a75824a 100644 --- a/pb/hero_db.pb.go +++ b/pb/hero_db.pb.go @@ -100,6 +100,7 @@ type DBHero struct { Ispasson bool `protobuf:"varint,27,opt,name=ispasson,proto3" json:"ispasson"` //是否是传功学员 Awakenskill []*SkillData `protobuf:"bytes,28,rep,name=awakenskill,proto3" json:"awakenskill"` // 觉醒技能 Talentskill []*SkillData `protobuf:"bytes,29,rep,name=talentskill,proto3" json:"talentskill"` // 回响技能 + Fightvalue int32 `protobuf:"varint,30,opt,name=fightvalue,proto3" json:"fightvalue"` // 战力 } func (x *DBHero) Reset() { @@ -337,6 +338,13 @@ func (x *DBHero) GetTalentskill() []*SkillData { return nil } +func (x *DBHero) GetFightvalue() int32 { + if x != nil { + return x.Fightvalue + } + return 0 +} + //英雄扩展数据 type DBHeroRecord struct { state protoimpl.MessageState @@ -735,7 +743,7 @@ var file_hero_hero_db_proto_rawDesc = []byte{ 0x0a, 0x12, 0x68, 0x65, 0x72, 0x6f, 0x2f, 0x68, 0x65, 0x72, 0x6f, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x65, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x65, 0x71, 0x75, 0x69, - 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa2, + 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc2, 0x0b, 0x0a, 0x06, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, @@ -802,6 +810,8 @@ var file_hero_hero_db_proto_rawDesc = []byte{ 0x6c, 0x6c, 0x12, 0x2c, 0x0a, 0x0b, 0x74, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x18, 0x1d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0b, 0x74, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x73, 0x6b, 0x69, 0x6c, 0x6c, + 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x69, 0x67, 0x68, 0x74, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1e, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x66, 0x69, 0x67, 0x68, 0x74, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,