diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Monster/MonsterSkill/MCondition.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Monster/MonsterSkill/MCondition.lua index 7261a60945..93e49c6904 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Monster/MonsterSkill/MCondition.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Monster/MonsterSkill/MCondition.lua @@ -103,16 +103,35 @@ local _ConditionConfig = { 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 + [7] = function(skill, condition) --7:敌方上场神将数量 且概率(万分比)(检测放逐) + local conId = condition[1] + local comType = condition[2] + local comValue = condition[3] + local rand = condition[4] + local roleList = RoleManager.QueryIncludeExile(function(role) + return role.camp ~= skill.owner.camp + end) + --判断场上敌方数量是否足够 + local isEnough=BattleUtil.CompareValue(#roleList, comValue, comType) + if isEnough then + local ishave=false + --是否有没被放逐的目标 + local list=skill.owner.exileTargets + for key, value in pairs(roleList) do + if not BattleUtil.ChecklistIsContainValue(list,value) then + ishave=true + break + end end - end + if ishave then + local r = Random.Range01() + -- 判断概率 + if isEnough then + return rand/10000>r + end + end + return false + end return false end, } diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleManager.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleManager.lua index 473afc2233..fc28a5cdee 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleManager.lua @@ -157,6 +157,24 @@ function RoleManager.Query(func, inCludeDeadRole) end) return list end + +-- 查找角包括放逐目标 +function RoleManager.QueryIncludeExile(func, inCludeDeadRole) + local list = {} + local index = 1 + if func then + for pos, v in pairs(PosList) do + if func(v) and (inCludeDeadRole or not v:IsRealDead()) then + list[index] = v + index = index + 1 + end + end + end + table.sort(list, function(a, b) + return a.position < b.position + end) + return list +end -- 查找角色(不包含死亡和拥有不灭的) 2020/11/28 王振兴 function RoleManager.QueryNoDead(func) local list = {}