【战斗】被动353直接伤害击杀目标溢出伤害的[a]%将对生命百分比[b]的目标造成伤害

dev_chengFeng
gaoxin 2021-09-26 20:31:51 +08:00
parent 3ff3649284
commit 2bce8547c7
1 changed files with 41 additions and 0 deletions

View File

@ -8353,6 +8353,47 @@ local passivityList = {
end
role.Event:AddEvent(BattleEventName.RoleTurnStart,onRoleTurnStart,nil,nil,role)
end,
--直接伤害击杀目标溢出伤害的[a]%将对生命百分比[b]的目标造成伤害
-- a[float]
[353]=function(role,args,id,judge)
local f1 = args[1]
local type = args[2] or 0
local allDamage = 0
-- 伤害清空
local onSkillCastBefore=function (skill)
if not skill then
return
end
allDamage = 0
end
role.Event:AddEvent(BattleEventName.SkillCastBefore,onSkillCastBefore,nil,nil,role)
-- 直接伤害后
local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill)
if skill and not skill.isTriggerJudge and judge==1 then
return
end
if skill and skill.owner==role and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
local dmg= floor(BattleUtil.ErrorCorrection((damage-finalDmg)*f1))
allDamage = allDamage + dmg
end
end
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit,nil,nil,role)
-- 技能释放结束
local onSkillCastEnd=function (skill)
if not skill then
return
end
if allDamage > 0 then
local list = RoleManager.Query(function(v) return v.camp ~= role.camp end)
list = BattleUtil.SortByHpFactor(list,type)
if list and list[1] then
BattleUtil.FinalDamage(nil, role, list[1], allDamage)
allDamage = 0
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd,onSkillCastEnd,nil,nil,role)
end,
}
return passivityList