2020-10-29 16:36:10 +08:00
|
|
|
|
MCondition = {}
|
|
|
|
|
local this = MCondition
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local _ConditionConfig = {
|
|
|
|
|
[0] = function(skill, condition) --0:无限制条件
|
|
|
|
|
return true
|
|
|
|
|
end,
|
|
|
|
|
[1] = function(skill, condition) --1:我方任意神将生命百分比 【比较类型】 N(万分比)
|
|
|
|
|
local conId = condition[1]
|
|
|
|
|
local comType = condition[2]
|
|
|
|
|
local comValue = condition[3]
|
|
|
|
|
-- 获取该技能相同阵营人物
|
|
|
|
|
local roleList = RoleManager.Query(function(role)
|
|
|
|
|
return role.camp == skill.owner.camp
|
|
|
|
|
end)
|
|
|
|
|
-- 判断
|
|
|
|
|
for _, role in ipairs(roleList) do
|
|
|
|
|
local hpf = role:GetRoleData(RoleDataName.Hp) / role:GetRoleData(RoleDataName.MaxHp)
|
|
|
|
|
if BattleUtil.CompareValue(hpf, comValue/10000, comType) then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end,
|
|
|
|
|
[2] = function(skill, condition) --2:回合数 【比较类型】 N
|
|
|
|
|
local conId = condition[1]
|
|
|
|
|
local comType = condition[2]
|
|
|
|
|
local comValue = condition[3]
|
|
|
|
|
-- 获取当前回合
|
|
|
|
|
local curRound = BattleLogic.GetCurRound()
|
|
|
|
|
return BattleUtil.CompareValue(curRound, comValue, comType)
|
|
|
|
|
end,
|
|
|
|
|
|
2020-11-01 16:23:43 +08:00
|
|
|
|
[3] = function(skill, condition) --2:回合数 【比较类型】 N 且 概率为 N
|
|
|
|
|
local conId = condition[1]
|
|
|
|
|
local comType = condition[2]
|
|
|
|
|
local comValue = condition[3]
|
2020-11-04 14:38:54 +08:00
|
|
|
|
local rand = condition[4]
|
2020-11-01 16:23:43 +08:00
|
|
|
|
-- 获取当前回合
|
|
|
|
|
local curRound = BattleLogic.GetCurRound()
|
|
|
|
|
local isRoundOk = BattleUtil.CompareValue(curRound, comValue, comType)
|
|
|
|
|
-- 判断概率
|
|
|
|
|
local r = Random.Range01()
|
|
|
|
|
local isRandomOk = r <= rand/10000
|
|
|
|
|
return isRoundOk and isRandomOk
|
|
|
|
|
end,
|
|
|
|
|
|
2021-01-14 17:18:41 +08:00
|
|
|
|
[4] = function(skill, condition) --4:场上燃烧目标的数量 【比较类型】 N
|
2020-10-29 16:36:10 +08:00
|
|
|
|
local conId = condition[1]
|
|
|
|
|
local comType = condition[2]
|
|
|
|
|
local comValue = condition[3]
|
|
|
|
|
-- 当前释放技能的单位的职业
|
|
|
|
|
local professionId = skill.owner.professionId
|
2021-01-14 17:18:41 +08:00
|
|
|
|
|
|
|
|
|
local list = RoleManager.Query(function(role)
|
|
|
|
|
return role.camp ~= skill.owner.camp
|
|
|
|
|
end)
|
|
|
|
|
if not list then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
local num=0
|
|
|
|
|
for key, value in pairs(list) do
|
|
|
|
|
local isHave=BattleLogic.BuffMgr:HasBuff(value, BuffName.DOT, function(buff) return buff.damageType == 1 end)
|
|
|
|
|
if isHave then
|
|
|
|
|
num=num+1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return BattleUtil.CompareValue(num, comValue, comType)
|
|
|
|
|
end,
|
|
|
|
|
[5] = function(skill, condition) --5:敌方上场神将数量 且概率(万分比)
|
|
|
|
|
local conId = condition[1]
|
|
|
|
|
local comType = condition[2]
|
|
|
|
|
local comValue = condition[3]
|
|
|
|
|
local rand = condition[4]
|
|
|
|
|
local roleList = RoleManager.Query(function(role)
|
|
|
|
|
return role.camp ~= skill.owner.camp
|
|
|
|
|
end)
|
|
|
|
|
local isEnough=BattleUtil.CompareValue(#roleList, comValue, comType)
|
|
|
|
|
local r = Random.Range01()
|
|
|
|
|
-- 判断概率
|
|
|
|
|
if isEnough then
|
|
|
|
|
return r>rand/10000
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end,
|
|
|
|
|
[6] = function(skill, condition) --6:敌方任意神将生命百分比 【比较类型】 N(万分比)
|
|
|
|
|
local conId = condition[1]
|
|
|
|
|
local comType = condition[2]
|
|
|
|
|
local comValue = condition[3]
|
|
|
|
|
local round = condition[4]
|
|
|
|
|
-- 获取该技能相同阵营人物
|
|
|
|
|
local roleList = RoleManager.Query(function(role)
|
|
|
|
|
return role.camp ~= skill.owner.camp
|
|
|
|
|
end)
|
|
|
|
|
-- 判断
|
|
|
|
|
local r = Random.Range01()
|
|
|
|
|
for _, role in ipairs(roleList) do
|
|
|
|
|
local hpf = role:GetRoleData(RoleDataName.Hp) / role:GetRoleData(RoleDataName.MaxHp)
|
|
|
|
|
if BattleUtil.CompareValue(hpf, comValue/10000, comType) then
|
|
|
|
|
return round/10000>r
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end,
|
|
|
|
|
[7] = function(skill, condition) --7:检测是否有可以放逐的目标
|
|
|
|
|
local list=skill.owner.exileTargets
|
|
|
|
|
if list then
|
|
|
|
|
local roleList = RoleManager.Query(function(role)
|
|
|
|
|
return role.camp ~= skill.owner.camp and not BattleUtil.ChecklistIsContainValue(list,role)
|
|
|
|
|
end)
|
|
|
|
|
if roleList and #roleList>0 then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
2020-11-01 16:23:43 +08:00
|
|
|
|
end,
|
2020-10-29 16:36:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- 条件检测
|
|
|
|
|
function MCondition.CheckCondition(skill, condition)
|
|
|
|
|
if not condition then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
local conId = condition[1]
|
|
|
|
|
local comType = condition[2]
|
|
|
|
|
local comValue = condition[3]
|
|
|
|
|
return _ConditionConfig[conId](skill, condition)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return MCondition
|