【新战斗力计算】1

dev_chengFeng
zhangqiang 2021-01-22 16:53:50 +08:00
parent 1d26186851
commit f283d579c4
29 changed files with 1527 additions and 66 deletions

View File

@ -81,14 +81,12 @@ HeroOccupationDef = {
[4] = Language[12041],
[5] = Language[12042]
}
HeroProfessionIndexDef = {
WuWei = 1,
TianFa = 2,
MiFa = 3,
XuanCe = 4,
ShengHua = 5
Hero_Profession_Type = {
Shield = 1,
Carry = 2,
Control = 3,
Sub = 4,
}
--品质框背景图片定义
QualityBgDef = {
[1] = "r_characterbg_gray",

View File

@ -26,6 +26,8 @@ local ManagerNames = {
"Battle/BattleRecordManager",
--英雄数据管理
"Hero/HeroManager",
"Hero/HeroPowerManager",
"Hero/HeroPropManager",
--背包数据管理
"Bag/BagManager",
--关卡数据管理

View File

@ -174,7 +174,7 @@ function DemonPartsUpStarSuccessPanel:GetPropFormatStr(propId, heroInfo, extraVa
if propConfig.TargetPropertyId ~= 0 then
propId = propConfig.TargetPropertyId
end
local allAddProVal = HeroManager.CalculateHeroAllProValList(1, heroInfo.dynamicId, false)
local allAddProVal = HeroPropManager.GetHeroProp(heroInfo.dynamicId)
local result
--if extraValue then
-- if propConfig.Style == 1 then

View File

@ -162,6 +162,17 @@ function this.GetSingleHeroSingleEquipData(_equipid, _heroDid)
end
end
function this.GetHeroEquipsBydIds(_heroDid, _equipIds)
local list = {}
for _, equipId in ipairs(_equipIds) do
local equip = this.GetSingleHeroSingleEquipData(equipId, _heroDid)
if equip then
table.insert(list, equip)
end
end
return list
end
-- --工坊 获得装备品品质获得装备list
-- function this.WorkShopGetEquipDataByEquipQuality(_equipQuality, _rebuildEquipDid)
-- local equips = {}

View File

@ -117,8 +117,8 @@ function FormationEditPopup:BindEvent()
heros = HeroManager.GetHeroDataByProperty(proId, _LimitLevel)
end
table.sort(heros,function(a,b)
local aWarPower = HeroManager.CalculateHeroAllProValList(1,a.dynamicId,false)[HeroProType.WarPower]
local bWarPower = HeroManager.CalculateHeroAllProValList(1,b.dynamicId,false)[HeroProType.WarPower]
local aWarPower = HeroPowerManager.GetHeroPower(a.dynamicId)
local bWarPower = HeroPowerManager.GetHeroPower(b.dynamicId)
if aWarPower==bWarPower then
return a.id>b.id
else

View File

@ -85,7 +85,20 @@ function this.UpdateFormation(msg)
-- 获取数据时检测一下公会战防守数据
this.CheckGuildFightDefendFormation()
end
--刷新临时编队数据
function this.UpdateTemporaryFormation(TeamPosInfo)
local curFormation = {}
curFormation.teamId = FormationTypeDef.FORMATION_TEMPORARY
curFormation.teamName = "临时"
curFormation.teamHeroInfos = {}
curFormation.teamPokemonInfos = {}
if #TeamPosInfo > 0 then
for j = 1, #TeamPosInfo do
table.insert(curFormation.teamHeroInfos, TeamPosInfo[j])
end
end
this.formationList[FormationTypeDef.FORMATION_TEMPORARY] = curFormation
end
-- function this.SetCurFormationIndex()
-- local curIndex = 1
-- local curMapId = PlayerManager.curMapId
@ -232,17 +245,22 @@ function this.GetFormationPower(formationId)
--for i, v in pairs(allHeroTeamAddProVal) do
-- LogError("团队加成 "..i .." " .. v)
--end
LogPink("计算编队战斗力: "..formationId)
local power = 0
for i = 1, 6 do
if formationList.teamHeroInfos[i] then
local heroData = HeroManager.GetSingleHeroData(formationList.teamHeroInfos[i].heroId)
--1, curHeroData.dynamicId, false,nil,nil,true,allHeroTeamAddProVal)
local allHeroTeamAddProVal = HeroManager.GetAllHeroTeamAddProVal(formationList.teamHeroInfos,formationList.teamHeroInfos[i].heroId)
local allEquipAddProVal = HeroManager.CalculateHeroAllProValList(1, heroData.dynamicId,false,nil,nil,true,allHeroTeamAddProVal)
power = power + allEquipAddProVal[HeroProType.WarPower]
power = power + HeroPowerManager.GetHeroPower(heroData.dynamicId, formationId)
end
end
LogRed("原方式战斗力:"..power)
local power2 = 0
for i = 1, 6 do
if formationList.teamHeroInfos[i] then
power2 = power2 + HeroPowerManager.GetHeroPower(formationList.teamHeroInfos[i].heroId, formationId)
end
end
LogGreen("新方式战斗力:"..power2)
-- 主线编队战斗力
ThinkingAnalyticsManager.SetSuperProperties({
@ -266,6 +284,19 @@ function this.CheckHeroIdExist(heroId)
end)
-- end
end
-- 判断编队中是否有这个人
function this.CheckFormationHasId(formationId, heroId)
local has = false
if this.formationList and this.formationList[formationId] then
table.walk(this.formationList[formationId].teamHeroInfos, function(teamInfo)
if heroId == teamInfo.heroId then
has = true
end
end)
end
return has
end
function this.UserPowerChanged()
@ -526,5 +557,25 @@ function this.SetOneKeyGoWithoutUI(formationType,limitLevel)
--保存编队
FormationManager.RefreshFormation(formationType, choosedList,FormationManager.formationList[formationType].teamPokemonInfos)
end
-- 获取编队元素加成
function this.GetFormationElementAdd(type)
local propList = {}
local curFormation = this.GetFormationByID(type)
if not curFormation then return propList end
local index= this.GetElementIndex(curFormation.teamHeroInfos)
if index==0 then return propList end
local config=ConfigManager.GetConfig(ConfigName.ElementalResonanceConfig)
for i = 1, #config[index].Content do
local propId = config[index].Content[i][1]
local value = config[index].Content[i][2]
if not propList[propId] then
propList[propId] = 0
end
propList[propId] = propList[propId] + value
end
return propList
end
return this

View File

@ -72,6 +72,8 @@ function this.InitHeroData(_msgHeroList)
--赋值每个星级的英雄等级上限
-- this.UpdateHeroPower()
--赋值英雄战力
-- 计算所有人的战斗力
HeroPowerManager.InitAllPower()
end
--刷新本地数据
@ -171,11 +173,17 @@ function this.UpdateHeroDatas(_msgHeroData, isFindHandBook)
if isFindHandBook then --图鉴
PlayerManager.SetHeroHandBookListData(heroData.id, heroData.star)
end
heroData.warPower = this.CalculateHeroAllProValList(1, heroData.dynamicId, false)[HeroProType.WarPower]
heroData.warPower = HeroPowerManager.GetHeroPower(heroData.dynamicId)
--远征初始化血量
--ExpeditionManager.InitHeroHpValue(heroData)
end
-- 获取所有英雄数据
function this.GetAllHeroList()
return heroDatas
end
function this.ChangeSkinId(heroId,skinId)
heroDatas[heroId].skinId = skinId
if skinId == 0 then
@ -506,6 +514,11 @@ function this.UpdateSingleHeroDatas(heroDId, heroLv, heroStar, breakId, upStarId
)
PlayerManager.SetHeroHandBookListData(heroDatas[heroDId].id, heroDatas[heroDId].star)
end
-- 英雄基础数据变化
HeroPropManager.SetDirtyByType(heroDId, Hero_Prop_Type.Base)
HeroPropManager.SetDirtyByType(heroDId, Hero_Prop_Type.PassiveSkill)
if isCallBackChangeWar then
this.CompareWarPower(heroDId)
end
@ -519,7 +532,7 @@ end
--对比战力并更新战力值
function this.CompareWarPower(heroDId)
local oldWarPowerValue = heroDatas[heroDId].warPower
local newWarPowerValue = this.CalculateHeroAllProValList(1, heroDId, false)[HeroProType.WarPower]
local newWarPowerValue = HeroPowerManager.GetHeroPower(heroDId)
heroDatas[heroDId].warPower = newWarPowerValue
if oldWarPowerValue and newWarPowerValue then
if oldWarPowerValue ~= newWarPowerValue then
@ -849,7 +862,7 @@ function this.GetCurHeroStarLvEnd(getValType, curHeroData, _breakId, _upStarId)
end
function this.UpdateHeroPower()
for _, v in pairs(heroDatas) do
v.warPower = this.CalculateHeroAllProValList(1, v.dynamicId, false)[HeroProType.WarPower]
v.warPower = HeroPowerManager.GetHeroPower(v.dynamicId)
end
end
function this.UpdateHeroPowerProfession()
@ -1949,6 +1962,11 @@ curHeroData.MLSproList={}
-- LogError("最后allAddProVal 3 "..i.." "..v)
-- end
--end
LogGreenTable(allAddProVal)
LogRed("原方式:"..allAddProVal[HeroProType.WarPower])
local power = HeroPowerManager.GetHeroPower(_heroDid, _allHeroProVal and FormationTypeDef.FORMATION_NORMAL or nil)
LogRed("新方式:"..power)
return allAddProVal
end
function this.DoubleTableCompound(allProVal, addProVal)
@ -2041,7 +2059,7 @@ end
-- >火系伤害加成系数(%>火系伤害减免系数(%>冰系伤害加成系数(%>冰系伤害减免系数(%>雷系伤害加成系数(%>雷系伤害减免系数(%>风系伤害加成系数(%
-- >风系伤害减免系数(%>地系伤害加成系数(%>地系伤害减免系数(%>暗系伤害加成系数(%>暗系伤害减免系数(%
function this.CalculateWarAllProVal(heroDid)
local allEquipAddProVal = HeroManager.CalculateHeroAllProValList(1, heroDid, true)
local allEquipAddProVal = HeroPropManager.GetHeroProp(heroDid)--HeroManager.CalculateHeroAllProValList(1, heroDid, true)
local allProVal = {}
table.insert(allProVal, 1, HeroManager.GetSingleHeroData(heroDid).lv)
--等级
@ -3089,6 +3107,48 @@ function this.ResetHero(dynamicloadId)
end
FormationManager.ResolvDownBattleCurHeroId(dynamicloadId)
end
-- 创建用于计算英雄属性和战斗力的数据
function this.CreateHeroCountData(dId)
-- 默认数据
local heroData = {
dId = 0,
tId = 0,
lv = 1,
star = 1,
breakId = 1,
upStarId = 1,
equipList = {},
treasureList = {},
soulPrintList = {},
talismanLv = 1,
formationId = FormationTypeDef.FORMATION_NORMAL,
}
if not dId then
return heroData
end
local curHeroData = HeroManager.GetSingleHeroData(dId)
if not curHeroData then
return heroData
end
heroData.dId = curHeroData.dynamicId -- 动态id
heroData.tId = curHeroData.id -- 表id
heroData.lv = curHeroData.lv -- 等级
heroData.star = curHeroData.star -- 星级
heroData.breakId = curHeroData.breakId -- 突破id
heroData.upStarId = curHeroData.upStarId -- 升星id
heroData.equipList = EquipManager.GetHeroEquipsBydIds(curHeroData.dynamicId, curHeroData.equipIdList) -- 装备数据
heroData.treasureList = EquipTreasureManager.GetTreasuresBydIds(curHeroData.jewels) -- 宝器数据
heroData.soulPrintList = curHeroData.soulPrintList -- 魂印数据
heroData.talismanLv = curHeroData.talismanList -- 法宝等级
heroData.formationId = FormationTypeDef.FORMATION_NORMAL
return heroData
end
--神将合成
function this.ByCompoundHeroGetAllHeros()
local upSortHeroList = {}

View File

@ -0,0 +1,136 @@
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
HeroPowerManager = {}
local this = HeroPowerManager
--计算战斗力
local propToSS = {}
local function CalculateWarForce(powerVal)
local powerEndVal = 0
for i, v in pairs(powerVal) do
if v > 0 then
if not propToSS[i] then
propToSS[i] = {Style = propertyConfig[i].Style, Score = propertyConfig[i].Score, TargetPropertyId = propertyConfig[i].TargetPropertyId}
end
-- 计算战斗
local power = v * propToSS[i].Score
-- 万分比要转为百分比
if propToSS[i].Style == 2 then
power = power / 100
end
powerEndVal = powerEndVal + power
end
end
return math.floor(powerEndVal)
end
function this.Initialize()
this.HeroPowerList = {}
end
function this.LateUpdate()
if this.IsInitAll and this.coInitPower then
-- LogRed("coStatus : "..coroutine.status(this.coInitPower))
-- if coroutine.status(this.coInitPower) == "suspended" then
-- coroutine.resume(this.coInitPower)
-- end
end
end
-- 卸程计算每个人的战斗力
function this.CO_InitPower()
local heroList = HeroManager.GetAllHeroList()
LogRed("co start")
for k, v in pairs(heroList) do
local power = this.GetHeroPower(v.dynamicId)
v.warPower = power
LogRed("heroPower : "..v.dynamicId .. "|"..power)
-- coroutine.yield()
end
this.IsInitAll = false
this.coInitPower = nil
LogRed("co end")
end
-- 初始化所有人的战斗力
function this.InitAllPower()
this.IsInitAll = true
-- if not this.coInitPower then
-- this.coInitPower = coroutine.create(this.CO_InitPower)
-- end
this.CO_InitPower()
end
function this.CalPower(heroData, propList)
-- body
local config = heroConfig[heroData.tId]
local subProp = config.SecondaryFactor
if subProp then
for i = 1, #subProp do
local propType = subProp[i][1]
local propValue = subProp[i][2]
if propList[propType] then
propList[propType] = propList[propType] - propValue
end
end
end
-- 将百分比加成计算到人物身上
for k, v in pairs(propList) do
if not propToSS[k] then
local config = propertyConfig[k]
propToSS[k] = {Style = config.Style, Score = config.Score, TargetPropertyId = config.TargetPropertyId}
end
local tpId = propToSS[k].TargetPropertyId
if propList[k] > 0 and tpId > 0 then
propList[tpId] = math.floor( propList[tpId] + propList[tpId] * propList[k] / 10000)
end
end
LogPinkTable(propList)
return CalculateWarForce(propList)
end
-- 获取英雄战斗力
function this.GetHeroPower(dId, formationId)
-- 重新计算人物属性
local propList = HeroPropManager.GetHeroProp(dId, formationId)
--
-- 计算战斗力
local heroData = HeroManager.CreateHeroCountData(dId)
local allPower = this.CalPower(heroData, propList)
--
if not this.HeroPowerList[dId] then
this.HeroPowerList[dId] = {}
end
this.HeroPowerList[dId].allPower = allPower
LogGreen("allPower "..allPower)
return this.HeroPowerList[dId].allPower
end
-- 获取英雄战斗力
function this.GetNextHeroPower(dId, formationId,upStarId)
local curHeroData = HeroManager.GetSingleHeroData(dId)
local oldStarId = curHeroData.upStarId
HeroManager.UpdateSingleHeroDatas(dId, curHeroData.lv, curHeroData.star, curHeroData.breakId, upStarId)
local curAllPro = HeroPropManager.GetHeroProp(curHeroData.dynamicId,formationId)
local curPower = this.GetHeroPower(dId, formationId)
HeroManager.UpdateSingleHeroDatas(dId, curHeroData.lv, curHeroData.star, curHeroData.breakId, oldStarId)
return curAllPro,curPower
end
-- 通过玩家数据,获取战斗力
function this.GetHeroPowerByData(heroData, formationData)
end
return HeroPowerManager

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ede521d2ff4512f4aa196446281f1205
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,519 @@
-- debug用
local IsDebug = false
local emptyFunc = function()end
Log_Prop = IsDebug and Log or emptyFunc
LogRed_Prop = IsDebug and LogRed or emptyFunc
LogBlue_Prop = IsDebug and LogBlue or emptyFunc
LogGreen_Prop = IsDebug and LogGreen or emptyFunc
LogPink_Prop = IsDebug and LogPink or emptyFunc
LogRedTable_Prop = IsDebug and LogRedTable or emptyFunc
LogBlueTable_Prop = IsDebug and LogBlueTable or emptyFunc
LogGreenTable_Prop = IsDebug and LogGreenTable or emptyFunc
LogPinkTable_Prop = IsDebug and LogPinkTable or emptyFunc
--
require("Modules.Hero.PropHero")
require("Modules.Hero.PropFunc")
require("Modules.Hero.PropCondition")
HeroPropManager = {}
local this = HeroPropManager
-- 合并属性列表
local function 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
function this.Initialize()
this.AllPropList = {}
this.HeroPropList = {} -- 角色自身属性
this.IsHeroDirty = {} -- 判断数据是否需要刷新
this.ConList = {} -- 自身的一些条件
this.ConPropList = {} -- 条件属性
this.IsConPropDirty = {} -- 脏数据判断
this.TeamPropList = {} -- 角色自身对编队成员的加成
this.IsTeamPropDirty = {}
this.ConTeamList = {} -- 编队条件属性
this.DePropList = {} -- 减益属性
this.IsDePropDirty = {} -- 判断减益数据是否变化
this.FormationPropList = {} -- 编队共鸣属性
this.IsFormationDirty = {} -- 判断编队共鸣数据是否需要刷新
this.FuncPropList = {} -- 功能属性(作用于全体)
this.IsFuncDirty = {} -- 判断功能属性是否需要刷新
end
--
function this.LateUpdate()
end
function this.Get()
-- body
end
function this.GetHeroProp(dId, formationId)
local allPropList = {}
-- 获取基础属性
Log_Prop("基础属性")
local basePropList = this.GetBaseProp(dId)
LogGreenTable_Prop(basePropList)
DoubleTableCompound(allPropList, basePropList)
-- 自身条件属性加成
local conPropList = this.GetConditionProp(dId)
Log_Prop("自身条件属性")
LogGreenTable_Prop(conPropList)
DoubleTableCompound(allPropList, conPropList)
-- 获取功能属性加成
local heroData = HeroManager.CreateHeroCountData(dId)
local funcProp = this.GetAllFuncProp(heroData)
Log_Prop("功能属性")
LogGreenTable_Prop(funcProp)
DoubleTableCompound(allPropList, funcProp)
-- 计算减益属性
Log_Prop("减益属性")
this.CountDeProp(dId, allPropList)
-- 判断是否需要加入团队属性加成
if formationId and FormationManager.CheckFormationHasId(formationId, dId) then
local formationList = FormationManager.GetFormationByID(formationId)
table.walk(formationList.teamHeroInfos, function(teamInfo)
-- 团队属性加成
if teamInfo.heroId then
Log_Prop("团队属性")
local teamProp = this.GetTeamData(teamInfo.heroId)
LogGreenTable_Prop(teamProp)
DoubleTableCompound(allPropList, teamProp)
-- 团队条件属性加成
Log_Prop("团队条件属性")
local conTeamProp = this.GetConditionTeamData(teamInfo.heroId, dId)
LogGreenTable_Prop(conTeamProp)
DoubleTableCompound(allPropList, conTeamProp)
end
end)
-- 获取元素共鸣属性加成
Log_Prop("元素共鸣属性")
local formationProp = this.GetFormationProp(formationId)
LogGreenTable_Prop(formationProp)
DoubleTableCompound(allPropList, formationProp)
else
-- ******自己的团队属性对自己生效
-- 团队属性加成(
Log_Prop("团队属性")
local teamProp = this.GetTeamData(dId)
LogGreenTable_Prop(teamProp)
DoubleTableCompound(allPropList, teamProp)
-- 团队条件属性加成
Log_Prop("团队条件属性")
local conTeamProp = this.GetConditionTeamData(dId, dId)
LogGreenTable_Prop(conTeamProp)
DoubleTableCompound(allPropList, conTeamProp)
-- 没有元素共鸣
end
Log_Prop("总属性")
LogGreenTable_Prop(allPropList)
return allPropList
end
---=================== 基础属性======================================
-- 获取基础属性
function this.GetBaseProp(dId)
-- 刷新角色信息
this.RefreshHeroProp(dId)
local basePropList = this.HeroPropList[dId].propList
return basePropList
end
-- 刷新角色信息
function this.RefreshHeroProp(dId)
if not this.IsHeroDirty[dId] then
this.IsHeroDirty[dId] = {}
end
-- 如果脏数据为空
if this.IsHeroDirty[dId].isDirty ~= false then
-- 创建计算属性的数据
local list = {}
local cData = HeroManager.CreateHeroCountData(dId)
for _, powerType in pairs(Hero_Prop_Type) do
--
local propList, conList, teamPropList, conTeamList, dePropList
-- 判断该类型数据是否需要刷新
if this.IsHeroDirty[dId][powerType] ~= false and Hero_Prop_Func[powerType] then
-- 计算属性
propList, conList, teamPropList, conTeamList, dePropList = Hero_Prop_Func[powerType](cData)
-- 创建新的数据
this.NewHeroProp(dId, powerType, propList)
LogGreen_Prop(_)
LogPink_Prop("base")
LogPinkTable_Prop(propList)
-- 条件属性
if conList then
this.SetConditionData(dId, powerType, conList)
LogPink_Prop("con")
LogPinkTable_Prop(conList)
end
-- 对编队中其他人的数据
if teamPropList then
this.SetTeamData(dId, powerType, teamPropList)
LogPink_Prop("team")
LogPinkTable_Prop(teamPropList)
end
-- 对编队中其他人的数据
if conTeamList then
this.SetConditionTeamData(dId, powerType, conTeamList)
LogPink_Prop("conteam")
LogPinkTable_Prop(conTeamList)
end
-- 减益属性
if dePropList then
this.SetDePropData(dId, powerType, dePropList)
LogPink_Prop("deprop")
LogPinkTable_Prop(dePropList)
end
--
this.IsHeroDirty[dId][powerType] = false
end
-- 加入
DoubleTableCompound(list, this.HeroPropList[dId][powerType])
end
-- 保存属性
this.HeroPropList[dId].propList = list
this.IsHeroDirty[dId].isDirty = false
end
end
-- 计算英雄自身数据
function this.CalHeroPropByType(heroData, powerType)
if not Hero_Prop_Func[powerType] then
return
end
-- 计算属性
local propList, conList, teamPropList, conTeamList, dePropList = Hero_Prop_Func[powerType](heroData)
return propList, conList, teamPropList, conTeamList, dePropList
end
-- 刷新角色属性信息
function this.NewHeroProp(dId, powerType, propList)
-- 普通属性加成
if not this.HeroPropList[dId] then
this.HeroPropList[dId] = {}
end
this.HeroPropList[dId][powerType] = propList
-- 清理脏数据
if not this.IsHeroDirty[dId] then
this.IsHeroDirty[dId] = {}
end
this.IsHeroDirty[dId][powerType] = false
end
-- 设置脏数据
function this.SetDirtyByType(dId, powerType)
if not this.IsHeroDirty[dId] then
this.IsHeroDirty[dId] = {}
end
this.IsHeroDirty[dId][powerType] = true
this.IsHeroDirty[dId].isDirty = true
end
-- 将整个人置为脏数据
function this.SetHeroDirty(dId)
this.IsHeroDirty[dId] = {}
end
--=========================== 条件属性管理 ==========================
-- 设置脏数据
function this.SetConditionData(dId, powerType, condList)
-- 编队属性加成
if not this.ConList[dId] then
this.ConList[dId] = {}
end
this.ConList[dId][powerType] = condList
-- 清理脏数据
if not this.IsConPropDirty[dId] then
this.IsConPropDirty[dId] = {}
end
this.IsConPropDirty[dId][powerType] = true
this.IsConPropDirty[dId].isDirty = true
end
function this.SetConditionProp(dId, powerType, condProp)
-- 编队属性加成
if not this.ConPropList[dId] then
this.ConPropList[dId] = {}
end
this.ConPropList[dId][powerType] = condProp
end
-- 获取条件属性
function this.GetConditionPropByType(dId, powerType)
if this.ConPropList[dId] and this.ConPropList[dId][powerType] then
return this.ConPropList[dId][powerType]
end
return {}
end
-- 获取自身的条件属性
function this.GetConditionProp(dId)
-- 判空
if this.IsConPropDirty[dId] then
this.IsConPropDirty[dId] = {}
end
if this.IsConPropDirty[dId].isDirty ~= false then
-- 创建计算属性的数据
local list = {}
local cData = HeroManager.CreateHeroCountData(dId)
for _, powerType in pairs(Hero_Prop_Type) do
if this.IsConPropDirty[dId][powerType] ~= false then
local condProp = {}
if this.ConList[dId] and this.ConList[dId][powerType] then
for _, cond in ipairs(this.ConList[dId][powerType]) do
if Condition_Prop_Func[cond.type] then
local propList = Condition_Prop_Func[cond.type](cData, cData, cond.propList, cond.args)
DoubleTableCompound(condProp, propList)
end
end
end
-- 设置该类型条件属性
this.SetConditionProp(dId, powerType, condProp)
this.IsConPropDirty[dId][powerType] = false
end
-- 合并所有属性
local condProp = this.GetConditionPropByType(dId, powerType)
if condProp then
DoubleTableCompound(list, condProp)
this.IsConPropDirty[dId][powerType] = condProp
this.ConPropList[dId].propList = condProp
end
end
this.IsConPropDirty[dId].isDirty = false
end
return this.ConPropList[dId].propList
end
--=========================== 团队属性管理 ==========================
-- 设置脏数据
function this.SetTeamData(dId, powerType, propList)
-- 编队属性加成
if not this.TeamPropList[dId] then
this.TeamPropList[dId] = {}
end
this.TeamPropList[dId][powerType] = propList
-- 清理脏数据
if not this.IsTeamPropDirty[dId] then
this.IsTeamPropDirty[dId] = {}
end
this.IsTeamPropDirty[dId].isDirty = true
end
-- 刷新编队属性
function this.RefreshTeamData(dId)
-- 判空
if not this.IsTeamPropDirty[dId] then
this.IsTeamPropDirty[dId] = {}
end
-- 判断是否需要刷新
if this.IsTeamPropDirty[dId].isDirty ~= false then
-- 创建计算属性的数据
local list = {}
for _, powerType in pairs(Hero_Prop_Type) do
DoubleTableCompound(list, this.TeamPropList[dId][powerType])
end
--
this.TeamPropList[dId].propList = list
this.IsTeamPropDirty[dId].isDirty = false
end
end
-- 获取个人对编队的加成属性
function this.GetTeamData(dId)
-- 刷新团队加成属性
this.RefreshTeamData(dId)
--
if not this.TeamPropList[dId] then
return
end
return this.TeamPropList[dId].propList
end
--=========================== 团队条件属性管理 ==========================
-- 设置脏数据
function this.SetConditionTeamData(dId, powerType, condList)
-- 编队属性加成
if not this.ConTeamList[dId] then
this.ConTeamList[dId] = {}
end
this.ConTeamList[dId][powerType] = condList
end
-- 获取团队条件数据(动态计算,不缓存属性)
function this.GetConditionTeamData(dId, tdId)
local list = {}
if this.ConTeamList[dId] then
local dData = HeroManager.CreateHeroCountData(dId)
local tdData = HeroManager.CreateHeroCountData(tdId)
for powerType, conds in pairs(this.ConTeamList[dId]) do
for _, cond in ipairs(conds) do
if Condition_Prop_Func[cond.type] then
local propList = Condition_Prop_Func[cond.type](dData, tdData, cond.propList, cond.args)
DoubleTableCompound(list, propList)
end
end
end
end
return list
end
--=========================== 减益属性管理 ==========================
--
function this.SetDePropData(dId, powerType, propList)
-- 减益属性
if not this.DePropList[dId] then
this.DePropList[dId] = {}
end
this.DePropList[dId][powerType] = propList
end
-- 计算减益
function this.CountDeProp(dId, allPropList)
if this.DePropList[dId] then
for powerType, props in pairs(this.DePropList[dId]) do
for _, prop in ipairs(props) do
local id = prop.propId
local v = prop.value
LogGreenTable_Prop(string.format("%s|%s", id, v))
allPropList[id] = allPropList[id] * (1 - v / 10000)
end
end
end
end
-- ===============================================编队属性管理 ===================================
-- ===============================================编队属性管理 ===================================
-- ===============================================编队属性管理 ===================================
-- 刷新编队数据
function this.RefreshFormationProp(formationId)
if this.IsFormationDirty[formationId] ~= false then
local teamAddPro = FormationManager.GetFormationElementAdd(FormationTypeDef.FORMATION_NORMAL)
this.FormationPropList[formationId] = teamAddPro
this.IsFormationDirty[formationId] = false
end
end
-- 设置编队数据变动
function this.SetFormationPropDirty(formationId)
this.IsFormationDirty[formationId] = true
end
-- 获取编队加成属性
function this.GetFormationProp(formationId)
this.RefreshFormationProp(formationId)
return this.FormationPropList[formationId]
end
--================================================ 功能属性管理 ====================================
--================================================ 功能属性管理 ====================================
--================================================ 功能属性管理 ====================================
-- 刷新编队数据
function this.RefreshFuncProp()
if this.IsFuncDirty.isDirty ~= false then
for _, funcPropId in pairs(Func_Prop_Type) do
if this.IsFuncDirty[funcPropId] ~= false then
local fData = Func_Prop_Func[funcPropId]()
this.FuncPropList[funcPropId] = fData
this.IsFuncDirty[funcPropId] = false
end
end
this.IsFuncDirty.isDirty = false
end
end
-- 获取功能属性加成
function this.GetFuncProp(heroData, funcPropId)
-- 检测是否刷新
this.RefreshFuncProp()
-- 获取活动数据
local fData = this.FuncPropList[funcPropId]
local propList = {}
if fData then
local filter = Func_Prop_Filter[funcPropId]
if filter then
propList = filter(fData, heroData)
end
end
return propList
end
-- 获取全部活动属性加成
function this.GetAllFuncProp(heroData)
-- 检测是否刷新
this.RefreshFuncProp()
--
local allPropList ={}
for _, funcPropId in pairs(Func_Prop_Type) do
local propList = this.GetFuncProp(heroData, funcPropId)
if propList then
DoubleTableCompound(allPropList, propList)
end
end
return allPropList
end
-- 设置编队数据变动
function this.SetFuncPropDirty(funcPropId)
if not this.IsFuncDirty[funcPropId] then
this.IsFuncDirty[funcPropId] = {}
end
this.IsFuncDirty[funcPropId] = true
this.IsFuncDirty.isDirty = true
end
return HeroPropManager

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: aca12aa1b2ac4f445bdcb8927c92c422
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,158 @@
-- debug用
local IsDebug = false
local emptyFunc = function()end
Log_Prop = IsDebug and Log or emptyFunc
LogRed_Prop = IsDebug and LogRed or emptyFunc
LogBlue_Prop = IsDebug and LogBlue or emptyFunc
LogGreen_Prop = IsDebug and LogGreen or emptyFunc
LogPink_Prop = IsDebug and LogPink or emptyFunc
LogRedTable_Prop = IsDebug and LogRedTable or emptyFunc
LogBlueTable_Prop = IsDebug and LogBlueTable or emptyFunc
LogGreenTable_Prop = IsDebug and LogGreenTable or emptyFunc
LogPinkTable_Prop = IsDebug and LogPinkTable or emptyFunc
--
require("Modules.Hero.PropHero")
require("Modules.Hero.PropFunc")
require("Modules.Hero.PropCondition")
HeroTempPropManager = {}
local this = HeroTempPropManager
-- 合并属性列表
local function 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
function this.Initialize()
end
-- 根据heroData获取人物属性
function this.GetHeroProp(heroData, formationData)
local allPropList = {}
-- 获取基础属性
local basePropList, conPropList, teamPropList, conTeamPropList, dePropList = this.GetBaseProp(heroData)
Log_Prop("基础属性")
LogGreenTable_Prop(basePropList)
DoubleTableCompound(allPropList, basePropList)
--
Log_Prop("自身条件属性")
LogGreenTable_Prop(conPropList)
DoubleTableCompound(allPropList, conPropList)
-- 计算减益属性
Log_Prop("减益属性")
this.CountDeProp(dePropList, allPropList)
-- 团队属性加成
Log_Prop("团队属性")
LogGreenTable_Prop(teamPropList)
DoubleTableCompound(allPropList, teamPropList)
-- 团队条件属性加成
Log_Prop("团队条件属性")
LogGreenTable_Prop(conTeamPropList)
DoubleTableCompound(allPropList, conTeamPropList)
Log_Prop("总属性")
LogGreenTable_Prop(allPropList)
return allPropList
end
---=================== 基础属性======================================
-- 获取基础属性
function this.GetBaseProp(heroData)
local basePropList = {}
local conPropList = {}
local teamPropList = {}
local conTeamPropList = {}
local dePropList = {}
for _, powerType in pairs(Hero_Prop_Type) do
LogGreen_Prop(_)
--
-- 判断该类型数据是否需要刷新
if Hero_Prop_Func[powerType] then
-- 计算属性
local propList, conList, tPropList, conTeamList, deProps = Hero_Prop_Func[powerType](heroData)
if propList then
DoubleTableCompound(basePropList, propList)
end
LogPink_Prop("base")
LogPinkTable_Prop(propList)
-- 条件属性
if conList then
LogPink_Prop("con")
for _, cond in ipairs(conList) do
if Condition_Prop_Func[cond.type] then
local propList = Condition_Prop_Func[cond.type](heroData, heroData, cond.propList, cond.args)
DoubleTableCompound(conPropList, propList)
LogPinkTable_Prop(propList)
end
end
end
-- 对编队中其他人的数据
if teamPropList then
DoubleTableCompound(teamPropList, tPropList)
LogPink_Prop("team")
LogPinkTable_Prop(tPropList)
end
-- 对编队中其他人的数据
if conTeamList then
LogPink_Prop("conteam")
for _, cond in ipairs(conTeamList) do
if Condition_Prop_Func[cond.type] then
local propList = Condition_Prop_Func[cond.type](heroData, heroData, cond.propList, cond.args)
DoubleTableCompound(conTeamPropList, propList)
LogPinkTable_Prop(propList)
end
end
end
-- 减益属性
if dePropList then
for _, deProp in ipairs(deProps) do
table.insert(dePropList, deProp)
end
LogPink_Prop("deprop")
LogPinkTable_Prop(deProps)
end
end
end
return basePropList, conPropList, teamPropList, conTeamPropList, dePropList
end
-- 计算减益
function this.CountDeProp(dePropList, allPropList)
if dePropList then
for _, prop in ipairs(dePropList) do
local id = prop.propId
local v = prop.value
LogGreenTable_Prop(string.format("%s|%s", id, v))
allPropList[id] = allPropList[id] * (1 - v / 10000)
end
end
end
return HeroPropManager

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 31078511b280362439e00bcd4317fa89
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,36 @@
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
Condition_Prop_Type = {
LV_100 = 1,
ELE_TEAM_ADD = 2,
}
Condition_Prop_Func = {
[Condition_Prop_Type.LV_100] = function(ower, target, propList, args)
local list = {}
if ower.tId == target.tId then -- 只对自己生效
local forNum = target.lv - 100
if forNum > 0 then
for propId, value in pairs(propList) do
list[propId] = value * forNum
end
end
end
return list
end,
[Condition_Prop_Type.ELE_TEAM_ADD] = function(ower, target, propList, args)
--
local config = heroConfig[target.tId]
-- 判断元素是否符合条件
if config and args and config == args[4] then
return propList
end
end
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9b33057a73f4e63428f95d1f90f4724e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,39 @@
local HeroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
-- 功能属性类型
Func_Prop_Type = {
Vip = 2,
GuildSkill = 3,
}
-- 计算需要缓存数据的方法
Func_Prop_Func = {
-- 工会技能
[Func_Prop_Type.GuildSkill] = function()
local profPropList = {}
for _, prof in pairs(Hero_Profession_Type) do
profPropList[prof] = GuildSkillManager.HeroCalculateGuildSkillWarForce(prof)
end
return profPropList
end,
-- Vip属性加成
[Func_Prop_Type.Vip] = function()
local vipAddPro = VipManager.GetAddPro()
return vipAddPro
end
}
-- 功能属性针对个人的筛选器
Func_Prop_Filter = {
[Func_Prop_Type.GuildSkill] = function(funcData, heroData)
local config = HeroConfig[heroData.tId]
return funcData[config.Profession]
end,
-- Vip属性加成
[Func_Prop_Type.Vip] = function(funcData, heroData)
return funcData
end
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c18dcb8b6650e8c4290284f0de8b5390
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,419 @@
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
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 passiveSkillLogicConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillLogicConfig)
Hero_Prop_Type = {
Base = 0,
Equip = 1,
EquipTreasure = 2,
PassiveSkill = 4,
Talisman = 5,
SoulPrint = 6,
SkinAdd = 7,--皮肤
-- GuildSkill = 8,--公会技能
-- ElementAdd = 9,--光环
-- VipAdd = 10,--vip加成
-- Pokemon = 11,--灵兽加成
}
local BattlePropToConfig = {}
local TargetPropToConfig = {}
-- 将战斗中的被动属性转为ui用的属性
local function BattlePropToUIProp(id, v, ct)
if not BattlePropToConfig[id] then
BattlePropToConfig[id] = ConfigManager.GetConfigDataByKey(ConfigName.PropertyConfig, "PropertyIdInBattle", id)
end
local config = BattlePropToConfig[id]
if not config then
return id, v
end
local propId = config.PropertyId
local style = config.Style
local value = style == 1 and v or v * 10000
if ct == 1 then
return propId, value
elseif ct == 2 then
-- 对固定值的百分比加成转换成 对应的属性
if style == 1 then
if not TargetPropToConfig[propId] then
TargetPropToConfig[propId] = ConfigManager.TryGetConfigDataByKey(ConfigName.PropertyConfig, "TargetPropertyId", propId)
end
if TargetPropToConfig[propId] then
local propId2 = TargetPropToConfig[propId].PropertyId
local value = TargetPropToConfig[propId].Style == 1 and v or v * 10000
if propId2 then
return propId2, value
end
end
end
return propId, value
elseif ct == 3 then
return propId, -value
elseif ct == 4 then
return propId, value
end
end
-- 被动技能转换为属性列表
local function PassiveListToPropList(skillids)
local propList = {} -- 自身属性
local conPropList = {} -- 条件属性
local teamPropList = {} -- 团队属性
local conTeamPropList = {} -- 团队条件属性
local dePropList = {} -- 百分比减益属性(特殊计算)
for i = 1, #skillids do
local skillid = skillids[i]
if passiveSkillLogicConfig[skillid] then
local curSkillData = passiveSkillLogicConfig[skillid]
if curSkillData.EffectiveRange > 1 then
local args = curSkillData.Value
-- 计算
local pId, v, ct
if curSkillData.Type == 90 then -- [a]增加[b][c]改变 || a[属性]b[float]c[改变类型]
pId, v, ct = args[1], args[2], args[3]
elseif curSkillData.Type == 94 then -- 全体上阵武将增加[a]%[b],[c]改变 || a[float]b[属性]c[改变类型]
pId, v, ct = args[2], args[1], args[3]
elseif curSkillData.Type == 171 then -- 武将100级后每升一级[a]额外增加[b][c]改变(战斗外实现) || a[属性]b[float]c[改变类型]
pId, v, ct = args[1], args[2], args[3]
elseif curSkillData.Type == 129 then -- 全体上阵[a]元素角色增加[b]%[c][d]改变 || a[元素]b[float]c[属性]d[改变类型]
pId, v, ct = args[3], args[2], args[4]
end
-- 获取UI属性
LogRed_Prop(string.format("args = %s|%s|%s", pId, v, ct))
local propId, value = BattlePropToUIProp(pId, v, ct)
LogRed_Prop(string.format("prop = %s|%s", propId, value))
if curSkillData.EffectiveRange == 2 then --战前个人
if ct == 4 then -- 减益效果
table.insert(dePropList, {propId = propId ,value = value})
elseif curSkillData.Type == 171 then -- 100级才开始加成(个人条件属性)
local propList = {}
propList[propId] = value
table.insert(conPropList, {type = Condition_Prop_Type.LV_100, propList = propList, args = args})
else
if not propList[propId] then
propList[propId] = 0
end
propList[propId] = propList[propId] + value
end
else
-- 条件
if curSkillData.Type == 129 then -- (团队条件属性)
local propList = {}
propList[propId] = value
table.insert(conTeamPropList, {type = Condition_Prop_Type.ELE_TEAM_ADD, propList = propList, args = args})
else
if not teamPropList[propId] then
teamPropList[propId] = 0
end
teamPropList[propId] = teamPropList[propId] + value
end
end
end
end
end
return propList, conPropList, teamPropList, conTeamPropList, dePropList
end
Hero_Prop_Func = {
-- 基础属性计算
[Hero_Prop_Type.Base] = function(_heroData)
local allAddProVal = {}
local tData = heroConfig[_heroData.tId]
local curLvNum = _heroData.lv
local breakId = _heroData.breakId
local upStarId = _heroData.upStarId
allAddProVal[HeroProType.Attack] = HeroManager.CalculateProVal( tData.Attack, curLvNum,breakId, upStarId, HeroProType.Attack)
allAddProVal[HeroProType.Hp] = HeroManager.CalculateProVal(tData.Hp, curLvNum, breakId, upStarId, HeroProType.Hp)
allAddProVal[HeroProType.PhysicalDefence] = HeroManager.CalculateProVal(tData.PhysicalDefence, curLvNum, breakId, upStarId, HeroProType.PhysicalDefence)
allAddProVal[HeroProType.MagicDefence] = HeroManager.CalculateProVal(tData.MagicDefence, curLvNum, breakId, upStarId, HeroProType.MagicDefence)
local subProp = tData.SecondaryFactor
if subProp then
for i = 1, #subProp do
local propType = subProp[i][1]
local propValue = subProp[i][2]
if not allAddProVal[propType] then
allAddProVal[propType] = 0
end
allAddProVal[propType] = allAddProVal[propType] + propValue
end
end
return allAddProVal
end,
-- 普通装备
[Hero_Prop_Type.Equip] = function(_heroData)
local addAllProVal = {}
for i, v in ConfigPairs(propertyConfig) do
addAllProVal[i] = 0
end
local tData = heroConfig[_heroData.tId]
local equipSuit = {}
--[id] = 件数
LogBlue("装备件数".. #_heroData.equipList)
for i = 1, #_heroData.equipList do
local curEquip = _heroData.equipList[i]
if curEquip then
for index, prop in ipairs(curEquip.mainAttribute) do
local id = prop.propertyId
local value = prop.propertyValue
if addAllProVal[id] then
addAllProVal[id] = addAllProVal[id] + value
else
addAllProVal[id] = value
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
return addAllProVal
end,
--英雄身上宝器属性计算
[Hero_Prop_Type.EquipTreasure] = function(_heroData)
local addAllProVal = {}
local minLv
local mainRefineLv
for i = 1, #_heroData.treasureList do
local curEuipTreaSureData = _heroData.treasureList[i]
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 #_heroData.treasureList > 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 #_heroData.treasureList > 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
return addAllProVal
end,
-- 计算所有英雄被动技能的属性值
[Hero_Prop_Type.PassiveSkill] = function(_heroData)
local allOpenPassiveSkillIds = HeroManager.GetAllPassiveSkillIds(heroConfig[_heroData.tId], _heroData.breakId, _heroData.upStarId)
--单体加成 --团体加成 --单体等级限制加成 --减乘
local propList, conPropList, teamPropList, conTeamPropList, dePropList = PassiveListToPropList(allOpenPassiveSkillIds)
return propList, conPropList, teamPropList, conTeamPropList, dePropList
end,
-- 法宝
[Hero_Prop_Type.Talisman] = function(_heroData)
local addAllProVal = {}
local propList, conPropList, teamPropList, conTeamPropList, dePropList
local star = _heroData.star
local profession = heroConfig[_heroData.tId].Profession
local curTalisman = heroConfig[_heroData.tId].EquipTalismana
if curTalisman and star >= curTalisman[1] then
local talismanConFig = ConfigManager.GetConfigDataByDoubleKey(ConfigName.EquipTalismana, "TalismanaId", curTalisman[2], "Level", _heroData.talismanLv)
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] == 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 _heroData.talismanLv >= dowerAllData[i].Level then
for k = 1, #dowerAllData[i].OpenSkillRules do
table.insert(skillIds, dowerAllData[i].OpenSkillRules[k])
end
end
end
--被动技能计算
if skillIds and #skillIds > 0 then --talismanConFig.OpenSkillRules and #talismanConFig.OpenSkillRules > 0 then
--单体加成 --单体等级限制加成 --团体加成 --减乘
propList, conPropList, teamPropList, conTeamPropList, dePropList = PassiveListToPropList(skillIds)
end
end
end
if propList and LengthOfTable(propList) > 0 then
for i, v in pairs(propList) do
if addAllProVal[i] then
addAllProVal[i] = addAllProVal[i] + v
else
addAllProVal[i] = v
end
end
end
return addAllProVal, conPropList, teamPropList, conTeamPropList, dePropList
end,
-- 魂印
[Hero_Prop_Type.SoulPrint] = function(_heroData)
local allSoulPrintAddWarPowerVal = 0
if (table.nums(_heroData.soulPrintList) >= 1) then
for i = 1, #_heroData.soulPrintList do
local cursoulPrintConfig = equipConfig[_heroData.soulPrintList[i].equipId]
if cursoulPrintConfig then
allSoulPrintAddWarPowerVal = allSoulPrintAddWarPowerVal + cursoulPrintConfig.Score
end
end
end
local allAddProVal = {}
allAddProVal[HeroProType.WarPower] = allSoulPrintAddWarPowerVal
return allAddProVal
end,
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 88a64841b0065614da68f41ec6511881
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1005,7 +1005,7 @@ function this.GetMapTeamPower()
if curFormation[i].allProVal[2] > 0 then
local allEquipAddProVal = 0
allEquipAddProVal = HeroManager.CalculateHeroAllProValList(1, heroData.dynamicId, false)
allEquipAddProVal = HeroPowerManager.GetHeroPower(heroData.dynamicId)
powerNum = powerNum + allEquipAddProVal[HeroProType.WarPower]
end
end

View File

@ -84,7 +84,7 @@ end
local allEquipAddProVal
function this.CalculateAllHeroPower(curHeroData)
allEquipAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false)
allEquipAddProVal = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
powerNum = powerNum + allEquipAddProVal[HeroProType.WarPower]
end

View File

@ -56,22 +56,11 @@ function MapRoleInfoPopup:OnOpen(...)
SetHeroStars(this.starGrid, curHeroData.star)
--计算面板属性
--this.xingDongExp.text = curHeroData.actionPower
--local allAddProVal=HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId)
--this.atk.text=allAddProVal[HeroProType.Attack]
--this.hp.text=allAddProVal[HeroProType.Hp]
--this.phyDef.text=allAddProVal[HeroProType.PhysicalDefence]
--this.magDef.text=allAddProVal[HeroProType.MagicDefence]
--this.speed.text= allAddProVal[HeroProType.Speed]
--计算战斗力 生命*0.7+(护甲+魔抗)*5+攻击*10+(暴击率+命中效果+效果抵抗率)*5+(属性攻击率+属性防御率)*30
--this.power.text ="战斗力:"..allAddProVal[HeroProType.WarPower]
--显示队伍的属性数据
local allAddProVal=HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId,false)
--计算战斗力 生命*0.7+(护甲+魔抗)*5+攻击*10+(暴击率+命中效果+效果抵抗率)*5+(属性攻击率+属性防御率)*30
this.power.text =Language[10105]..allAddProVal[HeroProType.WarPower]
--计算战斗力
this.power.text =Language[10105] .. HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
-- 计算属性
--显示队伍的属性数据
local allAddProVal=HeroPropManager.GetHeroProp(curHeroData.dynamicId)
local propList = FoodBuffManager.CalBuffPropValue(allPropValue)
this.atk.text = propList[4]
this.hp.text = propList[2]

View File

@ -244,7 +244,7 @@ function this.GetShowPanelData()
--星级
SetHeroStars(this.starGrid, heroBackData.star,2,Vector2.New(60,60),-11.92,Vector2.New(0.5,0.5))
--属性
local allAddProVal=HeroManager.CalculateHeroAllProValList(1,heroBackData.id,false)
local allAddProVal=HeroPropManager.GetHeroProp(heroBackData.id)
this.atk.text=allAddProVal[HeroProType.Attack]
this.hp.text=allAddProVal[HeroProType.Hp]
this.phyDef.text=allAddProVal[HeroProType.PhysicalDefence]

View File

@ -10,7 +10,7 @@ local equipConfig = ConfigManager.GetConfig(ConfigName.EquipConfig)
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
local heroRankupConfig=ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
local jewelConfig=ConfigManager.GetConfig(ConfigName.JewelConfig)
local choosedList
local formationId
local pinjieImage={"r_hero_pinjiebiao_01","r_hero_pinjiebiao_02"} --该死的品阶图片 1是未激活 2是激活
local orginLayer2 = 0
@ -210,14 +210,7 @@ function this.RoleInfo0()
if this.isOther then
this.power.text = curHeroData.actionPower
else
if choosedList then
--local formationList = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
local allHeroTeamAddProVal = HeroManager.GetAllHeroTeamAddProVal(choosedList,curHeroData.dynamicId)
allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData, false,nil,nil,true,allHeroTeamAddProVal)
else
allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData, false)
end
this.power.text = allAddProVal[HeroProType.WarPower]
this.power.text = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, formationId)
end
this.radar:SetEdges({ curHeroData.heroConfig.AttackScale / 100, curHeroData.heroConfig.DefenseScale / 100, curHeroData.heroConfig.AssistScale / 100 })
@ -269,6 +262,7 @@ function this.RoleInfo1()
--this.magDef.text = curHeroData.mDef
allAddProVal = curHeroData.allAddProVal
else
-- allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId, formationId)
if choosedList then
--local formationList = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
local allHeroTeamAddProVal = HeroManager.GetAllHeroTeamAddProVal(choosedList,curHeroData.dynamicId)

View File

@ -186,7 +186,6 @@ end
-- 刷新英雄列表显示
function this.RefreshHeroPanelShow()
--
local power = 0
local formationData = FormationManager.GetFormationByID(FormationManager.curFormationIndex)
for i = 1, 6 do
@ -200,8 +199,6 @@ function this.RefreshHeroPanelShow()
local heroDId = hero.heroId
local allEquipAddProVal = HeroManager.CalculateHeroAllProValList(1, heroDId, false)
power = power + allEquipAddProVal[HeroProType.WarPower]
local heroData = HeroManager.GetSingleHeroData(heroDId)
this.SingleHeroDataShow(this.groupBox[pos], heroData, pos)
@ -210,7 +207,7 @@ function this.RefreshHeroPanelShow()
this.ChooseHero(this.groupBox[pos], heroData, pos)
end
end
this.forceValue.text = power
this.forceValue.text = FormationManager.GetFormationPower(FormationManager.curFormationIndex)
end
-- 刷新成长选项

View File

@ -677,17 +677,20 @@ function this.ShowHeroEquip()
end
)
end
-- this.force.text = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
-- local allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false)
local allAddProVal
--计算面板属性
if isUpZhen then
local formationList = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
local allHeroTeamAddProVal = HeroManager.GetAllHeroTeamAddProVal(formationList.teamHeroInfos,curHeroData.dynamicId)
allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,true,allHeroTeamAddProVal)
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,true,allHeroTeamAddProVal)
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId,FormationTypeDef.FORMATION_NORMAL)
else
allAddProVal=HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
-- allAddProVal=HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId)
end
this.force.text = allAddProVal[HeroProType.WarPower]
this.force.text = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)--allAddProVal[HeroProType.WarPower]
end
function this:SetSelectBtn()

View File

@ -568,14 +568,16 @@ function this:UpdateHeroInfoData()
end
end
local allAddProVal = {}
local WarPower = 0
if isUpZhen then
local formationList = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
local allHeroTeamAddProVal = HeroManager.GetAllHeroTeamAddProVal(formationList.teamHeroInfos,curHeroData.dynamicId)
allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,true,allHeroTeamAddProVal)
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
else
allAddProVal = HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId)
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
end
this.force.text =allAddProVal[HeroProType.WarPower]
this.force.text = WarPower--allAddProVal[HeroProType.WarPower]
end
function this:ChangeCurentHeroSkinLive(herodata)
@ -589,14 +591,19 @@ function this:ChangeCurentHeroSkinLive(herodata)
curHeroPosition = herodata.Position
else
local allAddProVal = {}
local WarPower
if isUpZhen then
local formationList = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
local allHeroTeamAddProVal = HeroManager.GetAllHeroTeamAddProVal(formationList.teamHeroInfos,curHeroData.dynamicId)
allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,true,allHeroTeamAddProVal)
-- local formationList = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
-- local allHeroTeamAddProVal = HeroManager.GetAllHeroTeamAddProVal(formationList.teamHeroInfos,curHeroData.dynamicId)
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,true,allHeroTeamAddProVal)
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
else
allAddProVal = HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
end
this.force.text =allAddProVal[HeroProType.WarPower]
this.force.text = WarPower--allAddProVal[HeroProType.WarPower]
this.curLiveObj=HeroManager.LoadHerolive(curHeroData,this.curObj)
-- 清空临时保存的皮肤位置
curHeroPosition = nil

View File

@ -50,7 +50,7 @@ function RoleUpLvBreakSuccessPanel:OnOpen(...)
--计算面板属性old
local oldLvAllAddProVal=HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
local oldLvAllAddProVal= HeroPropManager.GetHeroProp(curHeroData.dynamicId)
this.upLvMaskPanleProAtk.text=oldLvAllAddProVal[HeroProType.Attack]
this.upLvMaskPanleProHp.text=oldLvAllAddProVal[HeroProType.Hp]
this.upLvMaskPanleProPhyDef.text=oldLvAllAddProVal[HeroProType.PhysicalDefence]

View File

@ -130,7 +130,7 @@ function RoleUpStarSuccessPanel:OnOpen(...)
this.lvEndInfo.text=string.format(Language[11867],curHeroRankUpConfigOpenLevel)
--计算面板属性old
local oldLvAllAddProVal=HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
local oldLvAllAddProVal= HeroPropManager.GetHeroProp(curHeroData.dynamicId)
this.upLvMaskPanleProAtk.text=oldLvAllAddProVal[HeroProType.Attack]
this.upLvMaskPanleProHp.text=oldLvAllAddProVal[HeroProType.Hp]
this.upLvMaskPanleProPhyDef.text=oldLvAllAddProVal[HeroProType.PhysicalDefence]