【战前属性】====战前属性增加新类型 413计算

dev_chengFeng
wangzhenxing 2021-12-30 16:22:44 +08:00
parent 72400429f3
commit c318dea91a
3 changed files with 34 additions and 8 deletions

View File

@ -249,7 +249,7 @@ function this.GetHeroProp(dId, formationId, NoFuncProp)
DoubleTableCompound(allPropList, basePropList)
-- 自身条件属性加成
local conPropList = this.GetConditionProp(dId)
local conPropList = this.GetConditionProp(dId,formationId)
Log_Prop("自身条件属性")
LogGreenTable_Prop(conPropList)
DoubleTableCompound(allPropList, conPropList)
@ -286,7 +286,7 @@ function this.GetHeroProp(dId, formationId, NoFuncProp)
DoubleTableCompound(allPropList, teamProp)
-- 团队条件属性加成
Log_Prop("团队条件属性")
local conTeamProp = this.GetConditionTeamData(heroId, dId)
local conTeamProp = this.GetConditionTeamData(heroId, dId,formationId)
LogGreenTable_Prop(conTeamProp)
DoubleTableCompound(allPropList, conTeamProp)
end
@ -488,7 +488,7 @@ function this.GetConditionPropByType(dId, powerType)
end
-- 获取自身的条件属性
function this.GetConditionProp(dId)
function this.GetConditionProp(dId,teamId)
-- 判空
if not this.IsConPropDirty[dId] then
this.IsConPropDirty[dId] = {}
@ -496,6 +496,7 @@ function this.GetConditionProp(dId)
if this.IsConPropDirty[dId].isDirty ~= false then
-- 创建计算属性的数据
local list = {}
local formationList = FormationManager.GetFormationByID(teamId)
local cData = this.CreateHeroCountData(dId)
for _, powerType in pairs(Hero_Prop_Type) do
if this.IsConPropDirty[dId][powerType] ~= false then
@ -503,7 +504,7 @@ function this.GetConditionProp(dId)
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)
local propList = Condition_Prop_Func[cond.type](cData, cData, cond.propList, cond.args,formationList)
DoubleTableCompound(condProp, propList)
end
end
@ -591,15 +592,16 @@ function this.SetConditionTeamData(dId, powerType, condList)
end
-- 获取团队条件数据(动态计算,不缓存属性)
function this.GetConditionTeamData(dId, tdId)
function this.GetConditionTeamData(dId, tdId,teamId)
local list = {}
local formationList = FormationManager.GetFormationByID(teamId)
if this.ConTeamList[dId] then
local dData = this.CreateHeroCountData(dId)
local tdData = this.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)
local propList = Condition_Prop_Func[cond.type](dData, tdData, cond.propList, cond.args,formationList)
DoubleTableCompound(list, propList)
end
end

View File

@ -5,6 +5,7 @@ local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
Condition_Prop_Type = {
LV_100 = 1, -- 100级生效的属性
ELE_TEAM_ADD = 2, -- 元素属性
TEAM_ELE_NUM = 3,
}
@ -30,7 +31,24 @@ Condition_Prop_Func = {
if config and args and config.PropertyName == tonumber(args[1]) then
return propList
end
end
end,
[Condition_Prop_Type.TEAM_ELE_NUM] = function(ower, target, propList, args,teamInfo)
if teamInfo and teamInfo.teamHeroInfos and #teamInfo.teamHeroInfos > 0 then
local num=0
for _, hero in ipairs(teamInfo.teamHeroInfos) do
local heroData=HeroManager.GetSingleHeroData(hero.heroId)
if heroData and heroData.heroConfig.PropertyName==args[1] then
num=num+1
end
end
local newProList={}
for key, value in pairs(propList) do
newProList[key]=value*num
end
return newProList
end
end,
}

View File

@ -75,7 +75,7 @@ local function PassiveListToPropList(skillids)
if curSkillData.EffectiveRange > 1 then
local args = curSkillData.Value
-- 计算
local pId, v, ct
local pId, v, ct,ele
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[改变类型]
@ -84,6 +84,8 @@ local function PassiveListToPropList(skillids)
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]
elseif curSkillData.Type ==413 then
pId, v, ct,ele = args[3],args[2],args[4],args[1] --a[int],b[float],c[属性],d[int]
end
-- 获取UI属性
@ -110,6 +112,10 @@ local function PassiveListToPropList(skillids)
local propList = {}
propList[propId] = value
table.insert(conTeamPropList, {type = Condition_Prop_Type.ELE_TEAM_ADD, propList = propList, args = args})
elseif curSkillData.Type == 413 then
local propList = {}
propList[propId] = value
table.insert(conTeamPropList, {type = Condition_Prop_Type.TEAM_ELE_NUM, propList = propList, args = args})
else
if not teamPropList[propId] then
teamPropList[propId] = 0