miduo_client/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua

2133 lines
102 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

HeroManager = {}
local this = HeroManager
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local heroLevelConfig=ConfigManager.GetConfig(ConfigName.HeroLevelConfig)
local heroRankUpConfig=ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
local heroRankUpGroup=ConfigManager.GetConfig(ConfigName.HeroRankupGroup)
local skillConfig=ConfigManager.GetConfig(ConfigName.SkillConfig)
local passiveSkillConfig=ConfigManager.GetConfig(ConfigName.PassiveSkillConfig)
local passiveSkillLogicConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillLogicConfig)
local gameSetting=ConfigManager.GetConfig(ConfigName.GameSetting)
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
local equipConfig = ConfigManager.GetConfig(ConfigName.EquipConfig)
local equipsuite = ConfigManager.GetConfig(ConfigName.EquipSuiteConfig)
local jewelConfig = ConfigManager.GetConfig(ConfigName.JewelConfig)
local jewelRankupConfig = ConfigManager.GetConfig(ConfigName.JewelRankupConfig)
local jewelResonanceConfig = ConfigManager.GetConfig(ConfigName.JewelResonanceConfig)
local heroDatas = {}
this.heroDataLists = {}
this.heroLvEnd={}--3星=60,4=200,5=250 星级对应等级上限
--this.heroLvBreakNum={}--3星=9000,4=60000,5=60000 星级对应突破系数
this.heroPropertyScore={}--每个属性评分
this.heroPosCount=5
this.heroQuantityCount=6
this.heroProCount=6
--成员界面排序索引
this.heroListPanelSortID=1
this.heroListPanelProID=0
--穿脱装备界面临时数据
this.roleEquipPanelCurHeroData=nil
this.roleEquipPanelHeroListData=nil
this.allProVal = {}--临时计算英雄战力加成
this.heroResolveLicence = {}
--this.singleHeroProVal = {}--单体加成
--this.lvProVal = {}--单体等级限制加成
--this.allHeroProVal = {}--团体加成
--this.specialProVal = {}--减乘
function this.Initialize()
for i = 1, WarPowerTypeAllNum do
this.allProVal[i] = {singleHeroProVal = {},--单体加成
lvProVal = {},--单体等级限制加成
allHeroProVal = {},--团体加成
specialProVal = {},--减乘
}
end
end
--初始化英雄数据
function this.InitHeroData(_msgHeroList)
local hero_resolve_licence = string.split(ConfigManager.GetConfigData(ConfigName.SpecialConfig,36).Value,"#")
for i = 1, #hero_resolve_licence do
this.heroResolveLicence[tonumber(hero_resolve_licence[i])] = tonumber(hero_resolve_licence[i])
end
--Log("服务端推送英雄数量:" .. #_msgHeroList)
for i = 1, #_msgHeroList do
this.UpdateHeroDatas(_msgHeroList[i],false)
end
this.UpdateHeroLvEnd()--赋值每个星级的英雄等级上限
this.UpdateHeroPower()--赋值英雄战力
end
--刷新本地数据
function this.UpdateHeroDatas(_msgHeroData,isFindHandBook)
local heroData = {}
heroData.soulPrintList={}
heroData.heroBackData=_msgHeroData
heroData.dynamicId = _msgHeroData.id
local _id = _msgHeroData.heroId
heroData.id = _id
heroData.star = _msgHeroData.star
heroData.lv = _msgHeroData.level
heroData.breakId=_msgHeroData.breakId
heroData.upStarId=_msgHeroData.starBreakId
heroData.createTime=_msgHeroData.createTimelocal
heroData.lockState = _msgHeroData.lockState
local _configData = heroConfig[_id]
heroData.heroConfig=heroConfig[_id]
heroData.maxStar=_configData.MaxRank
--Log(heroData.heroConfig.ReadingName.." _msgHeroData.starBreakId ".._msgHeroData.starBreakId)
local actionPowerRormula= gameSetting[1].ActionPowerRormula
heroData.actionPower=heroData.heroConfig.ActionPower+math.floor(((actionPowerRormula[1] * math.pow(heroData.lv, 3) + actionPowerRormula[2] * math.pow(heroData.lv, 2) + actionPowerRormula[3] * heroData.lv + actionPowerRormula[4])))--_msgHeroData.actionPower
heroData.equipIdList=_msgHeroData.equipIdList
for i = 1, #_msgHeroData.jewels do
LogError("22222222222222")
LogError("_msgHeroData.jewels[i] ".._msgHeroData.jewels[i])
end
heroData.jewels=_msgHeroData.jewels
heroData.talismanList = _msgHeroData.especialEquipLevel --法宝等级
if(#_msgHeroData.soulPos>=1) then
local soulPrintList = {}
for i,v in ipairs(_msgHeroData.soulPos) do
local soulPrint = { equipId = v.equipId, position = v.position}
SoulPrintManager.AddSoulPrintUpHeroDynamicId(v.equipId,heroData.dynamicId)
table.insert(soulPrintList, soulPrint)
end
heroData.soulPrintList= soulPrintList
end
heroData.skillIdList={}--主动技
this.UpdateSkillIdList(heroData)
heroData.passiveSkillList = {}--被动技
this.UpdatePassiveHeroSkill(heroData)
heroData.hp = _configData.Hp
heroData.attack = _configData.Attack
heroData.pDef = _configData.PhysicalDefence
heroData.mDef = _configData.MagicDefence
heroData.speed = _configData.Speed
heroData.live = GetResourcePath(_configData.Live)
heroData.profession = _configData.Profession
heroData.ProfessionResourceId= _configData.ProfessionResourceId
if GetJobSpriteStrByJobNum(_configData.Profession) then
heroData.professionIcon = GetJobSpriteStrByJobNum(_configData.Profession)
else
heroData.professionIcon = GetJobSpriteStrByJobNum(1)
end
heroData.name = _configData.ReadingName
heroData.painting = GetResourcePath(_configData.Painting)
heroData.icon = GetResourcePath(_configData.Icon)
heroData.scale = _configData.Scale
heroData.position = _configData.Position
heroData.property = _configData.PropertyName
heroData.sortId = #heroDatas+1
table.insert(this.heroDataLists, heroData)
heroDatas[heroData.dynamicId]= heroData
this.SetEquipUpHeroDid(heroData.equipIdList,heroData.dynamicId)
this.SetEquipTreasureUpHeroDid(heroData.jewels,heroData.dynamicId)
this.SetTalismanLv(heroData.dynamicId,heroData.talismanList)
--this.SetSoulPrintUpHeroDid(heroData.soulPrintList,heroData.dynamicId)
this.GetSingleProScoreVal()
isFindHandBook = isFindHandBook or true
if isFindHandBook then--图鉴
PlayerManager.SetHeroHandBookListData(heroData.id)
end
--远征初始化血量
--ExpeditionManager.InitHeroHpValue(heroData)
end
function this.SetEquipUpHeroDid(_equipDids,_heroDid)
for i = 1, #_equipDids do
EquipManager.SetEquipUpHeroDid(_equipDids[i],_heroDid)
end
end
function this.SetEquipTreasureUpHeroDid(_equipTreasureDids,_heroDid)
for i = 1, #_equipTreasureDids do
EquipTreasureManager.SetEquipTreasureUpHeroDid(_equipTreasureDids[i],_heroDid)
end
end
--设置法宝等级
function this.SetTalismanLv(did,lv)
heroDatas[did].talismanList=lv
end
function this.GetTalismanLv(did)
if heroDatas[did] then
return heroDatas[did].talismanList
end
end
--设置已穿戴魂印数据
function this.SetSoulPrintUpHeroDid(soulPos,_heroDid)
if(soulPos) then
SoulPrintManager.SetSoulPrintUpHeroDid(soulPos,_heroDid)
end
end
--获取所有英雄信息
function this.GetAllHeroDatas(_lvLimit)
local lvLimit = 0
local allUpZhenHeroList = FormationManager.GetWuJinFormationHeroIds(FormationTypeDef.FORMATION_ENDLESS_MAP)
if _lvLimit then lvLimit = _lvLimit end
local heros = {}
for i, v in pairs(heroDatas) do
if v.lv >= lvLimit or allUpZhenHeroList[v.dynamicId] then
table.insert(heros,v)
end
end
table.sort(heros, function(a,b) return a.sortId < b.sortId end)
return heros
end
--获取该静态id sortid最小的英雄信息
function this.GetHeroDataByHeroSIdAndMinSortId(_heroSId)
local heroData = {}
local formationList = FormationManager.GetAllFormationHeroId()
for i, v in pairs(formationList) do
if heroDatas[i] then
local curData = heroDatas[i]
if curData.id == _heroSId then
if heroData and heroData.id then
if curData.sortId < heroData.sortId then
heroData = curData
end
else
heroData = curData
end
end
end
end
if heroData and heroData.id then
return heroData
end
for i, v in pairs(heroDatas) do
if v.id == _heroSId then
if heroData and heroData.id then
if v.sortId < heroData.sortId then
heroData = v
end
else
heroData = v
end
end
end
return heroData
end
--获取所有英雄信息(分解 回溯用
function this.GetAllHeroDataMsinusUpWar(_sortTypeId)--0全部 1-6属性 7-9 3、4、5星
local heros = {}
local heros2 = {}
for i, v in pairs(heroDatas) do
v.isFormation = ""
table.insert(heros,v)
end
--标记编队上的英雄
if heros and LengthOfTable(heros)>0 then
for i, v in pairs(heros) do
local isFormations = {}
for n,w in pairs(FormationManager.formationList) do
for m = 1, #w.teamHeroInfos do
if v.dynamicId==w.teamHeroInfos[m].heroId then
local isFormationStr = ""
local curFormationId = 0
if heros[i].isFormation and heros[i].isFormation == "" then
isFormationStr,curFormationId = this.GetHeroFormationStr2(n)
table.insert(isFormations,curFormationId)
else
isFormationStr ,curFormationId= ""..this.GetHeroFormationStr2(n)
table.insert(isFormations,curFormationId)
end
heros[i].isFormation = heros[i].isFormation ..isFormationStr
end
end
end
heros[i].isFormations = isFormations
end
end
--筛选
if heros and LengthOfTable(heros)>0 then
for i, v in pairs(heros) do
if _sortTypeId ==0 then
table.insert(heros2,v)
elseif _sortTypeId>=7 then
if v.star==_sortTypeId-4 then
table.insert(heros2,v)
end
else
if v.property==_sortTypeId then
table.insert(heros2,v)
end
end
end
end
return heros2
end
function this.GetHeroFormationStr(teamId)
if this.heroResolveLicence[teamId] then
if teamId < FormationTypeDef.FORMATION_ARENA_DEFEND then
return "该猎妖师在主线阵容中已上阵"
elseif teamId == FormationTypeDef.FORMATION_ARENA_DEFEND then
return "该猎妖师在竞技场防守阵容中已上阵"-- 101
elseif teamId == FormationTypeDef.FORMATION_ARENA_ATTACK then
return "该猎妖师在竞技场进攻阵容中已上阵"-- 201
elseif teamId == FormationTypeDef.FORMATION_ENDLESS_MAP then
return "该猎妖师在无尽副本阵容中已上阵"-- 401
elseif teamId == FormationTypeDef.FORMATION_GUILD_FIGHT_DEFEND then
return "该猎妖师在公会战防守阵容中已上阵"-- 501
elseif teamId == FormationTypeDef.FORMATION_GUILD_FIGHT_ATTACK then
return "该猎妖师在公会战进攻阵容中已上阵"-- 502
-- elseif teamId == FormationTypeDef.MONSTER_CAMP_ATTACK then
-- return "该猎妖师在锁妖阵容中已上阵"-- 601
elseif teamId == FormationTypeDef.BLOODY_BATTLE_ATTACK then
return "该猎妖师在血战出征阵容中已上阵"-- 701
elseif teamId == FormationTypeDef.EXPEDITION then
return "该猎妖师在猎妖之路阵容中已上阵"-- 1001
end
end
return ""
end
function this.GetHeroFormationStr2(teamId)
if this.heroResolveLicence[teamId] then
if teamId < FormationTypeDef.FORMATION_ARENA_DEFEND then
return "主线",FormationTypeDef.FORMATION_NORMAL
elseif teamId == FormationTypeDef.FORMATION_ARENA_DEFEND then
return "竞技场防守",FormationTypeDef.FORMATION_ARENA_DEFEND
elseif teamId == FormationTypeDef.FORMATION_ARENA_ATTACK then
return "竞技场进攻",FormationTypeDef.FORMATION_ARENA_ATTACK
elseif teamId == FormationTypeDef.FORMATION_ENDLESS_MAP then
return "无尽副本",FormationTypeDef.FORMATION_ENDLESS_MAP
elseif teamId == FormationTypeDef.FORMATION_GUILD_FIGHT_DEFEND then
return "公会战防守",FormationTypeDef.FORMATION_GUILD_FIGHT_DEFEND
elseif teamId == FormationTypeDef.FORMATION_GUILD_FIGHT_ATTACK then
return "公会战进攻",FormationTypeDef.FORMATION_GUILD_FIGHT_ATTACK
elseif teamId == FormationTypeDef.BLOODY_BATTLE_ATTACK then
return "血战出征",FormationTypeDef.BLOODY_BATTLE_ATTACK
elseif teamId == FormationTypeDef.EXPEDITION then
return "猎妖之路",FormationTypeDef.EXPEDITION
end
end
return ""
end
--删除本地英雄信息
function this.DeleteHeroDatas(heroDIds)
for i = 1, #heroDIds do
if heroDatas[heroDIds[i]] then
--清除英雄装备上挂载的英雄did
local equips=heroDatas[heroDIds[i]].equipIdList
if equips and LengthOfTable(equips)>0 then
for i = 1, LengthOfTable(equips) do
if EquipManager.equipDatas[equips[i]] then
EquipManager.equipDatas[equips[i]].upHeroDid="0"
end
end
end
--清除英雄法宝上挂载的英雄did
--local talismanList=heroDatas[heroDIds[i]].talismanList
--if talismanList and LengthOfTable(talismanList)>0 then
-- for i = 1, LengthOfTable(talismanList) do
-- if TalismanManager.talismanTabs[talismanList[i]] then
-- TalismanManager.talismanTabs[talismanList[i]].upHeroDid="0"
-- end
-- end
--end
--
--清楚编队上的英雄
FormationManager.AllFormationDeleCurHeroId(heroDIds[i])
--清除英雄魂印上挂载的英雄did
SoulPrintManager.hasEquipSoulPrintId[heroDIds[i]]=nil
--删除远征英雄数据
ExpeditionManager.DelHeroHpValue(heroDatas[heroDIds[i]])
--删除英雄
heroDatas[heroDIds[i]]=nil
end
end
end
--更新本地单个英雄基本信息
function this.UpdateSingleHeroDatas(heroDId,heroLv,heroStar,breakId,upStarId,isCallBackChangeWar)
if heroDatas[heroDId] then
heroDatas[heroDId].lv=heroLv
heroDatas[heroDId].star=heroStar
heroDatas[heroDId].breakId=breakId
heroDatas[heroDId].upStarId=upStarId
local actionPowerRormula= gameSetting[1].ActionPowerRormula
heroDatas[heroDId].actionPower=heroDatas[heroDId].heroConfig.ActionPower+math.floor(((actionPowerRormula[1] * math.pow(heroLv, 3) + actionPowerRormula[2] * math.pow(heroLv, 2) + actionPowerRormula[3] * heroLv + actionPowerRormula[4])))
end
if isCallBackChangeWar then
this.CompareWarPower(heroDId)
end
end
--更新本地单个英雄上锁
function this.UpdateSingleHeroLockState(heroDId,lockState)
if heroDatas[heroDId] then
heroDatas[heroDId].lockState=lockState
end
end
--对比战力并更新战力值
function this.CompareWarPower(heroDId)
local oldWarPowerValue = heroDatas[heroDId].warPower
local newWarPowerValue = this.CalculateHeroAllProValList(1,heroDId,false)[HeroProType.WarPower]
heroDatas[heroDId].warPower = newWarPowerValue
if oldWarPowerValue and newWarPowerValue then
if oldWarPowerValue ~= newWarPowerValue then
if not UIManager.IsOpen(UIName.RoleUpStarSuccessPanel) and not UIManager.IsOpen(UIName.RoleUpLvBreakSuccessPanel) then
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldWarPowerValue,newValue = newWarPowerValue})
end
end
end
FormationManager.CheckHeroIdExist(heroDId)
end
--更新本地单个英雄技能信息
function this.UpdateSingleHeroSkillData(_heroDId)
if heroDatas[_heroDId] then
--local herodata=heroDatas[_heroDId]
--local skillIdList={}
--for i = 1, #herodata.heroConfig.OpenSkillRules do
-- if herodata.heroConfig.OpenSkillRules[i][1]==herodata.star then
-- --skillIdList[i]=herodata.heroConfig.OpenSkillRules[i][2]
-- table.insert(skillIdList,herodata.heroConfig.OpenSkillRules[i][2])
-- end
--end
--herodata.skillIdList={}
--for i = 1, #skillIdList do
-- local heroSkill={}
-- heroSkill.skillId=skillIdList[i]
-- heroSkill.skillConfig=skillConfig[skillIdList[i]]
-- table.insert( herodata.skillIdList,heroSkill)
--end
--heroDatas[_heroDId]=herodata
local heroData=heroDatas[_heroDId]
heroData.skillIdList={}--主动技
if heroData.heroConfig.OpenSkillRules then
for i = 1, #heroData.heroConfig.OpenSkillRules do
if heroData.heroConfig.OpenSkillRules[i][1] == heroData.star then
local heroSkill={}
heroSkill.skillId=heroData.heroConfig.OpenSkillRules[i][2]
heroSkill.skillConfig=skillConfig[heroSkill.skillId]
table.insert(heroData.skillIdList,heroSkill)
end
end
end
heroData.passiveSkillList = {}--被动技
if heroData.heroConfig.OpenPassiveSkillRules then
for i = 1, #heroData.heroConfig.OpenPassiveSkillRules do
if heroData.heroConfig.OpenPassiveSkillRules[i][1] == heroData.star then
local heroSkill={}
heroSkill.skillId=heroData.heroConfig.OpenPassiveSkillRules[i][2]
heroSkill.skillConfig=passiveSkillConfig[heroSkill.skillId]
table.insert(heroData.passiveSkillList,heroSkill)
end
end
end
end
end
--更新本地单个英雄法宝信息
function this.UpdateHeroSingleTalismanData(heroDId,heroTalismanDatas,type)--type--1 穿单件法宝 2 卸单件法宝
if heroDatas[heroDId] then
if type == 1 then
heroDatas[heroDId].talismanList = {}
for i = 1, #heroTalismanDatas do
table.insert(heroDatas[heroDId].talismanList,heroTalismanDatas[i])
end
elseif type == 2 then
for i = 1, #heroDatas[heroDId].talismanList do
for j = 1, #heroTalismanDatas do
if heroDatas[heroDId].talismanList[i] == heroTalismanDatas[j] then
heroDatas[heroDId].talismanList[i] = nil
end
end
end
end
end
this.CompareWarPower(heroDId)
end
--更新本地单个英雄魂印信息
function this.UpdateHeroSingleSoulPrint(heroDId,hasEquipSoulPrintId)
local soulEquipPrintList = {}
for i,v in pairs(hasEquipSoulPrintId[heroDId]) do
local soulPrint = { did = v.did, pos = v.pos}
table.insert(soulEquipPrintList, soulPrint)
end
heroDatas[heroDId].soulPrintList=soulEquipPrintList
this.CompareWarPower(heroDId)
end
--获取单个英雄数据
function this.GetSingleHeroData(heroDId)
return heroDatas[heroDId]
end
--获取当前升星信息
function this.GetHeroCurUpStarInfo(heroDId)
local indexStar=0
local RankupConsumeMaterial={}
for i,v in pairs(heroDatas) do
if v.dynamicId==heroDId then
if v.heroConfig.RankupConsumeMaterial then
for j = 1, #v.heroConfig.RankupConsumeMaterial do
if #v.heroConfig.RankupConsumeMaterial[j]>1 then
if v.heroConfig.RankupConsumeMaterial[j][1]>v.star then
if indexStar==0 then
indexStar=v.heroConfig.RankupConsumeMaterial[j][1]
end
if v.heroConfig.RankupConsumeMaterial[j][1]==indexStar then
local heroUpStarMaterialsData ={}
heroUpStarMaterialsData.upStarData=v.heroConfig.RankupConsumeMaterial[j]
heroUpStarMaterialsData.upStarMaterialsData=heroRankUpGroup[v.heroConfig.RankupConsumeMaterial[j][3]]
table.insert(RankupConsumeMaterial,heroUpStarMaterialsData)
end
end
else
return nil
end
end
end
end
end
return RankupConsumeMaterial
end
--检测卡库中的英雄是否有满足当前升星条件
function this.GetUpStarHeroListData(heroRankUpGroupId,heroData)
local needHeroListData={}
needHeroListData.state=0--0 没有 1 有满足条件单位英雄
needHeroListData.heroList={}
local heroRankUpGroup = heroRankUpGroup[heroRankUpGroupId]
for i, v in pairs(heroDatas) do
if v.dynamicId==heroData.dynamicId then--自己筛掉
else
v.isFormation = ""
if heroRankUpGroup.Issame==1 then--需要同名卡
if v.id==heroData.id then
if v.star==heroRankUpGroup.StarLimit then
if heroRankUpGroup.IsSameClan==1 then
if v.property==heroData.property then
if heroRankUpGroup.IsId>0 then
if v.id==heroRankUpGroup.IsId then
table.insert(needHeroListData.heroList,v)
end
else
table.insert(needHeroListData.heroList,v)
end
end
else
if heroRankUpGroup.IsId>0 then
if v.id==heroRankUpGroup.IsId then
table.insert(needHeroListData.heroList,v)
end
else
table.insert(needHeroListData.heroList,v)
end
end
end
end
else
if v.star==heroRankUpGroup.StarLimit then
if heroRankUpGroup.IsSameClan==1 then
if v.property==heroData.property then
if heroRankUpGroup.IsId>0 then
if v.id==heroRankUpGroup.IsId then
table.insert(needHeroListData.heroList,v)
end
else
table.insert(needHeroListData.heroList,v)
end
end
else
if heroRankUpGroup.IsId>0 then
if v.id==heroRankUpGroup.IsId then
table.insert(needHeroListData.heroList,v)
end
else
table.insert(needHeroListData.heroList,v)
end
end
end
end
end
end
--删除编队上的英雄
if needHeroListData.heroList and LengthOfTable(needHeroListData.heroList)>0 then
for i, v in pairs(needHeroListData.heroList) do
for n,w in pairs(FormationManager.formationList) do
if this.heroResolveLicence[n] then
for m = 1, #w.teamHeroInfos do
if v.dynamicId==w.teamHeroInfos[m].heroId then
local isFormationStr = this.GetHeroFormationStr(n)
v.isFormation = isFormationStr
end
end
end
end
end
end
--删除冒险上的英雄
--if needHeroListData.heroList and LengthOfTable(needHeroListData.heroList)>0 then
-- for i, v in pairs(needHeroListData.heroList) do
-- for n,w in pairs(AdventureManager.heroList) do
-- for m = 1, #w do
-- if v.dynamicId==w[m] then
-- needHeroListData.heroList[i] = nil
-- end
-- end
-- end
-- end
--end
local needHeroListData2={}
needHeroListData2.state=0--0 没有 1 有满足条件单位英雄
needHeroListData2.heroList={}
for i, v in pairs(needHeroListData.heroList) do
table.insert(needHeroListData2.heroList,v)
end
if #needHeroListData2.heroList>0 then
needHeroListData2.state=1
end
table.sort(needHeroListData2, function(a, b)
if a.id == b.id then
if a.lv == b.lv then
return a.id > b.id
else
return a.lv < b.lv
end
else
return a.id > b.id
end
end)
return needHeroListData2
end
--计算每个星级的英雄等级最终上限
function this.UpdateHeroLvEnd()
--计算每个最终等级上限
this.heroLvEnd={}
for i,v in ConfigPairs(heroConfig) do
local heroEndStar= v.Star
if v.RankupConsumeMaterial then
local curRankupConsumeMaterial= v.RankupConsumeMaterial[#v.RankupConsumeMaterial]
if curRankupConsumeMaterial then
heroEndStar = curRankupConsumeMaterial[1]
end
end
if heroEndStar==nil then
heroEndStar= v.Star
end
for i, v2 in ConfigPairs(heroRankUpConfig) do
if v2.Star== v.Star then
if v2.OpenStar==heroEndStar then
this.heroLvEnd[v.Id]= v2.OpenLevel
end
end
end
end
--local threeStarLvEnd=3
--local fourStarLvEnd=4
--local fiveStarLvEnd=5
--this.heroLvBreakNum[threeStarLvEnd]=0
--this.heroLvBreakNum[fourStarLvEnd]=0
--this.heroLvBreakNum[fiveStarLvEnd]=0
--
--for i,v in ConfigPairs(heroRankUpConfig) do
-- if v.Star==threeStarLvEnd then
-- if v.Type==1 and this.heroLvBreakNum[threeStarLvEnd]<v.RankupPara then
-- this.heroLvBreakNum[threeStarLvEnd]=v.RankupPara
-- end
-- elseif v.Star==fourStarLvEnd then
-- if v.Type==1 and this.heroLvBreakNum[fourStarLvEnd]<v.RankupPara then
-- this.heroLvBreakNum[fourStarLvEnd]=v.RankupPara
-- end
-- elseif v.Star==fiveStarLvEnd then
-- if v.Type==1 and this.heroLvBreakNum[fiveStarLvEnd]<v.RankupPara then
-- this.heroLvBreakNum[fiveStarLvEnd]=v.RankupPara
-- end
-- end
--end
end
--计算英雄当前星级的等级上限
function this.GetCurHeroStarLvEnd(getValType,curHeroData,_breakId,_upStarId)
local breakId = 0
local upStarId = 0
if getValType == 1 then
breakId = curHeroData.breakId
upStarId = curHeroData.upStarId
else
breakId = _breakId
upStarId = _upStarId
end
if breakId == 0 then--从没突破过 显示当前初始星级的等级上限
for i,v in ConfigPairs(heroRankUpConfig) do
if v.Star==curHeroData.heroConfig.Star then
return v.LimitLevel
end
end
elseif breakId > 0 and heroRankUpConfig[breakId].JudgeClass ~= 1 then--没突破完毕 显示当前突破的等级上限
return heroRankUpConfig[breakId].OpenLevel
elseif breakId > 0 and heroRankUpConfig[breakId].JudgeClass == 1 then--突破完毕 显示当前进阶的等级上限
if upStarId > 0 then
return heroRankUpConfig[upStarId].OpenLevel
else
return heroRankUpConfig[breakId].OpenLevel
end
end
end
function this.UpdateHeroPower()
for _, v in pairs(heroDatas) do
v.warPower = this.CalculateHeroAllProValList(1,v.dynamicId,false)[HeroProType.WarPower]
end
end
--获取同一类型的技能
function this.GetTypeAllSkillData(_skillName)
local allTypeSkillData={}
for i,v in ConfigPairs(skillConfig) do
if v.Name==_skillName then
table.insert(allTypeSkillData, v)
end
end
return allTypeSkillData
end
--获得英雄属性计算战斗力属性评分
function this.GetSingleProScoreVal()
this.heroPropertyScore={}
for i, v in ConfigPairs(propertyConfig) do
this.heroPropertyScore[i]=v.Score
end
end
--计算所有装备加成的属性值
local function CalculateHeroUpEquipsProAddVal(_heroId)
local addAllProVal = {}
for i, v in ConfigPairs(propertyConfig) do
addAllProVal[i] = 0
end
local curHeroData = HeroManager.GetSingleHeroData(_heroId)
if curHeroData then
--Log("#curHeroData.equipIdList "..#curHeroData.equipIdList)
local equipSuit = {}--[id] = 件数
for i = 1, #curHeroData.equipIdList do
local curEquip = EquipManager.equipDatas[curHeroData.equipIdList[i]]
if curEquip then
if addAllProVal[curEquip.mainAttribute.propertyId] then
addAllProVal[curEquip.mainAttribute.propertyId] = addAllProVal[curEquip.mainAttribute.propertyId] + curEquip.mainAttribute.propertyValue
else
addAllProVal[curEquip.mainAttribute.propertyId] = curEquip.mainAttribute.propertyValue
end
--for j = 1, #curEquip.secondAttribute do
-- if addAllProVal[curEquip.secondAttribute[j].propertyId] then
-- addAllProVal[curEquip.secondAttribute[j].propertyId] = addAllProVal[curEquip.secondAttribute[j].propertyId] + curEquip.secondAttribute[j].propertyValue
-- else
-- addAllProVal[curEquip.secondAttribute[j].propertyId] = curEquip.secondAttribute[j].propertyValue
-- end
--end
--套装加成
if equipSuit[curEquip.equipConfig.SuiteID] then
equipSuit[curEquip.equipConfig.SuiteID] = equipSuit[curEquip.equipConfig.SuiteID] + 1
else
equipSuit[curEquip.equipConfig.SuiteID] = 1
end
end
end
if equipSuit and LengthOfTable(equipSuit) > 0 then
for i, v in pairs(equipSuit) do
local curSuitConfig = equipsuite[i]
if v > 1 then
if curSuitConfig and curSuitConfig.SuiteValue then
for j = 1, #curSuitConfig.SuiteValue do
if v >= curSuitConfig.SuiteValue[j][1] then
local curProId = curSuitConfig.SuiteValue[j][2]
local curProVal = curSuitConfig.SuiteValue[j][3]
--LogError("套装激活 "..i .." "..v.." curProId "..curProId .." "..curProVal)
if addAllProVal[curProId] then
addAllProVal[curProId] = addAllProVal[curProId] + curProVal
else
addAllProVal[curProId] = curProVal
end
end
end
end
end
end
end
end
return addAllProVal
end
--计算所有法宝加成的属性值
local function CalculateHeroUpTalismanProAddVal(_heroId,_breakId,_upStarId)
local addAllProVal = {}
local singleHeroProVal,lvProVal,allHeroProVal,specialProVal
local curHeroData = HeroManager.GetSingleHeroData(_heroId)
if curHeroData and curHeroData.heroConfig.EquipTalismana then
local star = curHeroData.star
if heroRankUpConfig[_upStarId] then
star = heroRankUpConfig[_upStarId].OpenStar
end
if star >= curHeroData.heroConfig.EquipTalismana[1] then
local curTalisman = ConfigManager.GetConfigData(ConfigName.HeroConfig,curHeroData.id).EquipTalismana
if curTalisman and curTalisman[2] then
local talismanConFig = ConfigManager.GetConfigDataByDoubleKey(ConfigName.EquipTalismana, "TalismanaId", curTalisman[2],
"Level", curHeroData.talismanList)
if talismanConFig then
--主属性
for j = 1, #talismanConFig.Property do
if addAllProVal[talismanConFig.Property[j][1]] then
addAllProVal[talismanConFig.Property[j][1]] = addAllProVal[talismanConFig.Property[j][1]] + talismanConFig.Property[j][2]
else
addAllProVal[talismanConFig.Property[j][1]] = talismanConFig.Property[j][2]
end
end
--副属性
if talismanConFig.SpecialProperty and #talismanConFig.SpecialProperty > 0 then
for k = 1, #talismanConFig.SpecialProperty do
if talismanConFig.SpecialProperty[k][1] == curHeroData.profession then
if addAllProVal[talismanConFig.SpecialProperty[k][2]] then
addAllProVal[talismanConFig.SpecialProperty[k][2]] = addAllProVal[talismanConFig.SpecialProperty[k][2]] + talismanConFig.SpecialProperty[k][3]
else
addAllProVal[talismanConFig.SpecialProperty[k][2]] = talismanConFig.SpecialProperty[k][3]
end
end
end
end
--当前法宝全部天赋数据(天赋可能为空)
local dowerAllData = ConfigManager.GetAllConfigsDataByKey(ConfigName.EquipTalismana,"TalismanaId",curTalisman[2])
local skillIds = {}
--LogError("当前法宝全部天赋数据 "..curTalisman[2].." "..#dowerAllData.." "..curHeroData.talismanList)
for i = 1, #dowerAllData do
if dowerAllData[i].OpenSkillRules and curHeroData.talismanList >= dowerAllData[i].Level then
for k = 1, #dowerAllData[i].OpenSkillRules do
--LogError("dowerAllData[i].OpenSkillRules[k] "..dowerAllData[i].OpenSkillRules[k])
table.insert(skillIds,dowerAllData[i].OpenSkillRules[k])
end
end
end
--被动技能计算
if skillIds and #skillIds > 0 then --talismanConFig.OpenSkillRules and #talismanConFig.OpenSkillRules > 0 then
--单体加成 --单体等级限制加成 --团体加成 --减乘
singleHeroProVal,lvProVal,allHeroProVal,specialProVal = this.CalculatePassiveSkillsValList(WarPowerType.Talisman,skillIds)
end
end
end
end
end
if singleHeroProVal and LengthOfTable(singleHeroProVal) > 0 then
for i,v in pairs(singleHeroProVal) do
if addAllProVal[i] then
addAllProVal[i] = addAllProVal[i] + v
else
addAllProVal[i] = v
end
end
end
return addAllProVal,lvProVal,allHeroProVal,specialProVal
end
--英雄身上魂印属性计算
local function CalculateSoulPrintAddVal(_heroId)
local addAllProVal = {}
local singleHeroProVal,lvProVal,allHeroProVal,specialProVal
local curHeroData = HeroManager.GetSingleHeroData(_heroId)
if curHeroData then
if(table.nums(curHeroData.soulPrintList) >= 1) then
for i = 1, #curHeroData.soulPrintList do
local cursoulPrintConfig = equipConfig[curHeroData.soulPrintList[i].equipId]
if cursoulPrintConfig then
--基础属性计算
local soulPrintPropertyList = cursoulPrintConfig.Property
if soulPrintPropertyList and #soulPrintPropertyList > 0 then
for i,v in pairs(soulPrintPropertyList) do
if(addAllProVal[v[1]]) then
addAllProVal[v[1]]=v[2]+addAllProVal[v[1]]
else
addAllProVal[v[1]]=v[2]
end
end
end
--被动技能计算
if cursoulPrintConfig.PassiveSkill and cursoulPrintConfig.PassiveSkill > 0 then
--单体加成 --单体等级限制加成 --团体加成 --减乘
singleHeroProVal,lvProVal,allHeroProVal,specialProVal = this.CalculatePassiveSkillsValList(WarPowerType.SoulPrint,{cursoulPrintConfig.PassiveSkill})
end
end
end
end
end
if singleHeroProVal and LengthOfTable(singleHeroProVal) > 0 then
for i,v in pairs(singleHeroProVal) do
if addAllProVal[i] then
addAllProVal[i] = addAllProVal[i] + v
else
addAllProVal[i] = v
end
end
end
return addAllProVal,lvProVal,allHeroProVal,specialProVal
end
--英雄身上宝器属性计算
local function CalculateEquipTreaSureAddVal(_heroId)
local addAllProVal = {}
local minLv
local mainRefineLv
local curHeroData = HeroManager.GetSingleHeroData(_heroId)
if curHeroData then
if #curHeroData.jewels > 0 then
for i = 1, #curHeroData.jewels do
local did = curHeroData.jewels[i]
local curEuipTreaSureData = EquipTreasureManager.GetSingleTreasureByIdDyn(did)
local curEuipTreaSureConfig = jewelConfig[curEuipTreaSureData.id]
for _, configInfo in ConfigPairs(jewelRankupConfig) do
--强化的属性
if configInfo.PoolID == curEuipTreaSureConfig.LevelupPool and configInfo.Type == 1 and configInfo.Level == curEuipTreaSureData.lv then
for j = 1, #configInfo.Property do
if addAllProVal[configInfo.Property[j][1]] then
addAllProVal[configInfo.Property[j][1]] = addAllProVal[configInfo.Property[j][1]] + configInfo.Property[j][2]
else
addAllProVal[configInfo.Property[j][1]] = configInfo.Property[j][2]
end
end
end
--精炼的属性
if configInfo.PoolID == curEuipTreaSureConfig.RankupPool and configInfo.Type == 2 and configInfo.Level == curEuipTreaSureData.refineLv then
for j = 1, #configInfo.Property do
if addAllProVal[configInfo.Property[j][1]] then
addAllProVal[configInfo.Property[j][1]] = addAllProVal[configInfo.Property[j][1]] + configInfo.Property[j][2]
else
addAllProVal[configInfo.Property[j][1]] = configInfo.Property[j][2]
end
end
end
end
if #curHeroData.jewels > 1 then
--取 强化 精炼 最小值
if minLv then
if curEuipTreaSureData.lv < minLv then
minLv = curEuipTreaSureData.lv
end
else
minLv = curEuipTreaSureData.lv
end
if mainRefineLv then
if curEuipTreaSureData.refineLv < mainRefineLv then
mainRefineLv = curEuipTreaSureData.refineLv
end
else
mainRefineLv = curEuipTreaSureData.refineLv
end
end
end
--math.min()
--取 强化 精炼 共鸣属性
if #curHeroData.jewels > 1 then
local lvjewelResonanceConfig
local refineLvjewelResonanceConfig
for _, curjewelResonanceConfig in ConfigPairs(jewelResonanceConfig) do
if lvjewelResonanceConfig then
if curjewelResonanceConfig.Type == 1 and curjewelResonanceConfig.Level <= minLv and curjewelResonanceConfig.Id > lvjewelResonanceConfig.Id then
lvjewelResonanceConfig = curjewelResonanceConfig
end
else
if curjewelResonanceConfig.Type == 1 and curjewelResonanceConfig.Level <= minLv then
lvjewelResonanceConfig = curjewelResonanceConfig
end
end
if refineLvjewelResonanceConfig then
if curjewelResonanceConfig.Type == 2 and curjewelResonanceConfig.Level <= mainRefineLv and curjewelResonanceConfig.Id > refineLvjewelResonanceConfig.Id then
refineLvjewelResonanceConfig = curjewelResonanceConfig
end
else
if curjewelResonanceConfig.Type == 2 and curjewelResonanceConfig.Level <= mainRefineLv then
refineLvjewelResonanceConfig = curjewelResonanceConfig
end
end
end
--
if lvjewelResonanceConfig then
for j = 1, #lvjewelResonanceConfig.Property do
if addAllProVal[lvjewelResonanceConfig.Property[j][1]] then
addAllProVal[lvjewelResonanceConfig.Property[j][1]] = addAllProVal[lvjewelResonanceConfig.Property[j][1]] + lvjewelResonanceConfig.Property[j][2]
else
addAllProVal[lvjewelResonanceConfig.Property[j][1]] = lvjewelResonanceConfig.Property[j][2]
end
end
end
if refineLvjewelResonanceConfig then
for j = 1, #refineLvjewelResonanceConfig.Property do
if addAllProVal[refineLvjewelResonanceConfig.Property[j][1]] then
addAllProVal[refineLvjewelResonanceConfig.Property[j][1]] = addAllProVal[refineLvjewelResonanceConfig.Property[j][1]] + refineLvjewelResonanceConfig.Property[j][2]
else
addAllProVal[refineLvjewelResonanceConfig.Property[j][1]] = refineLvjewelResonanceConfig.Property[j][2]
end
end
end
end
end
end
return addAllProVal
end
--计算所有英雄被动技能的属性值
local function CalculateHeroPassiveSkillProAddVal(_type,_heroId,_breakId,_upStarId)
local singleHeroProVal,lvProVal,allHeroProVal,specialProVal
local curHeroData = HeroManager.GetSingleHeroData(_heroId)
if curHeroData then
local allOpenPassiveSkillIds = {}
if _type == 1 then
allOpenPassiveSkillIds = this.GetAllPassiveSkillIds(curHeroData.heroConfig,curHeroData.breakId,curHeroData.upStarId)
else
allOpenPassiveSkillIds = this.GetAllPassiveSkillIds(curHeroData.heroConfig,_breakId,_upStarId)
end
--单体加成 --单体等级限制加成 --团体加成 --减乘
singleHeroProVal,lvProVal,allHeroProVal,specialProVal = this.CalculatePassiveSkillsValList(WarPowerType.Hero,allOpenPassiveSkillIds)
end
return singleHeroProVal,lvProVal,allHeroProVal,specialProVal
end
--计算其他属性值 (角色基础属性+角色升级属性)* 星级系数+升星变量+进阶总属性
--proValue 初始属性 rebirth=0 化境增长 lvNum 对应属性等级 breakNum 突破系数
function this.CalculateProVal(proValue, lvNum, breakId,upStarId,proId)
--LogError("breakId upStarId "..breakId.." "..upStarId)
local curProLvNum = 0
if heroLevelConfig[lvNum] then
for i = 1, #heroLevelConfig[lvNum].CharacterLevelPara do
if heroLevelConfig[lvNum].CharacterLevelPara[i][1] == proId then
curProLvNum = heroLevelConfig[lvNum].CharacterLevelPara[i][2]
end
end
end
local breakRankupPara = {0,0,0}
local upStarRankupPara = {0,0,0}
if heroRankUpConfig[breakId] then
for i = 1, #heroRankUpConfig[breakId].RankupPara do
if heroRankUpConfig[breakId].RankupPara[i][1] == proId then
breakRankupPara = heroRankUpConfig[breakId].RankupPara[i]
end
end
end
if heroRankUpConfig[upStarId] then
for i = 1, #heroRankUpConfig[upStarId].RankupPara do
if heroRankUpConfig[upStarId].RankupPara[i][1] == proId then
upStarRankupPara = heroRankUpConfig[upStarId].RankupPara[i]
end
end
end
if upStarRankupPara[3] == 0 then --星级系数 ==0 让其 == 10000 万分比
upStarRankupPara[3] = 10000
end
--LogError("proValue "..proValue.." curProLvNum "..curProLvNum.." upStarRankupPara[3]/10000 "..upStarRankupPara[3]/10000 .." upStarRankupPara[2] "..upStarRankupPara[2].." breakRankupPara[2] "..breakRankupPara[2])
return math.floor((proValue + curProLvNum) * upStarRankupPara[3]/10000 + upStarRankupPara[2] + breakRankupPara[2])
end
--计算其他属性值 角色面板属性*1+升星增加值/10000)*等级系数+角色面板属性*突破系数/10000
--proValue 初始属性 rebirth=0 化境增长 lvNum 等级系数 breakNum 突破系数
--local function CalculateProVal2(proValue, lvNum, breakId,upStarId)
-- local breakRankupPara = 0
-- local upStarRankupPara = 0
-- if heroRankUpConfig[breakId] then
-- breakRankupPara = heroRankUpConfig[breakId].RankupPara
-- end
-- if heroRankUpConfig[upStarId] then
-- upStarRankupPara = heroRankUpConfig[upStarId].RankupPara
-- end
-- --Log("proValue "..proValue.." upStarRankupPara "..upStarRankupPara.." lvNum "..lvNum.." breakRankupPara "..breakRankupPara)
--
-- return math.floor(proValue * (1 + upStarRankupPara/10000) * lvNum+proValue*breakRankupPara/10000)
--end
--计算speed属性值 0#0#10#1 abcd公式 x=breakId 刚才公式算出的数据 + 速度升级参数 * speed基础属性
--proValue速度基础属性 lv等级
local function CalculateSpeedProVal(proValue, breakId, speedNum)
--local SpeedFormulaData = ConfigManager.GetConfig(ConfigName.GameSetting)
--local curSpeedFormulaData = SpeedFormulaData[1].SpeedFormula
--breakId = breakId % 100
--local val = math.floor(((curSpeedFormulaData[1] * math.pow(breakId, 3) + curSpeedFormulaData[2] * math.pow(breakId, 2) + curSpeedFormulaData[3] * breakId + curSpeedFormulaData[4]) + proValue * speedNum))
return 0--val
end
--计算其他属性值 初始属性*1+化境增长)*等级系数 + 初始属性*突破系数
--proValue 初始属性 rebirth 化境增长 lvNum 等级系数 breakNum 突破系数
function this.CalculateProValMap(_heroDid,_proType)
Log("属性ID " .. _proType)
--proValue,rebirth,lvNum,breakId
local curheroData={}
if heroDatas[_heroDid] then
curheroData=heroDatas[_heroDid]
end
--local speedNum=heroLevelConfig[curheroData.lv].SpeedLevelPara
local allEquipAddProVal={}
allEquipAddProVal=CalculateHeroUpEquipsProAddVal(curheroData.dynamicId)
local allPokemonPeiJianAddPro=DiffMonsterManager.CalculateAllPokemonPeiJiAllProAddVal(curheroData.heroConfig.Profession)--添加所有异妖配件的属性
for k,v in pairs(allPokemonPeiJianAddPro) do
if allEquipAddProVal[k] then
allEquipAddProVal[k]= allEquipAddProVal[k]+v
end
end
local proValue=0
if _proType==HeroProType.Attack then
proValue=curheroData.attack
elseif _proType==HeroProType.Hp then
proValue=curheroData.hp
elseif _proType==HeroProType.PhysicalDefence then
proValue=curheroData.pDef
elseif _proType==HeroProType.MagicDefence then
proValue=curheroData.mDef
elseif _proType==HeroProType.Speed then
proValue=curheroData.speed
end
if _proType==HeroProType.Speed then
--return CalculateSpeedProVal(proValue,curheroData.breakId,speedNum)+allEquipAddProVal[_proType]
else
return this.CalculateProVal(proValue,curheroData.lv,curheroData.breakId,curheroData.upStarId,_proType)+allEquipAddProVal[_proType]
end
end
--计算战斗力
local function CalculateWarForce(powerVal)
local powerEndVal = 0
for i, v in pairs(powerVal) do
if v > 0 then
powerEndVal = powerEndVal + v * HeroManager.heroPropertyScore[i]
end
end
return math.floor(powerEndVal)
end
--计算战斗力
local function CalculateSingleModuleWarForce(powerVal)
local powerEndVal = 0
for i, v in pairs(powerVal) do
if v > 0 then
local curProConfig=propertyConfig[i]
if curProConfig and curProConfig.TargetPropertyId>0 then
powerVal[curProConfig.TargetPropertyId]= math.floor(powerVal[curProConfig.TargetPropertyId]+powerVal[curProConfig.TargetPropertyId]*powerVal[i]/10000)
end
if curProConfig and curProConfig.Style==2 then
powerVal[i]=powerVal[i]/10000
end
end
end
for i, v in pairs(powerVal) do
if v > 0 then
powerEndVal = powerEndVal + v * HeroManager.heroPropertyScore[i]
end
end
return math.floor(powerEndVal)
end
---PassiveSkillLogicConfig 表里EffectiveRange 2 3 为战前生效直接加成属性 2 为个体 3 为团体
---PassiveSkillLogicConfig 表里Type 90 个体加成 94 全体加成 171 对多少级英雄加成 加成公式1加算 2乘算 3减算 4乘减算
---90 例子 5#0.05#2 第一位对应PropertyConfig表PropertyIdInBattle 第二位 加成具体数值是百分百或者绝对值看PropertyConfig表 第三位 公式
---94 例子 0.05#17#2 百分比 PropertyConfig表PropertyIdInBattle属性 公式
---171 例子 3#9 100后每增加一级加 PropertyConfig表PropertyIdInBattle属性3 9值
---前端计算逻辑 先把所有被动技团体加成 和 被动技个人加成都提出来 然后计算英雄身上所有绝对值 + 所有被动技团体绝对值 + 所有被动技个人加成绝对值
--- * 1 + 英雄身上万分比加成 + 普通团体被动技百分比 + 普通个人被动技百分比 + 个体等级百分比加成 * 1 - 4乘减算 百分比)
---
---
---
function this.CalculatePassiveSkillsValList(index,skillids)
for k, v in ConfigPairs(ConfigManager.GetConfig(ConfigName.PropertyConfig)) do
this.allProVal[index].singleHeroProVal[k] = 0
this.allProVal[index].lvProVal[k] = 0
this.allProVal[index].allHeroProVal[k] = 0
this.allProVal[index].specialProVal[k] = 0
end
for i = 1, #skillids do
local skillid = skillids[i]
if passiveSkillLogicConfig[skillid] then
local curSkillData = passiveSkillLogicConfig[skillid]
--LogError("skillid "..skillid)
if curSkillData.EffectiveRange == 2 then--战前个人
if curSkillData.Type == 90 then
this.GetProAndValByFormula(this.allProVal[index].singleHeroProVal,this.allProVal[index].specialProVal,curSkillData.Value[1],curSkillData.Value[2],curSkillData.Value[3])
elseif curSkillData.Type == 94 then
this.GetProAndValByFormula(this.allProVal[index].singleHeroProVal,this.allProVal[index].specialProVal,curSkillData.Value[2],curSkillData.Value[1],curSkillData.Value[3])
elseif curSkillData.Type == 171 then
this.GetProAndValByFormula(this.allProVal[index].lvProVal,this.allProVal[index].specialProVal,curSkillData.Value[1],curSkillData.Value[2])
end
elseif curSkillData.EffectiveRange == 3 then--战前团体
if curSkillData.Type == 90 then
this.GetProAndValByFormula(this.allProVal[index].allHeroProVal,this.allProVal[index].specialProVal,curSkillData.Value[1],curSkillData.Value[2],curSkillData.Value[3])
elseif curSkillData.Type == 94 then
this.GetProAndValByFormula(this.allProVal[index].allHeroProVal,this.allProVal[index].specialProVal,curSkillData.Value[2],curSkillData.Value[1],curSkillData.Value[3])
elseif curSkillData.Type == 171 then
--目前没有
--this.GetProAndValByFormula(lvProVal,curSkillData,specialProVal)
end
end
else
LogError("被动技能在被动技能表PassiveSkillLogicConfig没有找到 "..skillid)
end
end
return this.allProVal[index].singleHeroProVal,this.allProVal[index].lvProVal,this.allProVal[index].allHeroProVal,this.allProVal[index].specialProVal
end
function this.GetProAndValByFormula(proTable,specialProVal,curProId,curProVal,curProlGs)
if curProlGs == 1 then--公式 绝对值加a+b
local curProConfig = ConfigManager.GetConfigDataByKey(ConfigName.PropertyConfig,"PropertyIdInBattle", curProId)
if propertyConfig[curProConfig.PropertyId].Style == 1 then
if proTable[curProConfig.PropertyId] then
proTable[curProConfig.PropertyId] = proTable[curProConfig.PropertyId] + curProVal
else
proTable[curProConfig.PropertyId] = curProVal
end
else
if proTable[curProConfig.PropertyId] then
proTable[curProConfig.PropertyId] = proTable[curProConfig.PropertyId] + curProVal* 10000
else
proTable[curProConfig.PropertyId] = curProVal* 10000
end
end
elseif curProlGs == 2 then--公式 百分比加a+oa*b
local curProConfig1 = ConfigManager.GetConfigDataByKey(ConfigName.PropertyConfig,"PropertyIdInBattle",curProId)
local curProConfig2 = ConfigManager.TryGetConfigDataByKey(ConfigName.PropertyConfig,"TargetPropertyId",curProConfig1.PropertyId)
if curProConfig2 then
if proTable[curProConfig2.PropertyId] then
proTable[curProConfig2.PropertyId] = proTable[curProConfig2.PropertyId] + curProVal * 10000
else
proTable[curProConfig2.PropertyId] = curProVal * 10000
end
else
if proTable[curProConfig1.PropertyId] then
proTable[curProConfig1.PropertyId] = proTable[curProConfig1.PropertyId] + curProVal * 10000
else
proTable[curProConfig1.PropertyId] = curProVal * 10000
end
end
elseif curProlGs == 3 then--公式 绝对值减a-b
local curProConfig = ConfigManager.GetConfigDataByKey(ConfigName.PropertyConfig,"PropertyIdInBattle",curProId)
if propertyConfig[curProConfig.PropertyId].Style == 1 then
if proTable[curProConfig.PropertyId] then
proTable[curProConfig.PropertyId] = proTable[curProConfig.PropertyId] - curProVal
else
proTable[curProConfig.PropertyId] = curProVal
end
else
if proTable[curProConfig.PropertyId] then
proTable[curProConfig.PropertyId] = proTable[curProConfig.PropertyId] - curProVal* 10000
else
proTable[curProConfig.PropertyId] = curProVal* 10000
end
end
elseif curProlGs == 4 then--公式 百分比减a*(1-b)
--目前没有
--specialProVal
else--171 无公式
local curProConfig = ConfigManager.GetConfigDataByKey(ConfigName.PropertyConfig,"PropertyIdInBattle", curProId)
if propertyConfig[curProConfig.PropertyId].Style == 1 then
if proTable[curProConfig.PropertyId] then
proTable[curProConfig.PropertyId] = proTable[curProConfig.PropertyId] + curProVal
else
proTable[curProConfig.PropertyId] = curProVal
end
else
if proTable[curProConfig.PropertyId] then
proTable[curProConfig.PropertyId] = proTable[curProConfig.PropertyId] + curProVal* 10000
else
proTable[curProConfig.PropertyId] = curProVal* 10000
end
end
end
end
--团队加成
function this.GetAllHeroTeamAddProVal(teamHeroInfos)
local teamProVal = {}
--英雄 法宝 魂印 被动技能
for i = 1, 6 do
if teamHeroInfos[i] then
local heroSkillSingleHeroProVal,heroSkillLvProVal,heroSkillAllHeroProVal,heroSkillSpecialProVal = CalculateHeroPassiveSkillProAddVal(1,teamHeroInfos[i].heroId)
local falismanSingleHeroProVal,falismanLvProVal,falismanAllHeroProVal,falismanSpecialProVal = CalculateHeroUpTalismanProAddVal(teamHeroInfos[i].heroId)
local soulPrinSingleHeroProVal,soulPrinLvProVal,soulPrinAllHeroProVal,soulPrinSpecialProVal = CalculateSoulPrintAddVal(teamHeroInfos[i].heroId)
this.DoubleTableCompound(teamProVal,heroSkillAllHeroProVal)
this.DoubleTableCompound(teamProVal,falismanAllHeroProVal)
this.DoubleTableCompound(teamProVal,soulPrinAllHeroProVal)
end
end
--光环加成
local aureoleProAdd = FormationManager.GetCurFormationElementAdd(teamHeroInfos)
this.DoubleTableCompound(teamProVal,aureoleProAdd)
return teamProVal
end
--计算英雄身上所有属性加成(包括装备就、异妖的加成)
--_type==1 计算当前英雄的所有属性 _type==2 根据_heroDid之后_breakId传过来的值进行计算 _isAllHeroProVal==true 团体加成综合 用字段_allHeroProVal
function this.CalculateHeroAllProValList(_type,_heroDid,isWar,_breakId,_upStarId,_isAllHeroProVal,_allHeroProVal)
local curHeroData= heroDatas[_heroDid] or _heroDid
local curLvNum = curHeroData.lv -- heroLevelConfig[curHeroData.lv].CharacterLevelPara
--local speedNum = heroLevelConfig[curHeroData.lv].SpeedLevelPara
--if _type == 1 then
-- LogError("计算战力英雄数据打印1 lv _breakId _upStarId "..curHeroData.lv.." "..curHeroData.breakId.." "..curHeroData.upStarId)
--else
-- LogError("计算战力英雄数据打印2 lv _breakId _upStarId "..curHeroData.lv.." ".._breakId.." ".._upStarId)
--end
--添加该英雄装备的属性
local allEquipScore=PlayerManager.GetSingHeroAllEquipSkillListScore(curHeroData)--获取单个英雄装备被动技能累计评分
local allAddProVal = {}--单体所有属性加成
local lvProVal = {}--100等级所有属性加成 升一级 加一次
local allHeroProVal = _allHeroProVal or {}--团体所有属性加成
local specialProVal = {}--4公式特殊减乘所有属性加成
allAddProVal = CalculateHeroUpEquipsProAddVal(curHeroData.dynamicId)
--for i, v in pairs(allAddProVal) do
-- if v > 0 then
-- LogError("装备加成 "..i.." "..v)
-- end
--end
--异妖配件的加成
local allPokemonPeiJianAddPro=DiffMonsterManager.CalculateAllPokemonPeiJiAllProAddVal(curHeroData.heroConfig.Profession)
--for i, v in pairs(allPokemonPeiJianAddPro) do
-- if v > 0 then
-- LogError("异妖配件的加成 "..i.." "..v)
-- end
--end
--科技树加成
--local treeAllProAdd = WorkShopManager.HeroCalculateTreeWarForce(curHeroData.heroConfig.Profession)
--for i, v in pairs(treeAllProAdd) do
-- if v > 0 then
-- LogError("科技树加成 "..i.." "..v)
-- end
--end
--公会技能加成
local guildSkillAllProAdd = GuildSkillManager.HeroCalculateGuildSkillWarForce(curHeroData.heroConfig.Profession)
--for i, v in pairs(guildSkillAllProAdd) do
-- if v > 0 then
-- LogError("公会技能加成 "..i.." "..v)
-- end
--end
--英雄被动技能属性加成
local heroSkillSingleHeroProVal,heroSkillLvProVal,heroSkillAllHeroProVal,heroSkillSpecialProVal = {},{},{},{}
if _type == 1 then
heroSkillSingleHeroProVal,heroSkillLvProVal,heroSkillAllHeroProVal,heroSkillSpecialProVal = CalculateHeroPassiveSkillProAddVal(_type,curHeroData.dynamicId)
elseif _type == 2 then
heroSkillSingleHeroProVal,heroSkillLvProVal,heroSkillAllHeroProVal,heroSkillSpecialProVal = CalculateHeroPassiveSkillProAddVal(_type,curHeroData.dynamicId,_breakId,_upStarId)
end
--if heroSkillSingleHeroProVal and LengthOfTable(heroSkillSingleHeroProVal) > 0 then
-- for i, v in pairs(heroSkillSingleHeroProVal) do
-- if v > 0 then
-- LogError("英雄被动技的单体属性加成 "..i.." "..v)
-- end
-- end
--end
--if heroSkillLvProVal and LengthOfTable(heroSkillLvProVal) > 0 then
-- for i, v in pairs(heroSkillLvProVal) do
-- if v > 0 then
-- LogError("英雄被动技的等极限值属性加成 "..i.." "..v)
-- end
-- end
--end
--if heroSkillAllHeroProVal and LengthOfTable(heroSkillAllHeroProVal) > 0 then
-- for i, v in pairs(heroSkillAllHeroProVal) do
-- if v > 0 then
-- LogError("英雄被动技的团体属性加成 "..i.." "..v)
-- end
-- end
--end
--法宝的属性加成 falismanProAdd
local falismanSingleHeroProVal,falismanLvProVal,falismanAllHeroProVal,falismanSpecialProVal = {},{},{},{}
if _type == 1 then
falismanSingleHeroProVal,falismanLvProVal,falismanAllHeroProVal,falismanSpecialProVal = CalculateHeroUpTalismanProAddVal(curHeroData.dynamicId)
elseif _type == 2 then
falismanSingleHeroProVal,falismanLvProVal,falismanAllHeroProVal,falismanSpecialProVal = CalculateHeroUpTalismanProAddVal(curHeroData.dynamicId,_breakId,_upStarId)
end
--if falismanSingleHeroProVal and LengthOfTable(falismanSingleHeroProVal) > 0 then
-- for i, v in pairs(falismanSingleHeroProVal) do
-- if v > 0 then
-- LogError("法宝的单体属性加成 "..i.." "..v)
-- end
-- end
--end
--if falismanLvProVal and LengthOfTable(falismanLvProVal) > 0 then
-- for i, v in pairs(falismanLvProVal) do
-- if v > 0 then
-- LogError("法宝的等极限值属性加成 "..i.." "..v)
-- end
-- end
--end
--if falismanAllHeroProVal and LengthOfTable(falismanAllHeroProVal) > 0 then
-- for i, v in pairs(falismanAllHeroProVal) do
-- if v > 0 then
-- LogError("法宝的团体属性加成 "..i.." "..v)
-- end
-- end
--end
--魂印的属性加成
local soulPrinSingleHeroProVal,soulPrinLvProVal,soulPrinAllHeroProVal,soulPrinSpecialProVal = CalculateSoulPrintAddVal(curHeroData.dynamicId)
--if soulPrinSingleHeroProVal and LengthOfTable(soulPrinSingleHeroProVal) > 0 then
-- for i, v in pairs(soulPrinSingleHeroProVal) do
-- if v > 0 then
-- LogError("魂印的单体属性加成 "..i.." "..v)
-- end
-- end
--end
--if soulPrinLvProVal and LengthOfTable(soulPrinLvProVal) > 0 then
-- for i, v in pairs(soulPrinLvProVal) do
-- if v > 0 then
-- LogError("魂印的等极限值属性加成 "..i.." "..v)
-- end
-- end
--end
--if soulPrinAllHeroProVal and LengthOfTable(soulPrinAllHeroProVal) > 0 then
-- for i, v in pairs(soulPrinAllHeroProVal) do
-- if v > 0 then
-- LogError("魂印的团体属性加成 "..i.." "..v)
-- end
-- end
--end
--for i, v in pairs(heroSkillSingleHeroProVal) do
-- if v > 0 then
-- LogError("heroSkillSingleHeroProVal 2 "..i.." "..v)
-- end
--end
--宝器加成 宝器本身属性 + 宝器激活的强化共鸣 和 精炼共鸣
local equipTreasureAddPro = CalculateEquipTreaSureAddVal(curHeroData.dynamicId)
-- if equipTreasureAddPro and LengthOfTable(equipTreasureAddPro) > 0 then
-- for i, v in pairs(equipTreasureAddPro) do
-- if v > 0 then
-- LogError("宝器加成 "..i.." "..v)
-- end
-- end
-- end
--玩家称号 皮肤 坐骑属性加成
local playerDcorateAdd= PlayerManager.CalculatePlayerDcorateProAddVal()
--编队光环加成
local teamAddPro = FormationManager.GetCurFormationElementAddByType(FormationTypeDef.FORMATION_NORMAL,_heroDid)
--单体所有属性合并
this.DoubleTableCompound(allAddProVal,allPokemonPeiJianAddPro)
this.DoubleTableCompound(allAddProVal,guildSkillAllProAdd)
this.DoubleTableCompound(allAddProVal,falismanSingleHeroProVal)
this.DoubleTableCompound(allAddProVal,soulPrinSingleHeroProVal)
this.DoubleTableCompound(allAddProVal,playerDcorateAdd)
this.DoubleTableCompound(allAddProVal,heroSkillSingleHeroProVal)
this.DoubleTableCompound(allAddProVal,equipTreasureAddPro)
--100等级所有属性合并
this.DoubleTableCompound(lvProVal,falismanLvProVal)
this.DoubleTableCompound(lvProVal,soulPrinLvProVal)
this.DoubleTableCompound(lvProVal,heroSkillLvProVal)
--团体所有属性合并
if not _isAllHeroProVal then
this.DoubleTableCompound(allHeroProVal,falismanAllHeroProVal)
this.DoubleTableCompound(allHeroProVal,soulPrinAllHeroProVal)
this.DoubleTableCompound(allHeroProVal,heroSkillAllHeroProVal)
this.DoubleTableCompound(allHeroProVal,teamAddPro)
end
--4公式特殊减乘所有属性加成
this.DoubleTableCompound(specialProVal,falismanSpecialProVal)
this.DoubleTableCompound(specialProVal,soulPrinSpecialProVal)
this.DoubleTableCompound(specialProVal,heroSkillSpecialProVal)
--100等级所有属性合并
local forNum = curLvNum - 100
if forNum > 0 then
for k = 1, forNum do
this.DoubleTableCompound(allAddProVal,lvProVal)
end
end
--团体所有属性合并
this.DoubleTableCompound(allAddProVal,allHeroProVal)
--4公式特殊
--for i, v in pairs(allAddProVal) do
-- if v > 0 then
-- LogError("所有属性综合完allAddProVal 1 "..i.." "..v)
-- end
--end
--Log("proValue * (1 + upStarRankupPara/10000) * lvNum+proValue*breakRankupPara/10000")
if _type==1 then
allAddProVal[HeroProType.Attack]=this.CalculateProVal(curHeroData.attack,curLvNum,curHeroData.breakId,curHeroData.upStarId,HeroProType.Attack)+allAddProVal[HeroProType.Attack]
allAddProVal[HeroProType.Hp]=this.CalculateProVal(curHeroData.hp,curLvNum,curHeroData.breakId,curHeroData.upStarId,HeroProType.Hp)+allAddProVal[HeroProType.Hp]
allAddProVal[HeroProType.PhysicalDefence]=this.CalculateProVal(curHeroData.pDef,curLvNum,curHeroData.breakId,curHeroData.upStarId,HeroProType.PhysicalDefence)+allAddProVal[HeroProType.PhysicalDefence]
allAddProVal[HeroProType.MagicDefence]=this.CalculateProVal(curHeroData.mDef,curLvNum,curHeroData.breakId,curHeroData.upStarId,HeroProType.MagicDefence)+allAddProVal[HeroProType.MagicDefence]
--allAddProVal[HeroProType.Speed]=CalculateSpeedProVal(curHeroData.speed,curHeroData.breakId,speedNum)+allAddProVal[HeroProType.Speed]
--allAddProVal[HeroProType.WarPower]=allEquipScore+CalculateWarForce( allAddProVal[HeroProType.Hp], allAddProVal[HeroProType.PhysicalDefence],allAddProVal[HeroProType.MagicDefence],allAddProVal[HeroProType.Attack],allAddProVal[HeroProType.CritFactor],allAddProVal[HeroProType.Hit],allAddProVal[HeroProType.Dodge],allAddProVal[HeroProType.DamageBocusFactor],allAddProVal[HeroProType.DamageReduceFactor],allAddProVal[HeroProType.Speed])
elseif _type==2 then
allAddProVal[HeroProType.Attack]=this.CalculateProVal(curHeroData.attack,curLvNum,_breakId,_upStarId,HeroProType.Attack)+allAddProVal[HeroProType.Attack]
allAddProVal[HeroProType.Hp]=this.CalculateProVal(curHeroData.hp,curLvNum,_breakId,_upStarId,HeroProType.Hp)+allAddProVal[HeroProType.Hp]
allAddProVal[HeroProType.PhysicalDefence]=this.CalculateProVal(curHeroData.pDef,curLvNum,_breakId,_upStarId,HeroProType.PhysicalDefence)+allAddProVal[HeroProType.PhysicalDefence]
allAddProVal[HeroProType.MagicDefence]=this.CalculateProVal(curHeroData.mDef,curLvNum,_breakId,_upStarId,HeroProType.MagicDefence)+allAddProVal[HeroProType.MagicDefence]
--allAddProVal[HeroProType.Speed]=CalculateSpeedProVal(curHeroData.speed,_breakId,speedNum)+allAddProVal[HeroProType.Speed]
--allAddProVal[HeroProType.WarPower]=allEquipScore+CalculateWarForce( allAddProVal[HeroProType.Hp], allAddProVal[HeroProType.PhysicalDefence],allAddProVal[HeroProType.MagicDefence],allAddProVal[HeroProType.Attack],allAddProVal[HeroProType.CritFactor],allAddProVal[HeroProType.Hit],allAddProVal[HeroProType.Dodge],allAddProVal[HeroProType.DamageBocusFactor],allAddProVal[HeroProType.DamageReduceFactor],allAddProVal[HeroProType.Speed])
end
--for i, v in pairs(allAddProVal) do
-- if v > 0 then
-- LogError("基础属性综合前端算allAddProVal 2 "..i.." "..v)
-- end
--end
for k,v in pairs(allAddProVal) do
local curProConfig=propertyConfig[k]
if curHeroData.heroConfig.SecondaryFactor and isWar then
for i = 1, #curHeroData.heroConfig.SecondaryFactor do
if k==curHeroData.heroConfig.SecondaryFactor[i][1] then
allAddProVal[k]=allAddProVal[k]+curHeroData.heroConfig.SecondaryFactor[i][2]
end
end
end
--计算装备异妖 特殊百分比加成 (在英雄自身、装备、异妖 绝对值属性算完之后 最后计算百分比加成)
if curProConfig and allAddProVal[k]>0 and curProConfig.TargetPropertyId>0 then
allAddProVal[curProConfig.TargetPropertyId]= math.floor(allAddProVal[curProConfig.TargetPropertyId]+allAddProVal[curProConfig.TargetPropertyId]*allAddProVal[k]/10000)
end
--战斗里面 PropertyConfig里Style字段2类型的统一需要除以100在战斗里面
if curProConfig and allAddProVal[k]>0 and isWar and curProConfig.Style==2 then
allAddProVal[k]=allAddProVal[k]/10000
elseif curProConfig and allAddProVal[k]>0 and isWar==false and curProConfig.Style==2 then
allAddProVal[k]=allAddProVal[k]/100
end
--战斗里面 PropertyConfig里面 IfFormula==1策划投放的是属性绝对值转化为战斗里面的是属性系数转化公式为 属性系数=属性绝对值*0.1/(等级+10/100
if curProConfig and allAddProVal[k]>0 and isWar and curProConfig.IfFormula==1 then
allAddProVal[k]=math.floor(allAddProVal[k]*0.1/(curHeroData.lv+10)/10000)
elseif curProConfig and allAddProVal[k]>0 and isWar==false and curProConfig.IfFormula==1 then
--allAddProVal[k]=math.floor(allAddProVal[k]*0.1/(curHeroData.lv+10)/100)
end
end
--Log("allEquipScore "..allEquipScore)
--最后计算英雄战斗力
if _type==1 then
allAddProVal[HeroProType.WarPower]=allEquipScore+CalculateWarForce( allAddProVal)
elseif _type==2 then
allAddProVal[HeroProType.WarPower]=allEquipScore+CalculateWarForce( allAddProVal)
end
--for i, v in pairs(allAddProVal) do
-- if v > 0 then
-- LogError("最后allAddProVal 3 "..i.." "..v)
-- end
--end
return allAddProVal
end
function this.DoubleTableCompound(allProVal,addProVal)
if addProVal and LengthOfTable(addProVal) > 0 then
for k,v in pairs(addProVal) do
if v > 0 then
if allProVal[k] then
allProVal[k] = allProVal[k] + v
else
allProVal[k] = v
end
end
end
end
end
--计算英雄身上单个模块战斗力
--1 装备 2 异妖 3 戒灵 4 天赋树 5 魂印 6 法宝 7 英雄自身
function this.CalculateSingleModuleProPower(_type,_heroDid)
local curHeroData= heroDatas[_heroDid]
local curLvNum =curHeroData.lv-- heroLevelConfig[curHeroData.lv].CharacterLevelPara
--local speedNum = heroLevelConfig[curHeroData.lv].SpeedLevelPara
if _type == 1 then
local allEquipScore=PlayerManager.GetSingHeroAllEquipSkillListScore(curHeroData)--获取单个英雄装备被动技能累计评分
local allAddEquipProVal=CalculateHeroUpEquipsProAddVal(curHeroData.dynamicId)--添加该英雄装备的属性
return allEquipScore + CalculateSingleModuleWarForce( allAddEquipProVal)
elseif _type == 2 then
local allPokemonPeiJianAddPro=DiffMonsterManager.CalculateAllPokemonPeiJiAllProAddVal(curHeroData.heroConfig.Profession)--添加所有异妖配件的属性
return CalculateSingleModuleWarForce( allPokemonPeiJianAddPro)
--elseif _type == 3 then
-- local allTalentProVal=TalentManager.GetAllTypeTalentProVal()--添加所有戒灵的属性
-- return CalculateSingleModuleWarForce( allTalentProVal)
elseif _type == 4 then
local treeAllProAdd = WorkShopManager.HeroCalculateTreeWarForce(curHeroData.heroConfig.Profession)--计算所有科技树属性
return CalculateSingleModuleWarForce( treeAllProAdd)
elseif _type == 5 then
return 0
elseif _type == 6 then
return 0
elseif _type == 7 then
local allAddProVal = {}
allAddProVal[HeroProType.Attack]=this.CalculateProVal(curHeroData.attack,curLvNum,curHeroData.breakId,curHeroData.upStarId,HeroProType.Attack)
allAddProVal[HeroProType.Hp]=this.CalculateProVal(curHeroData.hp,curLvNum,curHeroData.breakId,curHeroData.upStarId,HeroProType.Hp)
allAddProVal[HeroProType.PhysicalDefence]=this.CalculateProVal(curHeroData.pDef,curLvNum,curHeroData.breakId,curHeroData.upStarId,HeroProType.PhysicalDefence)
allAddProVal[HeroProType.MagicDefence]=this.CalculateProVal(curHeroData.mDef,curLvNum,curHeroData.breakId,curHeroData.upStarId,HeroProType.MagicDefence)
--allAddProVal[HeroProType.Speed]=CalculateSpeedProVal(curHeroData.speed,curHeroData.breakId,speedNum)
--if curHeroData.heroConfig.SecondaryFactor then
-- for i = 1, #curHeroData.heroConfig.SecondaryFactor do
-- if allAddProVal[curHeroData.heroConfig.SecondaryFactor[i][1]] then
-- allAddProVal[curHeroData.heroConfig.SecondaryFactor[i][1]] = allAddProVal[curHeroData.heroConfig.SecondaryFactor[i][1]] +
-- curHeroData.heroConfig.SecondaryFactor[i][2]
-- else
-- allAddProVal[curHeroData.heroConfig.SecondaryFactor[i][1]] = curHeroData.heroConfig.SecondaryFactor[i][2]
-- end
-- end
--end
return CalculateSingleModuleWarForce( allAddProVal)
end
return 0
end
--计算英雄战斗属性
--目前一次顺序 >等级>生命>最大生命>攻击力>护甲>魔抗>速度>伤害加成系数(%>伤害减免系数(%>命中率(%>闪避率(%>暴击率(%>暴击伤害系数(%>治疗加成系数(%
-- >火系伤害加成系数(%>火系伤害减免系数(%>冰系伤害加成系数(%>冰系伤害减免系数(%>雷系伤害加成系数(%>雷系伤害减免系数(%>风系伤害加成系数(%
-- >风系伤害减免系数(%>地系伤害加成系数(%>地系伤害减免系数(%>暗系伤害加成系数(%>暗系伤害减免系数(%
function this.CalculateWarAllProVal(heroDid)
local allEquipAddProVal = HeroManager.CalculateHeroAllProValList(1, heroDid, true)
local allProVal = {}
table.insert(allProVal, 1, HeroManager.GetSingleHeroData(heroDid).lv)--等级
table.insert(allProVal, 2, allEquipAddProVal[HeroProType.Hp])--生命
table.insert(allProVal, 3, allEquipAddProVal[HeroProType.Hp])--最大生命
table.insert(allProVal, 4, allEquipAddProVal[HeroProType.Attack])--攻击力
table.insert(allProVal, 5, allEquipAddProVal[HeroProType.PhysicalDefence])--护甲
table.insert(allProVal, 6, allEquipAddProVal[HeroProType.MagicDefence])--魔抗
table.insert(allProVal, 7, allEquipAddProVal[HeroProType.Speed])--速度
table.insert(allProVal, 8, allEquipAddProVal[HeroProType.DamageBocusFactor])--伤害加成系数(%
table.insert(allProVal, 9, allEquipAddProVal[HeroProType.DamageReduceFactor])--伤害减免系数(%
table.insert(allProVal, 10, allEquipAddProVal[HeroProType.Hit])--命中率(%
table.insert(allProVal, 11, allEquipAddProVal[HeroProType.Dodge])--闪避率(%
table.insert(allProVal, 12, allEquipAddProVal[HeroProType.CritFactor])--暴击率(%
table.insert(allProVal, 13, allEquipAddProVal[HeroProType.CritDamageFactor])--暴击伤害系数(%
table.insert(allProVal, 14, allEquipAddProVal[HeroProType.AntiCritDamageFactor])--抗暴率(%
table.insert(allProVal, 15, allEquipAddProVal[HeroProType.TreatFacter])--治疗加成系数(%
table.insert(allProVal, 16, allEquipAddProVal[HeroProType.CureFacter])--受到治疗系数(%
table.insert(allProVal, 17, allEquipAddProVal[HeroProType.DifferDemonsBocusFactor])--异妖伤害加成系数(%
table.insert(allProVal, 18, allEquipAddProVal[HeroProType.DifferDemonsReduceFactor])--异妖减伤率(%
table.insert(allProVal, 19, allEquipAddProVal[HeroProType.FireDamageReduceFactor])--火系伤害减免系数(%
table.insert(allProVal, 20, allEquipAddProVal[HeroProType.WindDamageReduceFactor])--风系伤害减免系数(%
table.insert(allProVal, 21, allEquipAddProVal[HeroProType.WaterDamageReduceFactor])--冰系伤害减免系数(%
table.insert(allProVal, 22, allEquipAddProVal[HeroProType.LandDamageReduceFactor])--地系伤害减免系数(%
table.insert(allProVal, 23, allEquipAddProVal[HeroProType.LightDamageReduceFactor])--光系伤害减免系数(%
table.insert(allProVal, 24, allEquipAddProVal[HeroProType.DarkDamageReduceFactor])--暗系伤害减免系数(%
table.insert(allProVal, 25, 0)--属性伤害加成系数(%
return allProVal
end
--地图临时背包数据
this.mapShotTimeItemData={}
--地图临时英雄数据存储
function this.InitMapShotTimeHeroBagData(_mapHero)
this.mapShotTimeItemData[#this.mapShotTimeItemData+1]=_mapHero
end
--通过职业筛选英雄
function this.GetHeroDataByProfession(_profession)
local heros = {}
local index = 1
for i, v in pairs(heroDatas) do
if v.profession == _profession or _profession == 0 then--0 全职业
heros[index] = v
index = index + 1
end
end
return heros
end
--通过属性筛选英雄
function this.GetHeroDataByProperty(_property,_lvLimit)
local heros = {}
local lvLimit = 0
local allUpZhenHeroList = FormationManager.GetWuJinFormationHeroIds(FormationTypeDef.FORMATION_ENDLESS_MAP)
if _lvLimit then lvLimit = _lvLimit end
local index = 1
for i, v in pairs(heroDatas) do
if v.property == _property then
if v.lv >= lvLimit or allUpZhenHeroList[v.dynamicId] then
heros[index] = v
index = index + 1
end
end
end
return heros
end
--通过品阶筛选英雄
function this.GetHeroDataByNatural(_natural)
local heros = {}
for _, heroInfo in pairs(heroDatas) do
if heroInfo.heroConfig.Natural == _natural then
table.insert(heros, heroInfo)
end
end
return heros
end
--检测单个英雄是否有可穿的装备
function this.GetHeroIsUpEquip(heroDid)
if heroDatas[heroDid] then
local heroData = heroDatas[heroDid]
local lackEquips = {}
--六个装备位
for i = 1, 6 do
local equipIdAndWarPower = {}
equipIdAndWarPower.pos = i
equipIdAndWarPower.did = "0"
equipIdAndWarPower.warPower = 0
lackEquips[i] = equipIdAndWarPower
end
--空缺的装备位赋值位置 有装备的赋值装备did及战力
for i = 1, #heroData.equipIdList do
if EquipManager.equipDatas[heroData.equipIdList[i]] then
local curEquipConFigData = EquipManager.equipDatas[heroData.equipIdList[i]].equipConfig
if curEquipConFigData and curEquipConFigData.Position then
lackEquips[curEquipConFigData.Position].did = heroData.equipIdList[i]
lackEquips[curEquipConFigData.Position].warPower = EquipManager.CalculateWarForce(heroData.equipIdList[i])
end
end
end
for _, v in pairs(EquipManager.equipDatas) do
--有同系 且未在英雄身上的装备
if v.upHeroDid=="0" and (v.equipConfig.ProfessionLimit == 0 or v.equipConfig.ProfessionLimit == heroData.heroConfig.Profession) then
local pos = v.equipConfig.Position
--比较战力 高战力的装备add
if lackEquips[pos].pos == v.equipConfig.Position then
if lackEquips[pos].did == "0" then
lackEquips[pos].did = v.did
lackEquips[pos].warPower = EquipManager.CalculateWarForce(v.did)
else
local nextEquipWarPower = EquipManager.CalculateWarForce(v.did)
if nextEquipWarPower > lackEquips[pos].warPower then
lackEquips[pos].did = v.did
lackEquips[pos].warPower = EquipManager.CalculateWarForce(v.did)
end
end
end
end
end
--去掉与自己本身自带的重合装备
local allUpEquipDidTabs = {}
for i = 1, #lackEquips do
if lackEquips[i].did ~= "0" then
local isAdd = true
for j = 1, #heroData.equipIdList do
if heroData.equipIdList[j] == lackEquips[i].did then
isAdd = false
end
end
if isAdd then
table.insert(allUpEquipDidTabs,lackEquips[i].did)
end
end
end
if #allUpEquipDidTabs > 0 then
return allUpEquipDidTabs
end
return {}
end
return {}
end
--检测单个英雄是否有可穿的法宝
function this.GetHeroIsUpTalisman(heroDid)
if heroDatas[heroDid] then
local heroData = heroDatas[heroDid]
local isOpenTalisman = TalismanManager.GetCurHeroIsOpenTalisman(heroData.star)
if isOpenTalisman == false then--法宝是否开启
return {}
end
local curTalismanData
if heroData.talismanList and #heroData.talismanList > 0 then
curTalismanData = TalismanManager.GetSingleTalismanData(heroData.talismanList[1])
end
local GetAllTalismanData = TalismanManager.GetAllTalismanData(false,"0")
table.sort(GetAllTalismanData, function(a, b)
return a.power > b.power
end)
if curTalismanData then
if GetAllTalismanData and #GetAllTalismanData > 0 then
for i = 1, #GetAllTalismanData do
if GetAllTalismanData[i].power > curTalismanData.power then
return {GetAllTalismanData[i]}
end
end
end
return {}
else
if GetAllTalismanData and #GetAllTalismanData > 0 then
return {GetAllTalismanData[1]}
else
return {}
end
end
end
return {}
end
--获取妖灵师技能最大等级
function this.GetHeroSkillMaxLevel(heroTId, type)
local curHeroData = ConfigManager.GetConfigData(ConfigName.HeroConfig, heroTId)
local maxSkillLv
if type == 1 then
if #curHeroData.OpenSkillRules - 1 == 0 then
maxSkillLv=curHeroData.OpenSkillRules[1][2]%10
else
maxSkillLv=curHeroData.OpenSkillRules[#curHeroData.OpenSkillRules][2]%10
end
elseif type == 2 then
maxSkillLv =curHeroData.OpenSkillRules[#curHeroData.OpenSkillRules][2]%10
elseif type ==3 then
maxSkillLv=curHeroData.OpenPassiveSkillRules[#curHeroData.OpenPassiveSkillRules][2]%10
end
return maxSkillLv
end
--获取所有英雄信息(回溯功能)
function this.GetReturnHeroDatas(_star)
local heros = {}
local heros2 = {}
for i, v in pairs(heroDatas) do
v.isFormation = ""
table.insert(heros,v)
end
--标记编队上的英雄
if heros and LengthOfTable(heros)>0 then
for i, v in pairs(heros) do
for n,w in pairs(FormationManager.formationList) do
for m = 1, #w.teamHeroInfos do
if v.dynamicId==w.teamHeroInfos[m].heroId then
local isFormationStr = this.GetHeroFormationStr(n)
heros[i].isFormation = isFormationStr
end
end
end
if v.star >= _star then
table.insert(heros2,v)
end
end
end
return heros2
end
function this.GetCurHeroSidAndCurStarAllSkillDatas(sid,star)
local allSkillDatas = {}
local skillIndex = 1
local curHeroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig,sid)
if curHeroConfig.OpenSkillRules then
for i = 1, #curHeroConfig.OpenSkillRules do
if curHeroConfig.OpenSkillRules[i][1] == star then
local heroSkill={}
heroSkill.skillId=curHeroConfig.OpenSkillRules[i][2]
heroSkill.skillConfig=skillConfig[heroSkill.skillId]
allSkillDatas[skillIndex] = heroSkill
skillIndex = skillIndex + 1
end
end
end
if curHeroConfig.OpenPassiveSkillRules then
for i = 1, #curHeroConfig.OpenPassiveSkillRules do
if curHeroConfig.OpenPassiveSkillRules[i][1] == star then
local heroSkill={}
heroSkill.skillId=curHeroConfig.OpenPassiveSkillRules[i][2]
heroSkill.skillConfig=passiveSkillConfig[heroSkill.skillId]
allSkillDatas[skillIndex] = heroSkill
skillIndex = skillIndex + 1
end
end
end
return allSkillDatas
end
function this.DetectionOpenFiveStarActivity(starUpGiftNum)
Log(" ---- GameEvent.PatFace.PatFaceSend,14 ")
Game.GlobalEvent:DispatchEvent(GameEvent.PatFace.PatFaceSend,FacePanelType.GrowGift,starUpGiftNum)
end
-- 判断英雄是否有魂印功能
function this.IsHeroHaveSoulPrintFunc(heroId)
local unlock = ConfigManager.GetConfigData(ConfigName.GameSetting, 1).EquipSignUnlock
if unlock[1] == 1 then
-- 根据英雄判断等级
return
elseif unlock[1] == 2 then
local MaxStar = ConfigManager.GetConfigData(ConfigName.HeroConfig, heroId).MaxRank
return MaxStar >= unlock[2]
end
return false
end
-- 判断英雄是否有法宝功能
function this.IsHeroHaveTalismanFunc(heroId)
local unlock = ConfigManager.GetConfigData(ConfigName.GameSetting, 1).EquipTalismanaUnlock
if unlock[1] == 1 then
-- 根据英雄判断等级
return
elseif unlock[1] == 2 then
local MaxStar = ConfigManager.GetConfigData(ConfigName.HeroConfig, heroId).MaxRank
return MaxStar >= unlock[2]
end
return false
end
--获取迷宫寻宝所有英雄信息
function this.GetFingTreasureAllHeroDatas()
local allUpZhenHeroList = FindTreasureManager.GetAllUpHeros()
local heros = {}
for i, v in pairs(heroDatas) do
if not allUpZhenHeroList[v.dynamicId] then
table.insert(heros,v)
end
end
return heros
end
--回溯 和 献祭 返回item信息
local rewardGroup=ConfigManager.GetConfig(ConfigName.RewardGroup)
function this.GetHeroReturnItems(selectHeroData,type)
local allRewardData={}
if type == GENERAL_POPUP_TYPE.ResolveRecall then
local specificValue =tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig,34).Value)/10000
local ShowItemlist={}
--HeroReturn 的 ReturnHero + RankupReturn * specificValue + HeroLevelConfig 的 Consume * specificValue
--先把回溯英雄放进去
for i, v in pairs(selectHeroData) do
local curHeroData = heroDatas[i]
if not curHeroData then return end
local heroReturnConfig = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.HeroReturn,"HeroId",curHeroData.id,"Star",curHeroData.star)
local rewardShowStr1={}
rewardShowStr1 = heroReturnConfig.ReturnHero
if rewardShowStr1 then
table.sort(rewardShowStr1,function(a,b) return a[1] < b[1] end)
for i = 1, #rewardShowStr1 do
if rewardShowStr1[i] and rewardShowStr1[i][1] then
table.insert(ShowItemlist,rewardShowStr1[i])
end
end
end
rewardShowStr1 = heroReturnConfig.RankupReturn
if rewardShowStr1 then
if rewardShowStr1[1] and rewardShowStr1[2] then
table.insert(ShowItemlist,{rewardShowStr1[1],rewardShowStr1[2]*specificValue})
end
end
rewardShowStr1 = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, v.lv).SumConsume
if rewardShowStr1 then
for i = 1, #rewardShowStr1 do
table.insert(ShowItemlist,{rewardShowStr1[i][1],rewardShowStr1[i][2]*specificValue})
end
end
--this.GetHeroReturnItems2(ShowItemlist,allRewardData)
end
local dropList = {}
for i = 1, #ShowItemlist do
local curReward={}
curReward.id = ShowItemlist[i][1]
curReward.num = math.floor(ShowItemlist[i][2])
curReward.itemConfig=itemConfig[curReward.id]
table.insert( dropList,curReward)
end
return dropList
elseif type == GENERAL_POPUP_TYPE.ResolveDismantle then --献祭
local specificValue =tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig,35).Value)/10000
for i, v in pairs(selectHeroData) do
--当英雄一次都未突破和进阶时
--val=itemConfig.ResolveReward+heroLevelConfig.SumConsume else val=HeroRankupConfig.SumConsume+heroLevelConfig.SumConsume
--1裸角色卡没有突破过的角色卡熔炼后返还的材料=当前等级返还升级材料+item表返还材料
--2有过突破的卡 =当前等级返还升级材料+突破表返还材料+升星返还材料
local ShowItemlist={}
if v.breakId==0 and v.upStarId==0 then
local rewardGroupId = tonumber(itemConfig[v.id].ResolveReward)
if rewardGroupId and rewardGroup[rewardGroupId] then
local showItem=rewardGroup[rewardGroupId].ShowItem
if showItem and LengthOfTable(showItem)>0 then
for i = 1, #showItem do
table.insert(ShowItemlist,{showItem[i][1],showItem[i][2]})
end
end
end
else
if v.breakId > 0 then
local heroRankUpConfig = ConfigManager.GetConfigData(ConfigName.HeroRankupConfig, v.breakId)
if heroRankUpConfig then
local sumConsume=heroRankUpConfig.SumConsume
for i = 1, #sumConsume do
table.insert(ShowItemlist,{sumConsume[i][1],sumConsume[i][2] * specificValue})
end
end
end
if v.upStarId > 0 then
local heroRankUpConfig = ConfigManager.GetConfigData(ConfigName.HeroRankupConfig, v.upStarId)
if heroRankUpConfig then
local sumConsume=heroRankUpConfig.SumConsume
for i = 1, #sumConsume do
table.insert(ShowItemlist,{sumConsume[i][1],sumConsume[i][2] * specificValue})
end
end
end
end
local rewardShowStr2={}
rewardShowStr2 = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, v.lv).SumConsume
if rewardShowStr2 then
for i = 1, #rewardShowStr2 do
if rewardShowStr2[i] and rewardShowStr2[i][1] then
table.insert(ShowItemlist,{rewardShowStr2[i][1],rewardShowStr2[i][2] * specificValue})
end
end
end
this.GetHeroReturnItems2(ShowItemlist,allRewardData)
end
local dropList = {}
for k,v in pairs(allRewardData) do
v.num = math.floor(v.num)
table.insert( dropList,v)
end
table.sort(dropList,function(a,b) return itemConfig[a.id].Quantity > itemConfig[b.id].Quantity end)
return dropList
end
end
function this.GetHeroReturnItems2(ShowItemlist,allRewardData)
for i=1, #ShowItemlist do
local curReward={}
curReward.id = ShowItemlist[i][1]
curReward.num = ShowItemlist[i][2]
curReward.itemConfig=itemConfig[curReward.id]
if allRewardData[curReward.id]==nil then
allRewardData[curReward.id]=curReward
else
allRewardData[curReward.id].num=allRewardData[curReward.id].num+ curReward.num
end
end
end
--更新英雄主动技能
function this.UpdateSkillIdList(heroData)
heroData.skillIdList={}--主动技
if heroData.heroConfig.OpenSkillRules then
for i = 1, #heroData.heroConfig.OpenSkillRules do
if heroData.heroConfig.OpenSkillRules[i][1] == heroData.star then
local heroSkill={}
heroSkill.skillId=heroData.heroConfig.OpenSkillRules[i][2]
heroSkill.skillConfig=skillConfig[heroSkill.skillId]
table.insert(heroData.skillIdList,heroSkill)
end
end
end
end
--更新英雄被动技能
function this.UpdatePassiveHeroSkill(heroData)
heroData.passiveSkillList = {} --被动技
if heroData.heroConfig.OpenPassiveSkillRules then
for i = 1, #heroData.heroConfig.OpenPassiveSkillRules do
if heroData.heroConfig.OpenPassiveSkillRules[i][1] == 1 then--突破
if heroData.breakId >= heroData.heroConfig.OpenPassiveSkillRules[i][2] then
local heroSkill={}
heroSkill.skillId=heroData.heroConfig.OpenPassiveSkillRules[i][3]
heroSkill.skillConfig=passiveSkillConfig[heroSkill.skillId]
table.insert(heroData.passiveSkillList,heroSkill)
end
else--升星
if heroData.upStarId >= heroData.heroConfig.OpenPassiveSkillRules[i][2] then
local heroSkill={}
heroSkill.skillId=heroData.heroConfig.OpenPassiveSkillRules[i][3]
heroSkill.skillConfig=passiveSkillConfig[heroSkill.skillId]
table.insert(heroData.passiveSkillList,heroSkill)
end
end
end
end
end
-----------新魂印开始
--增加魂印装备的英雄did
function this.AddSoulPrintUpHeroDynamicId(heroDid, soulPrintSid,soulPrintPos)
if heroDatas[heroDid] then
local singleSoulPrint = {equipId = soulPrintSid,position = soulPrintPos}
table.insert(heroDatas[heroDid].soulPrintList,singleSoulPrint)
SoulPrintManager.AddSoulPrintUpHeroDynamicId(soulPrintSid,heroDid)
end
end
--删除魂印装备的英雄did
function this.DelSoulPrintUpHeroDynamicId(heroDid,soulPrintSid)
if heroDatas[heroDid] then
for i = 1, #heroDatas[heroDid].soulPrintList do
if heroDatas[heroDid].soulPrintList[i] and heroDatas[heroDid].soulPrintList[i].equipId == soulPrintSid then
table.remove(heroDatas[heroDid].soulPrintList,i)
SoulPrintManager.DelSoulPrintUpHeroDynamicId(soulPrintSid,heroDid)
end
end
end
end
------------新魂印结束
--天赋技能(被动技能)
function this.GetAllPassiveSkillIds(heroConfig,breakId,upStarId)
local allPassiveSkillIds = {}
local allPassiveSkillIdcompound = {}
local allOpenPassiveSkillIdcompound = {}
local compoundNum = 0
local compoundOPenNum = 0
if heroConfig.OpenPassiveSkillRules then
for i = 1, #heroConfig.OpenPassiveSkillRules do
if heroConfig.OpenPassiveSkillRules[i][1] == 1 then--突破
if breakId >= heroConfig.OpenPassiveSkillRules[i][2] then
table.insert(allPassiveSkillIds,heroConfig.OpenPassiveSkillRules[i][3])
if allOpenPassiveSkillIdcompound[heroConfig.OpenPassiveSkillRules[i][2]] then
allOpenPassiveSkillIdcompound[heroConfig.OpenPassiveSkillRules[i][2]] = allOpenPassiveSkillIdcompound[heroConfig.OpenPassiveSkillRules[i][2]] + 1
else
allOpenPassiveSkillIdcompound[heroConfig.OpenPassiveSkillRules[i][2]] = 1
end
end
else--升星
if upStarId >= heroConfig.OpenPassiveSkillRules[i][2] then
table.insert(allPassiveSkillIds,heroConfig.OpenPassiveSkillRules[i][3])
if allOpenPassiveSkillIdcompound[heroConfig.OpenPassiveSkillRules[i][2]] then
allOpenPassiveSkillIdcompound[heroConfig.OpenPassiveSkillRules[i][2]] = allOpenPassiveSkillIdcompound[heroConfig.OpenPassiveSkillRules[i][2]] + 1
else
allOpenPassiveSkillIdcompound[heroConfig.OpenPassiveSkillRules[i][2]] = 1
end
end
end
if allPassiveSkillIdcompound[heroConfig.OpenPassiveSkillRules[i][2]] then
allPassiveSkillIdcompound[heroConfig.OpenPassiveSkillRules[i][2]] = allPassiveSkillIdcompound[heroConfig.OpenPassiveSkillRules[i][2]] + 1
else
allPassiveSkillIdcompound[heroConfig.OpenPassiveSkillRules[i][2]] = 1
end
end
end
for i, v in pairs(allPassiveSkillIdcompound) do
if v > 1 then
compoundNum = compoundNum + 1
end
end
for i, v in pairs(allOpenPassiveSkillIdcompound) do
if v > 1 then
compoundOPenNum = compoundOPenNum + 1
end
end
return allPassiveSkillIds,compoundOPenNum,compoundNum
end
--战中英雄被动技获取
function this.GetHeroAllPassiveSkillIds(curHeroData)
local allPassiveSkillIds = {}
if not curHeroData then return allPassiveSkillIds end
--英雄天赋被动技
if curHeroData.heroConfig.OpenPassiveSkillRules then
local openPassiveSkillRules = curHeroData.heroConfig.OpenPassiveSkillRules
for i = 1, #openPassiveSkillRules do
local skillType = openPassiveSkillRules[i][1]
local skillRanUpId = openPassiveSkillRules[i][2]
local skillId = openPassiveSkillRules[i][3]
if skillType == 1 then--突破
if curHeroData.breakId >= skillRanUpId and passiveSkillLogicConfig[skillId].EffectiveRange == 1 then
table.insert(allPassiveSkillIds,skillId)
end
else--升星
if curHeroData.upStarId >= skillRanUpId and passiveSkillLogicConfig[skillId].EffectiveRange == 1 then
table.insert(allPassiveSkillIds,skillId)
end
end
end
end
--法宝被动技
if curHeroData.heroConfig.EquipTalismana and curHeroData.star >= curHeroData.heroConfig.EquipTalismana[1] then
local curTalisman = ConfigManager.GetConfigData(ConfigName.HeroConfig,curHeroData.id).EquipTalismana
if curTalisman and curTalisman[2] then
local talismanConFig = ConfigManager.GetConfigDataByDoubleKey(ConfigName.EquipTalismana, "TalismanaId", curTalisman[2],
"Level", curHeroData.talismanList)
if talismanConFig then
--当前法宝全部天赋数据(天赋可能为空)
local dowerAllData = ConfigManager.GetAllConfigsDataByKey(ConfigName.EquipTalismana,"TalismanaId",curTalisman[2])
for i = 1, #dowerAllData do
if dowerAllData[i].OpenSkillRules and curHeroData.talismanList >= dowerAllData[i].Level then
for k = 1, #dowerAllData[i].OpenSkillRules do
if passiveSkillLogicConfig[dowerAllData[i].OpenSkillRules[k]].EffectiveRange == 1 then
table.insert(allPassiveSkillIds,dowerAllData[i].OpenSkillRules[k])
end
end
end
end
end
end
end
--魂印被动技
if(table.nums(curHeroData.soulPrintList) >= 1) then
for i = 1, #curHeroData.soulPrintList do
local cursoulPrintConfig = equipConfig[curHeroData.soulPrintList[i].equipId]
if cursoulPrintConfig and passiveSkillLogicConfig[cursoulPrintConfig.PassiveSkill].EffectiveRange == 1 then
table.insert(allPassiveSkillIds,cursoulPrintConfig.PassiveSkill)
end
end
end
for i = 1, #allPassiveSkillIds do
LogError("allPassiveSkillIds "..allPassiveSkillIds[i])
end
return allPassiveSkillIds
end
--获取当前类型英雄是否存在
function this.GetCurHeroIsHaveBySid(heroSId)
for i,v in pairs(heroDatas) do
if v.id == heroSId then
return true
end
end
return false
end
-- 角色定位相关
-- 判断该角色是否开启定位 sid 英雄静态ID
function this.IsHeroPosOpen(did)
return this.GetSingleHeroData(did).heroConfig.RecommendTeamId[1]~=0
end
return this