【新战力计算】 皮肤 和 灵兽

dev_chengFeng
zhangqiang 2021-01-26 13:44:11 +08:00
parent 6509e3c706
commit 38252f03ee
7 changed files with 110 additions and 11 deletions

View File

@ -587,4 +587,16 @@ function this.GetFormationElementAdd(type)
return propList return propList
end end
function this.GetCurIndexForMationNum(formationId)
local index = 0
if formationId and this.formationList[formationId] then
local team = this.formationList[formationId]
for j = 1, #team.teamHeroInfos do
if team.teamHeroInfos[j] then
index = index + 1
end
end
end
return index
end
return this return this

View File

@ -195,7 +195,9 @@ function this.ChangeSkinId(heroId,skinId)
heroDatas[heroId].painting = GetResourcePath(heroDatas[heroId].skinConfig.Painting) heroDatas[heroId].painting = GetResourcePath(heroDatas[heroId].skinConfig.Painting)
heroDatas[heroId].icon = GetResourcePath(heroDatas[heroId].skinConfig.Icon) heroDatas[heroId].icon = GetResourcePath(heroDatas[heroId].skinConfig.Icon)
heroDatas[heroId].scale = heroDatas[heroId].skinConfig.Scale heroDatas[heroId].scale = heroDatas[heroId].skinConfig.Scale
heroDatas[heroId].position = heroDatas[heroId].skinConfig.Position heroDatas[heroId].position = heroDatas[heroId].skinConfig.Position
--设置战斗力脏数据
HeroPropManager.SetDirtyByType(heroId, Hero_Prop_Type.SkinAdd)
end end
function this.SetHeroFormationList(heroDid,teamId,isAddOrDel) function this.SetHeroFormationList(heroDid,teamId,isAddOrDel)
@ -1775,9 +1777,8 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt
-- end -- end
-- end -- end
--end --end
--皮肤
local heroSkinSingleProVal, heroSkinAllHeroProVal = HeroSkinManager.CaculateSkinProVal(curHeroData.dynamicId) local heroSkinSingleProVal, heroSkinAllHeroProVal = HeroSkinManager.CaculateSkinProVal(curHeroData.dynamicId)
this.DoubleTableCompound(allAddProVal, heroSkinSingleProVal)
this.DoubleTableCompound(allAddProVal, heroSkinAllHeroProVal)
--灵兽 现在只在编队战力中计算 因为单个英雄可以上多个编队 --灵兽 现在只在编队战力中计算 因为单个英雄可以上多个编队
local pokemonFormationAllHeroProVal = {} local pokemonFormationAllHeroProVal = {}
@ -1814,6 +1815,8 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt
this.DoubleTableCompound(allAddProVal, heroSkillSingleHeroProVal) this.DoubleTableCompound(allAddProVal, heroSkillSingleHeroProVal)
this.DoubleTableCompound(allAddProVal, equipTreasureAddPro) this.DoubleTableCompound(allAddProVal, equipTreasureAddPro)
this.DoubleTableCompound(allAddProVal, vipAddPro) this.DoubleTableCompound(allAddProVal, vipAddPro)
this.DoubleTableCompound(allAddProVal, heroSkinSingleProVal)
this.DoubleTableCompound(allAddProVal, heroSkinAllHeroProVal)
--100等级所有属性合并 --100等级所有属性合并
this.DoubleTableCompound(lvProVal, falismanLvProVal) this.DoubleTableCompound(lvProVal, falismanLvProVal)
this.DoubleTableCompound(lvProVal,lvSoulPrintProVal) this.DoubleTableCompound(lvProVal,lvSoulPrintProVal)
@ -3123,6 +3126,7 @@ function this.CreateHeroCountData(dId)
star = 1, star = 1,
breakId = 1, breakId = 1,
upStarId = 1, upStarId = 1,
skinId = 0,
equipList = {}, equipList = {},
treasureList = {}, treasureList = {},
soulPrintList = {}, soulPrintList = {},
@ -3143,6 +3147,7 @@ function this.CreateHeroCountData(dId)
heroData.star = curHeroData.star -- 星级 heroData.star = curHeroData.star -- 星级
heroData.breakId = curHeroData.breakId -- 突破id heroData.breakId = curHeroData.breakId -- 突破id
heroData.upStarId = curHeroData.upStarId -- 升星id heroData.upStarId = curHeroData.upStarId -- 升星id
heroData.skinId = curHeroData.skinId -- 皮肤id
heroData.equipList = EquipManager.GetHeroEquipsBydIds(curHeroData.dynamicId, curHeroData.equipIdList) -- 装备数据 heroData.equipList = EquipManager.GetHeroEquipsBydIds(curHeroData.dynamicId, curHeroData.equipIdList) -- 装备数据
heroData.treasureList = EquipTreasureManager.GetTreasuresBydIds(curHeroData.jewels) -- 宝器数据 heroData.treasureList = EquipTreasureManager.GetTreasuresBydIds(curHeroData.jewels) -- 宝器数据
heroData.soulPrintList = curHeroData.soulPrintList -- 魂印数据 heroData.soulPrintList = curHeroData.soulPrintList -- 魂印数据
@ -3463,4 +3468,13 @@ function this.GetCurHeroEquipSuitPros(equipIdList)
-- end -- end
return equipSuit return equipSuit
end end
--设置英雄皮肤脏数据
function this.SetHerosSkinWarPowerState()
for i, v in pairs(heroDatas) do
if v.skinId ~= 0 then
--设置战斗力脏数据
HeroPropManager.SetDirtyByType(i, Hero_Prop_Type.SkinAdd)
end
end
end
return this return this

