战斗力计算结构完善
parent
78be543392
commit
cd32937c82
|
|
@ -49,4 +49,47 @@ function LogColor(...)
|
||||||
elseif #args==4 then
|
elseif #args==4 then
|
||||||
Log("<color="..args[1]..">"..args[2].."</color>".." <color="..args[3]..">"..args[4].."</color>")
|
Log("<color="..args[1]..">"..args[2].."</color>".." <color="..args[3]..">"..args[4].."</color>")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function PrintBattleTable(tb)
|
||||||
|
local s = "{"
|
||||||
|
for k, v in pairs(tb) do
|
||||||
|
-- k
|
||||||
|
if type(k) == "number" then
|
||||||
|
s = s..string.format("[%s]=", k)
|
||||||
|
elseif type(k) == "string" then
|
||||||
|
s = s..string.format("%s=", k)
|
||||||
|
elseif type(k) == "table" then
|
||||||
|
s = s..string.format("[%s]=", "table")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- v
|
||||||
|
if type(v) == "number" or type(k) == "string" then
|
||||||
|
s = s..v..","
|
||||||
|
elseif type(k) == "table" then
|
||||||
|
s = s..PrintBattleTable(k)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return s.."}"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- 打印表
|
||||||
|
function LogGreenTable(t)
|
||||||
|
LogGreen(PrintBattleTable(t))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 打印表
|
||||||
|
function LogRedTable(t)
|
||||||
|
LogRed(PrintBattleTable(t))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 打印表
|
||||||
|
function LogBlueTable(t)
|
||||||
|
LogBlue(PrintBattleTable(t))
|
||||||
|
end
|
||||||
|
-- 打印表
|
||||||
|
function LogPinkTable(t)
|
||||||
|
LogPink(PrintBattleTable(t))
|
||||||
end
|
end
|
||||||
|
|
@ -170,6 +170,7 @@ function this.GetHeroEquipsBydIds(_heroDid, _equipIds)
|
||||||
table.insert(list, equip)
|
table.insert(list, equip)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return list
|
||||||
end
|
end
|
||||||
|
|
||||||
-- --工坊 获得装备品品质获得装备list
|
-- --工坊 获得装备品品质获得装备list
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,19 @@ function this.CheckHeroIdExist(heroId)
|
||||||
end)
|
end)
|
||||||
end
|
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()
|
function this.UserPowerChanged()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2848,7 +2848,7 @@ function this.CreateHeroCountData(dId)
|
||||||
heroData.star = curHeroData.star -- 星级
|
heroData.star = curHeroData.star -- 星级
|
||||||
heroData.breakId = curHeroData.breakId -- 突破id
|
heroData.breakId = curHeroData.breakId -- 突破id
|
||||||
heroData.upStarId = curHeroData.upStarId -- 升星id
|
heroData.upStarId = curHeroData.upStarId -- 升星id
|
||||||
heroData.equipList = EquipManager.GetHeroEquipsBydIds(curHeroData.equipIdList, curHeroData.dynamicId) -- 装备数据
|
heroData.equipList = EquipManager.GetHeroEquipsBydIds(curHeroData.dynamicId, curHeroData.equipIdList) -- 装备数据
|
||||||
heroData.treasureList = EquipTreasureManager.GetTreasuresBydIds(curHeroData.jewels) -- 宝器数据
|
heroData.treasureList = EquipTreasureManager.GetTreasuresBydIds(curHeroData.jewels) -- 宝器数据
|
||||||
heroData.soulPrintList = curHeroData.soulPrintList -- 魂印数据
|
heroData.soulPrintList = curHeroData.soulPrintList -- 魂印数据
|
||||||
heroData.talismanLv = curHeroData.talismanList -- 法宝等级
|
heroData.talismanLv = curHeroData.talismanList -- 法宝等级
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ function this.CO_InitPower()
|
||||||
local power = this.GetHeroPower(v.dynamicId)
|
local power = this.GetHeroPower(v.dynamicId)
|
||||||
v.warPower = power
|
v.warPower = power
|
||||||
LogRed("heroPower : "..v.dynamicId .. "|"..power)
|
LogRed("heroPower : "..v.dynamicId .. "|"..power)
|
||||||
coroutine.yield()
|
-- coroutine.yield()
|
||||||
end
|
end
|
||||||
this.IsInitAll = false
|
this.IsInitAll = false
|
||||||
this.coInitPower = nil
|
this.coInitPower = nil
|
||||||
|
|
@ -49,10 +49,10 @@ end
|
||||||
-- 初始化所有人的战斗力
|
-- 初始化所有人的战斗力
|
||||||
function this.InitAllPower()
|
function this.InitAllPower()
|
||||||
this.IsInitAll = true
|
this.IsInitAll = true
|
||||||
if not this.coInitPower then
|
-- if not this.coInitPower then
|
||||||
this.coInitPower = coroutine.create(this.CO_InitPower)
|
-- this.coInitPower = coroutine.create(this.CO_InitPower)
|
||||||
end
|
-- end
|
||||||
-- this.CO_InitPower()
|
this.CO_InitPower()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -60,24 +60,16 @@ end
|
||||||
|
|
||||||
|
|
||||||
-- 获取英雄战斗力
|
-- 获取英雄战斗力
|
||||||
function this.GetHeroPower(dId)
|
function this.GetHeroPower(dId, formationId)
|
||||||
-- 判断是否脏数据
|
-- 重新计算战斗力
|
||||||
if not this.IsDirty[dId] or this.IsDirty[dId].isDirty then
|
local propList = HeroPropManager.GetHeroProp(dId, formationId)
|
||||||
|
local allPower = CalculateWarForce(propList)
|
||||||
local propList = HeroPropManager.GetHeroProp(dId)
|
--
|
||||||
for _, powerType in pairs(Hero_Prop_Type) do
|
if not this.HeroPowerList[dId] then
|
||||||
local props = this.GetHeroPropByType(dId, powerData, powerType)
|
this.HeroPowerList[dId] = {}
|
||||||
HeroManager.DoubleTableCompound(propList, props)
|
|
||||||
end
|
|
||||||
-- 重新计算战斗力
|
|
||||||
local allPower = CalculateWarForce(propList)
|
|
||||||
this.HeroPropList[dId].allPower = allPower
|
|
||||||
-- 不再是脏数据
|
|
||||||
this.IsDirty[dId].isDirty = false
|
|
||||||
end
|
end
|
||||||
return this.HeroPropList[dId].allPower
|
this.HeroPowerList[dId].allPower = allPower
|
||||||
|
return this.HeroPowerList[dId].allPower
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return HeroPowerManager
|
return HeroPowerManager
|
||||||
|
|
@ -29,13 +29,17 @@ function this.Initialize()
|
||||||
this.HeroPropList = {} -- 角色自身属性
|
this.HeroPropList = {} -- 角色自身属性
|
||||||
this.IsHeroDirty = {} -- 判断数据是否需要刷新
|
this.IsHeroDirty = {} -- 判断数据是否需要刷新
|
||||||
|
|
||||||
this.ConList = {}
|
this.ConList = {} -- 自身的一些条件
|
||||||
this.ConPropList = {} -- 条件属性
|
this.ConPropList = {} -- 条件属性
|
||||||
this.IsConPropDirty = {}
|
this.IsConPropDirty = {} -- 脏数据判断
|
||||||
|
|
||||||
this.TeamPropList = {} -- 角色自身对编队成员的加成
|
this.TeamPropList = {} -- 角色自身对编队成员的加成
|
||||||
this.ConTeamPropList = {} -- 角色自身对编队成员的条件属性加成
|
this.IsTeamPropDirty = {}
|
||||||
this.DePropList = {} -- 减益属性
|
|
||||||
|
this.ConTeamList = {} -- 编队条件属性
|
||||||
|
|
||||||
|
this.DePropList = {} -- 减益属性
|
||||||
|
this.IsDePropDirty = {} -- 判断减益数据是否变化
|
||||||
|
|
||||||
this.FormationPropList = {} -- 编队共鸣属性
|
this.FormationPropList = {} -- 编队共鸣属性
|
||||||
this.IsFormationDirty = {} -- 判断编队共鸣数据是否需要刷新
|
this.IsFormationDirty = {} -- 判断编队共鸣数据是否需要刷新
|
||||||
|
|
@ -57,16 +61,82 @@ function this.Get()
|
||||||
-- body
|
-- body
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.GetHeroProp(dId)
|
function this.GetHeroProp(dId, formationId)
|
||||||
|
local allPropList = {}
|
||||||
|
-- 获取基础属性
|
||||||
|
Log("基础属性")
|
||||||
|
local basePropList = this.GetBaseProp(dId)
|
||||||
|
LogGreenTable(basePropList)
|
||||||
|
DoubleTableCompound(allPropList, basePropList)
|
||||||
|
|
||||||
|
-- 自身条件属性加成
|
||||||
|
local conPropList = this.GetConditionProp(dId)
|
||||||
|
Log("自身条件属性")
|
||||||
|
LogGreenTable(conPropList)
|
||||||
|
DoubleTableCompound(allPropList, conPropList)
|
||||||
|
|
||||||
|
-- 获取功能属性加成
|
||||||
|
local heroData = HeroManager.CreateHeroCountData(dId)
|
||||||
|
local funcProp = this.GetAllFuncProp(heroData)
|
||||||
|
Log("功能属性")
|
||||||
|
LogGreenTable(funcProp)
|
||||||
|
DoubleTableCompound(allPropList, funcProp)
|
||||||
|
|
||||||
|
-- 计算减益属性
|
||||||
|
Log("减益属性")
|
||||||
|
this.CountDeProp(dId, allPropList)
|
||||||
|
|
||||||
|
|
||||||
|
-- 判断是否需要加入团队属性加成
|
||||||
|
if formationId and FormationManager.CheckFormationHasId(formationId, dId) then
|
||||||
|
local formationList = FormationManager.GetFormationByID(formationId)
|
||||||
|
table.walk(formationList, function(teamInfo)
|
||||||
|
-- 团队属性加成
|
||||||
|
local teamProp = this.GetTeamData(teamInfo.heroId)
|
||||||
|
Log("团队属性")
|
||||||
|
LogGreenTable(teamProp)
|
||||||
|
DoubleTableCompound(allPropList, teamProp)
|
||||||
|
-- 团队条件属性加成
|
||||||
|
local conTeamProp = this.GetConditionTeamData(teamInfo.heroId, dId)
|
||||||
|
Log("团队条件属性")
|
||||||
|
LogGreenTable(conTeamProp)
|
||||||
|
DoubleTableCompound(allPropList, conTeamProp)
|
||||||
|
end)
|
||||||
|
-- 获取元素共鸣属性加成
|
||||||
|
local formationProp = this.GetFormationProp(formationId)
|
||||||
|
Log("元素共鸣属性")
|
||||||
|
LogGreenTable(formationProp)
|
||||||
|
DoubleTableCompound(allPropList, formationProp)
|
||||||
|
else
|
||||||
|
-- ******自己的团队属性对自己生效
|
||||||
|
-- 团队属性加成(
|
||||||
|
local teamProp = this.GetTeamData(dId)
|
||||||
|
Log("团队属性")
|
||||||
|
LogGreenTable(teamProp)
|
||||||
|
DoubleTableCompound(allPropList, teamProp)
|
||||||
|
-- 团队条件属性加成
|
||||||
|
local conTeamProp = this.GetConditionTeamData(dId, dId)
|
||||||
|
Log("团队条件属性")
|
||||||
|
LogGreenTable(conTeamProp)
|
||||||
|
DoubleTableCompound(allPropList, conTeamProp)
|
||||||
|
-- 没有元素共鸣
|
||||||
|
end
|
||||||
|
|
||||||
|
Log("总属性")
|
||||||
|
LogGreenTable(allPropList)
|
||||||
|
return allPropList
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---=================== 基础属性======================================
|
||||||
|
-- 获取基础属性
|
||||||
|
function this.GetBaseProp(dId)
|
||||||
-- 刷新角色信息
|
-- 刷新角色信息
|
||||||
this.RefreshHeroProp(dId)
|
this.RefreshHeroProp(dId)
|
||||||
local basePropList = this.HeroPropList[dId].propList
|
local basePropList = this.HeroPropList[dId].propList
|
||||||
|
return basePropList
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- 刷新角色信息
|
-- 刷新角色信息
|
||||||
function this.RefreshHeroProp(dId)
|
function this.RefreshHeroProp(dId)
|
||||||
if not this.IsHeroDirty[dId] then
|
if not this.IsHeroDirty[dId] then
|
||||||
|
|
@ -81,26 +151,38 @@ function this.RefreshHeroProp(dId)
|
||||||
--
|
--
|
||||||
local propList, conList, teamPropList, conTeamList, dePropList
|
local propList, conList, teamPropList, conTeamList, dePropList
|
||||||
-- 判断该类型数据是否需要刷新
|
-- 判断该类型数据是否需要刷新
|
||||||
if this.IsDirty[dId][powerType] ~= false and Hero_Prop_Func[powerType] then
|
if this.IsHeroDirty[dId][powerType] ~= false and Hero_Prop_Func[powerType] then
|
||||||
-- 计算属性
|
-- 计算属性
|
||||||
propList, conList, teamPropList, conTeamList, dePropList = Hero_Prop_Func[powerType](cData)
|
propList, conList, teamPropList, conTeamList, dePropList = Hero_Prop_Func[powerType](cData)
|
||||||
-- 创建新的数据
|
-- 创建新的数据
|
||||||
this.NewHeroProp(dId, powerType, propList)
|
this.NewHeroProp(dId, powerType, propList)
|
||||||
|
LogGreen(_)
|
||||||
|
LogPink("base")
|
||||||
|
LogPinkTable(propList)
|
||||||
|
|
||||||
-- 条件属性
|
-- 条件属性
|
||||||
if conList then
|
if conList then
|
||||||
this.SetConditionData(dId, powerType, conList)
|
this.SetConditionData(dId, powerType, conList)
|
||||||
|
LogPink("con")
|
||||||
|
LogPinkTable(conList)
|
||||||
end
|
end
|
||||||
-- 对编队中其他人的数据
|
-- 对编队中其他人的数据
|
||||||
if teamPropList then
|
if teamPropList then
|
||||||
this.SetTeamData(dId, powerType, teamPropList)
|
this.SetTeamData(dId, powerType, teamPropList)
|
||||||
|
LogPink("team")
|
||||||
|
LogPinkTable(teamPropList)
|
||||||
end
|
end
|
||||||
-- 对编队中其他人的数据
|
-- 对编队中其他人的数据
|
||||||
if conTeamList then
|
if conTeamList then
|
||||||
this.SetConditionTeamData(dId, powerType, conTeamList)
|
this.SetConditionTeamData(dId, powerType, conTeamList)
|
||||||
|
LogPink("conteam")
|
||||||
|
LogPinkTable(conTeamList)
|
||||||
end
|
end
|
||||||
-- 减益属性
|
-- 减益属性
|
||||||
if dePropList then
|
if dePropList then
|
||||||
this.SetDePropData(dId, powerType, dePropList)
|
this.SetDePropData(dId, powerType, dePropList)
|
||||||
|
LogPink("deprop")
|
||||||
|
LogPinkTable(dePropList)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
DoubleTableCompound(list, propList)
|
DoubleTableCompound(list, propList)
|
||||||
|
|
@ -121,8 +203,6 @@ function this.CalHeroPropByType(heroData, powerType)
|
||||||
return propList, conList, teamPropList, conTeamList, dePropList
|
return propList, conList, teamPropList, conTeamList, dePropList
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--========================== 自身角色属性管理==========================
|
|
||||||
-- 刷新角色属性信息
|
-- 刷新角色属性信息
|
||||||
function this.NewHeroProp(dId, powerType, propList)
|
function this.NewHeroProp(dId, powerType, propList)
|
||||||
-- 普通属性加成
|
-- 普通属性加成
|
||||||
|
|
@ -131,22 +211,24 @@ function this.NewHeroProp(dId, powerType, propList)
|
||||||
end
|
end
|
||||||
this.HeroPropList[dId][powerType] = propList
|
this.HeroPropList[dId][powerType] = propList
|
||||||
-- 清理脏数据
|
-- 清理脏数据
|
||||||
if not this.IsDirty[dId] then
|
if not this.IsHeroDirty[dId] then
|
||||||
this.IsDirty[dId] = {}
|
this.IsHeroDirty[dId] = {}
|
||||||
end
|
end
|
||||||
this.IsDirty[dId][powerType] = false
|
this.IsHeroDirty[dId][powerType] = false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 设置脏数据
|
-- 设置脏数据
|
||||||
function this.SetDirtyByType(dId, powerType)
|
function this.SetDirtyByType(dId, powerType)
|
||||||
if not this.IsDirty[dId] then
|
if not this.IsHeroDirty[dId] then
|
||||||
this.IsDirty[dId] = {}
|
this.IsHeroDirty[dId] = {}
|
||||||
end
|
end
|
||||||
this.IsDirty[dId][powerType] = true
|
this.IsHeroDirty[dId][powerType] = true
|
||||||
this.IsDirty[dId].isDirty = true
|
this.IsHeroDirty[dId].isDirty = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 将整个人置为脏数据
|
-- 将整个人置为脏数据
|
||||||
function this.SetHeroDirty(dId)
|
function this.SetHeroDirty(dId)
|
||||||
this.IsDirty[dId] = {}
|
this.IsHeroDirty[dId] = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -168,23 +250,60 @@ function this.SetConditionData(dId, powerType, condList)
|
||||||
|
|
||||||
end
|
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.GetConditionData(dId)
|
function this.GetConditionProp(dId)
|
||||||
|
-- 判空
|
||||||
|
if this.IsConPropDirty[dId] then
|
||||||
|
this.IsConPropDirty[dId] = {}
|
||||||
|
end
|
||||||
if this.IsConPropDirty[dId].isDirty ~= false then
|
if this.IsConPropDirty[dId].isDirty ~= false then
|
||||||
-- 创建计算属性的数据
|
-- 创建计算属性的数据
|
||||||
local list = {}
|
local list = {}
|
||||||
local cData = HeroManager.CreateHeroCountData(dId)
|
local cData = HeroManager.CreateHeroCountData(dId)
|
||||||
for _, powerType in pairs(Hero_Prop_Type) do
|
for _, powerType in pairs(Hero_Prop_Type) do
|
||||||
if this.IsConPropDirty[dId][powerType] ~= false then
|
if this.IsConPropDirty[dId][powerType] ~= false then
|
||||||
for _, cond in ipairs(this.ConList[dId][powerType]) do
|
local condProp = {}
|
||||||
if Condition_Prop_Func[cond.type] then
|
if this.ConList[dId] and this.ConList[dId][powerType] then
|
||||||
local propList = Condition_Prop_Func[cond.type](cData, cData, cond.propList, cond.args)
|
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
|
||||||
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
|
||||||
end
|
end
|
||||||
|
this.IsConPropDirty[dId].isDirty = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return this.ConPropList[dId].propList
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -197,18 +316,70 @@ function this.SetTeamData(dId, powerType, propList)
|
||||||
end
|
end
|
||||||
this.TeamPropList[dId][powerType] = propList
|
this.TeamPropList[dId][powerType] = propList
|
||||||
|
|
||||||
|
-- 清理脏数据
|
||||||
|
if not this.IsTeamPropDirty[dId] then
|
||||||
|
this.IsTeamPropDirty[dId] = {}
|
||||||
|
end
|
||||||
|
this.IsTeamPropDirty[dId].isDirty = true
|
||||||
end
|
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, propList)
|
function this.SetConditionTeamData(dId, powerType, condList)
|
||||||
-- 编队属性加成
|
-- 编队属性加成
|
||||||
if not this.ConTeamPropList[dId] then
|
if not this.ConTeamList[dId] then
|
||||||
this.ConTeamPropList[dId] = {}
|
this.ConTeamList[dId] = {}
|
||||||
end
|
end
|
||||||
this.ConTeamPropList[dId][powerType] = propList
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -222,11 +393,24 @@ function this.SetDePropData(dId, powerType, propList)
|
||||||
this.DePropList[dId][powerType] = propList
|
this.DePropList[dId][powerType] = propList
|
||||||
end
|
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(string.format("%s|%s", id, v))
|
||||||
|
allPropList[id] = allPropList[id] * (1 - v / 10000)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- ===============================================编队属性管理 ===================================
|
-- ===============================================编队属性管理 ===================================
|
||||||
-- ===============================================编队属性管理 ===================================
|
-- ===============================================编队属性管理 ===================================
|
||||||
-- ===============================================编队属性管理 ===================================
|
-- ===============================================编队属性管理 ===================================
|
||||||
--
|
|
||||||
-- 刷新编队数据
|
-- 刷新编队数据
|
||||||
function this.RefreshFormationProp(formationId)
|
function this.RefreshFormationProp(formationId)
|
||||||
if this.IsFormationDirty[formationId] ~= false then
|
if this.IsFormationDirty[formationId] ~= false then
|
||||||
|
|
@ -298,6 +482,9 @@ end
|
||||||
|
|
||||||
-- 设置编队数据变动
|
-- 设置编队数据变动
|
||||||
function this.SetFuncPropDirty(funcPropId)
|
function this.SetFuncPropDirty(funcPropId)
|
||||||
|
if not this.IsFuncDirty[funcPropId] then
|
||||||
|
this.IsFuncDirty[funcPropId] = {}
|
||||||
|
end
|
||||||
this.IsFuncDirty[funcPropId] = true
|
this.IsFuncDirty[funcPropId] = true
|
||||||
this.IsFuncDirty.isDirty = true
|
this.IsFuncDirty.isDirty = true
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ Func_Prop_Func = {
|
||||||
-- 功能属性针对个人的筛选器
|
-- 功能属性针对个人的筛选器
|
||||||
Func_Prop_Filter = {
|
Func_Prop_Filter = {
|
||||||
[Func_Prop_Type.GuildSkill] = function(funcData, heroData)
|
[Func_Prop_Type.GuildSkill] = function(funcData, heroData)
|
||||||
local config = HeroConfig[heroData.tData]
|
local config = HeroConfig[heroData.tId]
|
||||||
return funcData[config.Profession]
|
return funcData[config.Profession]
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,49 +67,51 @@ local function PassiveListToPropList(skillids)
|
||||||
local skillid = skillids[i]
|
local skillid = skillids[i]
|
||||||
if passiveSkillLogicConfig[skillid] then
|
if passiveSkillLogicConfig[skillid] then
|
||||||
local curSkillData = passiveSkillLogicConfig[skillid]
|
local curSkillData = passiveSkillLogicConfig[skillid]
|
||||||
local args = curSkillData.Value
|
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[改变类型]
|
local pId, v, ct
|
||||||
pId, v, ct = args[1], args[2], args[3]
|
if curSkillData.Type == 90 then -- [a]增加[b],[c]改变 || a[属性]b[float]c[改变类型]
|
||||||
elseif curSkillData.Type == 94 then -- 全体上阵武将增加[a]%[b],[c]改变 || a[float]b[属性]c[改变类型]
|
pId, v, ct = args[1], args[2], args[3]
|
||||||
pId, v, ct = args[2], args[1], args[3]
|
elseif curSkillData.Type == 94 then -- 全体上阵武将增加[a]%[b],[c]改变 || a[float]b[属性]c[改变类型]
|
||||||
elseif curSkillData.Type == 171 then -- 武将100级后每升一级[a]额外增加[b],[c]改变(战斗外实现) || a[属性]b[float]c[改变类型]
|
pId, v, ct = args[2], args[1], args[3]
|
||||||
pId, v, ct = args[1], args[2], args[3]
|
elseif curSkillData.Type == 171 then -- 武将100级后每升一级[a]额外增加[b],[c]改变(战斗外实现) || a[属性]b[float]c[改变类型]
|
||||||
elseif curSkillData.Type == 129 then -- 全体上阵[a]元素角色增加[b]%[c],[d]改变 || a[元素]b[float]c[属性]d[改变类型]
|
pId, v, ct = args[1], args[2], args[3]
|
||||||
pId, v, ct = args[3], args[2], args[4]
|
elseif curSkillData.Type == 129 then -- 全体上阵[a]元素角色增加[b]%[c],[d]改变 || a[元素]b[float]c[属性]d[改变类型]
|
||||||
end
|
pId, v, ct = args[3], args[2], args[4]
|
||||||
|
|
||||||
-- 获取UI属性
|
|
||||||
local propId, value = BattlePropToUIProp(pId, v, ct)
|
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
-- 获取UI属性
|
||||||
|
local propId, value = BattlePropToUIProp(pId, v, ct)
|
||||||
|
|
||||||
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -159,6 +161,7 @@ Hero_Prop_Func = {
|
||||||
local tData = heroConfig[_heroData.tId]
|
local tData = heroConfig[_heroData.tId]
|
||||||
local equipSuit = {}
|
local equipSuit = {}
|
||||||
--[id] = 件数
|
--[id] = 件数
|
||||||
|
LogBlue("装备件数".. #_heroData.equipList)
|
||||||
for i = 1, #_heroData.equipList do
|
for i = 1, #_heroData.equipList do
|
||||||
local curEquip = _heroData.equipList[i]
|
local curEquip = _heroData.equipList[i]
|
||||||
if curEquip then
|
if curEquip then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue