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

54 lines
1.6 KiB
Lua
Raw Normal View History

2021-01-22 16:53:50 +08:00
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
Condition_Prop_Type = {
LV_100 = 1, -- 100级生效的属性
ELE_TEAM_ADD = 2, -- 元素属性
TEAM_ELE_NUM = 3,
2021-01-22 16:53:50 +08:00
}
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.PropertyName == tonumber(args[1]) then
2021-01-22 16:53:50 +08:00
return propList
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,
2021-01-22 16:53:50 +08:00
}