View File

@ -93,7 +93,7 @@ function this.GetHeroProp(dId, formationId)
-- 获取功能属性加成 -- 获取功能属性加成
local heroData = HeroManager.CreateHeroCountData(dId) local heroData = HeroManager.CreateHeroCountData(dId)
local funcProp = this.GetAllFuncProp(heroData) local funcProp = this.GetAllFuncProp(heroData,formationId)
Log_Prop("功能属性") Log_Prop("功能属性")
LogGreenTable_Prop(funcProp) LogGreenTable_Prop(funcProp)
DoubleTableCompound(allPropList, funcProp) DoubleTableCompound(allPropList, funcProp)
@ -471,7 +471,7 @@ function this.RefreshFuncProp()
end end
-- 获取功能属性加成 -- 获取功能属性加成
function this.GetFuncProp(heroData, funcPropId) function this.GetFuncProp(heroData, funcPropId,formationId)
-- 检测是否刷新 -- 检测是否刷新
this.RefreshFuncProp() this.RefreshFuncProp()
-- 获取活动数据 -- 获取活动数据
@ -480,20 +480,20 @@ function this.GetFuncProp(heroData, funcPropId)
if fData then if fData then
local filter = Func_Prop_Filter[funcPropId] local filter = Func_Prop_Filter[funcPropId]
if filter then if filter then
propList = filter(fData, heroData) propList = filter(fData, heroData,formationId)
end end
end end
return propList return propList
end end
-- 获取全部活动属性加成 -- 获取全部活动属性加成
function this.GetAllFuncProp(heroData) function this.GetAllFuncProp(heroData,formationId)
-- 检测是否刷新 -- 检测是否刷新
this.RefreshFuncProp() this.RefreshFuncProp()
-- --
local allPropList ={} local allPropList ={}
for _, funcPropId in pairs(Func_Prop_Type) do for _, funcPropId in pairs(Func_Prop_Type) do
local propList = this.GetFuncProp(heroData, funcPropId) local propList = this.GetFuncProp(heroData, funcPropId,formationId)
if propList then if propList then
DoubleTableCompound(allPropList, propList) DoubleTableCompound(allPropList, propList)
end end

View File

@ -27,6 +27,7 @@ function this.InitialSkin(msg,index)
this.skinDatas[msg.skinInfo.skinId].overTime = msg.skinInfo.overTime - PlayerManager.serverTime this.skinDatas[msg.skinInfo.skinId].overTime = msg.skinInfo.overTime - PlayerManager.serverTime
end end
this.UpdateSkinDatasOverTime() this.UpdateSkinDatasOverTime()
HeroManager.SetHerosSkinWarPowerState()
end end
function this.UpdateSkinDatasOverTime() function this.UpdateSkinDatasOverTime()

View File

@ -4,6 +4,8 @@ local HeroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
Func_Prop_Type = { Func_Prop_Type = {
Vip = 2, Vip = 2,
GuildSkill = 3, GuildSkill = 3,
Pokemon = 4,
PokemonFetter = 5
} }
-- 计算需要缓存数据的方法 -- 计算需要缓存数据的方法
@ -21,7 +23,20 @@ Func_Prop_Func = {
[Func_Prop_Type.Vip] = function() [Func_Prop_Type.Vip] = function()
local vipAddPro = VipManager.GetAddPro() local vipAddPro = VipManager.GetAddPro()
return vipAddPro return vipAddPro
end end,
-- 灵兽属性加成
[Func_Prop_Type.Pokemon] = function()
local allPro = PokemonManager.GetPokemonFormationAddPro()
for key, value in pairs(allPro) do
allPro[key] = value
end
return allPro
end,
-- 灵兽羁绊属性加成
[Func_Prop_Type.PokemonFetter] = function()
local allPro = PokemonManager.GetAllPokemonFetterAddPros()
return allPro
end,
} }
@ -35,5 +50,23 @@ Func_Prop_Filter = {
-- Vip属性加成 -- Vip属性加成
[Func_Prop_Type.Vip] = function(funcData, heroData) [Func_Prop_Type.Vip] = function(funcData, heroData)
return funcData return funcData
end end,
--灵兽属性加成
[Func_Prop_Type.Pokemon] = function(funcData, heroData,formationId)
local heroFormationNum = FormationManager.GetCurIndexForMationNum(formationId)
if heroFormationNum <= 0 then
return {}
end
local allPro = {}
for key, value in pairs(funcData) do
if value > 0 then
allPro[key] = math.floor(value/heroFormationNum)
end
end
return allPro
end,
--灵兽羁绊属性加成
[Func_Prop_Type.PokemonFetter] = function(funcData, heroData)
return funcData
end,
} }

View File

@ -452,6 +452,38 @@ Hero_Prop_Func = {
addAllProVal[HeroProType.WarPower] = allSoulPrintAddWarPowerVal addAllProVal[HeroProType.WarPower] = allSoulPrintAddWarPowerVal
return addAllProVal, conPropList, teamPropList, conTeamPropList, dePropList return addAllProVal, conPropList, teamPropList, conTeamPropList, dePropList
end, end,
-- 皮肤
[Hero_Prop_Type.SkinAdd] = function(_heroData)
local propList, conPropList, teamPropList, conTeamPropList, dePropList
local heroSkinSingleProVal = {}
local heroSkinAllHeroProVal = {}
if _heroData.skinId ~= 0 then
if HeroSkinManager.skinDatas[_heroData.skinId] and HeroSkinManager.skinDatas[_heroData.skinId].MonomerProperty and #HeroSkinManager.skinDatas[_heroData.skinId].MonomerProperty > 0 then
for _,v in ipairs(HeroSkinManager.skinDatas[_heroData.skinId].MonomerProperty) do
if not heroSkinSingleProVal[v[1]] then
heroSkinSingleProVal[v[1]] = 0
end
heroSkinSingleProVal[v[1]] = heroSkinSingleProVal[v[1]] + v[2]
end
end
end
for _,v in pairs(HeroSkinManager.skinDatas) do
if _heroData.skinId ~= v.id then
if HeroSkinManager.skinDatas[v.id] and HeroSkinManager.skinDatas[v.id].UnlockProperty and #HeroSkinManager.skinDatas[v.id].UnlockProperty > 0 then
for _,n in ipairs(HeroSkinManager.skinDatas[v.id].UnlockProperty) do
if not heroSkinAllHeroProVal[n[1]] then
heroSkinAllHeroProVal[n[1]] = 0
end
heroSkinAllHeroProVal[n[1]] = heroSkinAllHeroProVal[n[1]] + n[2]
end
end
end
end
propList = heroSkinSingleProVal
teamPropList = heroSkinAllHeroProVal
return propList, conPropList, teamPropList, conTeamPropList, dePropList
end,
} }

View File

@ -4450,6 +4450,8 @@ function this.UpPokemonLevelRequest(pokemonDId, upLv,oldLv, func)
if func then if func then
func(msg) func(msg)
end end
--设置战斗力脏数据
HeroPropManager.SetFuncPropDirty(Func_Prop_Type.Pokemon)
end) end)
end end
@ -4494,6 +4496,8 @@ function this.UpPokemonStarRequest(pokemonDId,curUpStarSelectPokemonData, func)
if func then if func then
func(msg) func(msg)
end end
--设置战斗力脏数据
HeroPropManager.SetFuncPropDirty(Func_Prop_Type.Pokemon)
end) end)
end end
@ -4583,6 +4587,8 @@ function this.ReplaceTeamPokemonInfoRequest(_teamPokemonInfos, func)
if func then if func then
func(msg) func(msg)
end end
--设置战斗力脏数据
HeroPropManager.SetFuncPropDirty(Func_Prop_Type.Pokemon)
end) end)
end end
@ -4621,7 +4627,8 @@ function this.PokemonBookEnableRequest(id,func)
Network:SendMessageWithCallBack(MessageTypeProto_pb.POKEMON_BOOK_ENABLE_REQUEST, MessageTypeProto_pb.POKEMON_BOOK_ENABLE_REPONSE, msg, function() Network:SendMessageWithCallBack(MessageTypeProto_pb.POKEMON_BOOK_ENABLE_REQUEST, MessageTypeProto_pb.POKEMON_BOOK_ENABLE_REPONSE, msg, function()
if func then if func then
func() func()
end end --设置战斗力脏数据
HeroPropManager.SetFuncPropDirty(Func_Prop_Type.PokemonFetter)
end) end)
end end
function this.XiaoyaoyouGetHeroRequest(id,func) function this.XiaoyaoyouGetHeroRequest(id,func)