miduo_server/luafight/Modules/Battle/Logic/Base/Passivity.lua

3078 lines
112 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

local floor = math.floor
local max = math.max
local min = math.min
--local RoleDataName = RoleDataName
--local BattleLogic = BattleLogic
--local BattleUtil = BattleUtil
--local BattleEventName = BattleEventName
--local BuffName = BuffName
--属性编号
-- local BattlePropList = {
-- RoleDataName.Attack,
-- RoleDataName.PhysicalDefence,
-- RoleDataName.MagicDefence,
-- RoleDataName.Speed,
-- RoleDataName.DamageBocusFactor,
-- RoleDataName.DamageReduceFactor,
-- RoleDataName.Hit,
-- RoleDataName.Dodge,
-- RoleDataName.Crit,
-- RoleDataName.CritDamageFactor,
-- RoleDataName.TreatFacter,
-- RoleDataName.MaxHp,
-- RoleDataName.Hp,
-- RoleDataName.CureFacter,
-- RoleDataName.Tenacity,
-- RoleDataName.InitRage,
-- }
--被动技能表
local passivityList = {
--发动技能时,[a]的概率将[b]*[c]算作[d]计算
--a[float],b[属性],c[float],d[属性]
[1] = function(role, args)
local f1 = args[1]
local pro1 = args[2]
local f2 = args[3]
local pro2 = args[4]
local OnSkillCast = function(skill)
BattleUtil.RandomAction(f1, function ()
local duration = 0
for i=1, skill.effectList.size do
duration = max(duration, skill.effectList.buffer[i].duration)
end
role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, duration + BattleLogic.GameDeltaTime * 2)
end)
end
role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
end,
--发动技能后,[a]的概率对敌方随机1名施加攻击*[c]的[d]伤害。
--a[float],c[float],d[伤害类型]
[2] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local dt = args[3]
local OnSkillCastEnd = function(skill)
BattleUtil.RandomAction(f1, function ()
local arr = BattleUtil.ChooseTarget(role, 20001)
if arr[1] then
BattleUtil.CalDamage(nil, role, arr[1], dt, f2)
end
end)
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--发动技能后,[c]使仇恨目标受到治疗效果降低[a],持续[b]
--a[float],b[int],c[float]
[3] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local f3 = args[3]
local OnSkillCastEnd = function(skill)
BattleUtil.RandomAction(f3, function ()
local arr = BattleUtil.ChooseTarget(role, 40000)
if arr[1] then
arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, RoleDataName.CureFacter, f1, 3))
end
end)
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--发动技能后,[d]改变自身[a]属性[b],持续[c]秒
--a[属性],b[float],c[int],d[改变类型]
[4] = function(role, args)
local pro = args[1]
local f1 = args[2]
local f2 = args[3]
local ct = args[4]
local OnSkillCastEnd = function(skill)
role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct))
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--发动技能后,[a]的概率回复攻击最高的1人的[b]*[c]血量,持续[d]秒。
--a[float],b[属性],c[float],d[int]
[5] = function(role, args)
local f1 = args[1]
local pro = args[2]
local f2 = args[3]
local f3 = args[4]
local OnSkillCastEnd = function(skill)
BattleUtil.RandomAction(f1, function ()
local arr = BattleUtil.ChooseTarget(role, 10321)
if arr[1] then
local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro])))
arr[1]:AddBuff(Buff.Create(role, BuffName.HOT, f3, 1, val))
end
end)
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--发动技能后,[a]的概率提升随机角色的[b]*[c]的[d],持续[e]秒。
--a[float],b[属性],c[float],d[属性],e[int]
[6] = function(role, args)
local f1 = args[1]
local pro1 = args[2]
local f2 = args[3]
local pro2 = args[4]
local f3 = args[5]
local OnSkillCastEnd = function(skill)
BattleUtil.RandomAction(f1, function ()
local arr = BattleUtil.ChooseTarget(role, 10001)
if arr[1] then
local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro1])))
arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro2], val, 1))
end
end)
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--使用回复技能时,[a]的概率提高恢复效果[b]。
--a[float],b[float]
[7] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local OnPassiveTreating = function(treatingFunc)
BattleUtil.RandomAction(f1, function ()
treatingFunc(f2)
end)
end
role.Event:AddEvent(BattleEventName.PassiveTreating, OnPassiveTreating)
end,
--受击后,[a]的概率,回复自身的[b]*[c]的血量
--a[float],b[属性],c[float]
[8] = function(role, args)
local f1 = args[1]
local pro = args[2]
local f2 = args[3]
local OnBeHit = function(treatingFunc)
BattleUtil.RandomAction(f1, function ()
local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro])))
BattleUtil.CalTreat(role, role, val)
end)
end
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
end,
--受击后,[a]对攻击者造成的攻击*[c]的持续伤害,持续[d]秒。
--a[float],c[float],d[int]
[9] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local f3 = args[3]
local triggerUid = {}
local OnBeHit = function(atkRole)
if atkRole.isTeam then
return
end
if triggerUid[atkRole.uid] then --加入限定避免循环触发
return
end
BattleUtil.RandomAction(f1, function ()
atkRole:AddBuff(Buff.Create(role, BuffName.DOT, f3, 1, 0, 1, f2))
triggerUid[atkRole.uid] = atkRole.uid
BattleLogic.WaitForTrigger(f3+1, function ()
triggerUid[atkRole.uid] = nil
end)
end)
end
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
end,
--受击时[e][a]的概率将[b]*[c]算作[d]计算
--a[float],b[属性],c[float],d[属性],e[伤害类型]
[10] = function(role, args)
local f1 = args[1]
local pro1 = args[2]
local f2 = args[3]
local pro2 = args[4]
local dt = args[5]
local OnRoleBeDamagedBefore = function(atkRole, func, damageType)
if damageType == dt then
BattleUtil.RandomAction(f1, function ()
role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, BattleLogic.GameDeltaTime)
end)
end
end
role.Event:AddEvent(BattleEventName.RoleBeDamagedBefore, OnRoleBeDamagedBefore)
end,
--受击时,有[a]的概率抵消[b]*[c]的攻击。
--a[float],b[属性],c[float]
[11] = function(role, args)
local f1 = args[1]
local pro = args[2]
local f2 = args[3]
local OnPassiveDamaging = function(damagingFunc, atkRole, damage)
BattleUtil.RandomAction(f1, function ()
damagingFunc(floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro]))))
end)
end
role.Event:AddEvent(BattleEventName.PassiveBeDamaging, OnPassiveDamaging)
end,
--受击后,有[a]的概率对敌方全体造成攻击*[c]的[d]伤害
--a[float],c[float],d[伤害类型]
[12] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local dt = args[3]
local lastTrigger = 0
local OnBeHit = function(atkRole)
if atkRole.isTeam then
return
end
lastTrigger = lastTrigger + 1
if lastTrigger > 1 then --加入限定避免循环触发
return
end
BattleUtil.RandomAction(f1, function ()
local arr = BattleUtil.ChooseTarget(role, 20000)
for i=1, #arr do
BattleUtil.CalDamage(nil, role, arr[i], dt, f2)
end
end)
lastTrigger = 0
end
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
end,
--受击后,有[a]的概率对随机1人造成[b]*[c]的真实伤害。
--a[float],b[属性],c[float]
[13] = function(role, args)
local f1 = args[1]
local pro = args[2]
local f2 = args[3]
local lastTrigger = 0
local OnBeHit = function(atkRole)
if atkRole.isTeam then
return
end
lastTrigger = lastTrigger + 1
if lastTrigger > 1 then --加入限定避免循环触发
return
end
BattleUtil.RandomAction(f1, function ()
local arr = BattleUtil.ChooseTarget(role, 20001)
if arr[1] then
local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro])))
BattleUtil.ApplyDamage(nil, role, arr[1], val)
end
end)
lastTrigger = 0
end
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
end,
--受击后[f][a]的概率将[b]*[c]算作[d]计算,持续[e]秒。
--a[float],b[属性],c[float],d[属性],e[int],f[伤害类型]
[14] = function(role, args)
local f1 = args[1]
local pro1 = args[2]
local f2 = args[3]
local pro2 = args[4]
local f3 = args[5]
local dt = args[6]
local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
if damageType == dt then
BattleUtil.RandomAction(f1, function ()
role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, f3)
end)
end
end
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
end,
--免疫[a]属性伤害。
--a[属性类型]
[15] = function(role, args)
local pt = args[1]
local elementDamageReduceFactor
if pt == 1 then
elementDamageReduceFactor = RoleDataName.FireDamageReduceFactor
elseif pt == 2 then
elementDamageReduceFactor = RoleDataName.WindDamageReduceFactor
elseif pt == 3 then
elementDamageReduceFactor = RoleDataName.IceDamageReduceFactor
elseif pt == 4 then
elementDamageReduceFactor = RoleDataName.LandDamageReduceFactor
elseif pt == 5 then
elementDamageReduceFactor = RoleDataName.LightDamageReduceFactor
elseif pt == 6 then
elementDamageReduceFactor = RoleDataName.DarkDamageReduceFactor
end
role.data:AddValue(elementDamageReduceFactor, 10000)
end,
--发动技能后,[a]的概率将[b]*[c]算作[d]计算,持续[e]秒。
--a[float],b[属性],c[float],d[属性],e[int]
[16] = function(role, args)
local f1 = args[1]
local pro1 = args[2]
local f2 = args[3]
local pro2 = args[4]
local f3 = args[5]
local OnSkillCastEnd = function(skill)
BattleUtil.RandomAction(f1, function ()
role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, f3)
end)
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--发动技能后,[d]改变仇恨目标[a]属性[b],持续[c]秒
--a[属性],b[int],c[int],d[改变类型]
[17] = function(role, args)
local pro1 = args[1]
local f1 = args[2]
local f2 = args[3]
local ct = args[4]
local OnSkillCastEnd = function(skill)
local arr = BattleUtil.ChooseTarget(role, 40000)
if arr[1] then
arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro1], f1, ct))
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--发动技能后,[d]改变己方全体[a]属性[b],持续[c]秒
--a[属性],b[int],c[int],d[改变类型]
[18] = function(role, args)
local pro1 = args[1]
local f1 = args[2]
local f2 = args[3]
local ct = args[4]
local OnSkillCastEnd = function(skill)
local arr = BattleUtil.ChooseTarget(role, 10000)
for i=1, #arr do
arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro1], f1, ct))
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--受到治疗效果提高[a]。
--a[float]
[19] = function(role, args)
local f1 = args[1]
role.data:AddValue(RoleDataName.CureFacter, f1)
end,
--[b]造成的持续伤害时间延长[a]。
--a[int],b[改变类型]
[20] = function(role, args)
local f1 = args[1]
local ct = args[2]
local OnBuffCaster = function(buff)
if buff.type == BuffName.DOT then
if ct == 1 then --加算
buff.duration = buff.duration + f1
elseif ct == 2 then --乘加算(百分比属性加算)
buff.duration = buff.duration * (1 + f1)
elseif ct == 3 then --减算
buff.duration = buff.duration - f1
elseif ct == 4 then --乘减算(百分比属性减算)
buff.duration = buff.duration * (1 - f1)
end
end
end
role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
end,
--自身增益效果超过[a]时,技能伤害提升[b]。
--a[int],b[float]
[21] = function(role, args)
local i1 = args[1]
local f1 = args[2]
local count = 0
local targetBuff
local active = count > i1
local OnBuffStart = function(buff)
if buff.isBuff then
count = count + 1
if count > i1 and not active then
active = true
targetBuff = Buff.Create(role, BuffName.PropertyChange, 0, RoleDataName.DamageBocusFactor, f1, 1)
targetBuff.isBuff = false --自身不算增益
role:AddBuff(targetBuff)
end
end
end
local OnBuffEnd = function(buff)
if buff.isBuff then
count = count - 1
if count <= i1 and active then
active = false
if targetBuff then
targetBuff.disperse = true
end
end
end
end
role.Event:AddEvent(BattleEventName.BuffStart, OnBuffStart)
role.Event:AddEvent(BattleEventName.BuffEnd, OnBuffEnd)
end,
--血量低于[a]时,[b]概率触发控制免疫,持续[c]秒。每场战斗只能触发1次。
--a[float],b[float],c[int]
[22] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local f3 = args[3]
local triggerCount = 0
local OnBeHit = function(atkRole)
if BattleUtil.GetHPPencent(role) < f1 then
if triggerCount < 1 then
BattleUtil.RandomAction(f2, function ()
role:AddBuff(Buff.Create(role, BuffName.Immune, f3, 1))
triggerCount = triggerCount + 1
end)
end
end
end
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
end,
--死亡时,立即回复己方全体[a]*[b]的血量。
--a[属性],b[float]
[23] = function(role, args)
local pro = args[1]
local f1 = args[2]
local OnDead = function(atkRole)
local arr = BattleUtil.ChooseTarget(role, 10000)
for i=1, #arr do
local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro])))
BattleUtil.CalTreat(role, arr[i], val)
end
end
role.Event:AddEvent(BattleEventName.RoleDead, OnDead)
end,
--控制效果命中后,[a]的概率施加[c]的[d]伤害
--a[float],c[float],d[伤害类型]
[24] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local dt = args[3]
local OnBuffCaster = function(buff)
if buff.type == BuffName.Control then
BattleUtil.RandomAction(f1, function ()
BattleUtil.CalDamage(nil, role, buff.target, dt, f2)
end)
end
end
role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
end,
--控制效果命中后,[a]对全体造成[c]的[d]伤害。
--a[float],c[float],d[伤害类型]
[25] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local dt = args[3]
local OnBuffCaster = function(buff)
if buff.type == BuffName.Control then
BattleUtil.RandomAction(f1, function ()
local arr = BattleUtil.ChooseTarget(buff.target, 10000)
for i=1, #arr do
BattleUtil.CalDamage(nil, role, arr[i], dt, f2)
end
end)
end
end
role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
end,
--造成的伤害暴击后,[a]施加攻击*[c]的[d]持续伤害,持续[e]秒。
--a[float],c[float],d[伤害类型],e[int]
[26] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local dt = args[3]
local f3 = args[4]
local triggerUid = {}
local OnRoleCrit = function(defRole)
if triggerUid[defRole.uid] then --加入限定避免循环触发
return
end
BattleUtil.RandomAction(f1, function ()
defRole:AddBuff(Buff.Create(role, BuffName.DOT, f3, 1, 0, dt, f2))
triggerUid[defRole.uid] = defRole.uid
BattleLogic.WaitForTrigger(f3+1, function ()
triggerUid[defRole.uid] = nil
end)
end)
end
role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
end,
--造成的伤害暴击后,[a]的概率回复自身[b]*[c]的血量
--a[float],b[属性],c[float]
[27] = function(role, args)
local f1 = args[1]
local pro = args[2]
local f2 = args[3]
local OnRoleCrit = function(defRole)
BattleUtil.RandomAction(f1, function ()
local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro])))
BattleUtil.CalTreat(role, role, val)
end)
end
role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
end,
--对血量高于[a]的敌人伤害提高[b]。
--a[float],b[float]
[28] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
if BattleUtil.GetHPPencent(defRole) > f1 then
damagingFunc(-floor(f2 * damage))
end
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
end,
--对血量低于[a]的敌人伤害提高[b]。
--a[float],b[float]
[29] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
if BattleUtil.GetHPPencent(defRole) < f1 then
damagingFunc(-floor(f2 * damage))
end
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
end,
--发动技能后,[d]改变敌方全体[a]属性[b],持续[c]秒
--a[属性],b[float],c[int],d[改变类型]
[30] = function(role, args)
local pro = args[1]
local f1 = args[2]
local f2 = args[3]
local ct = args[4]
local OnSkillCastEnd = function(skill)
local arr = BattleUtil.ChooseTarget(role, 20000)
for i=1, #arr do
arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct))
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--发动技能后,有[a]的概率眩晕敌方其中1人持续[b]秒。
--a[float],b[int]
[31] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local OnSkillCastEnd = function(skill)
BattleUtil.RandomAction(f1, function ()
local arr = BattleUtil.ChooseTarget(role, 20001)
if arr[1] then
arr[1]:AddBuff(Buff.Create(role, BuffName.Control, f2, 1))
end
end)
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--持续伤害效果命中后,[d]改变自身[a]属性[b],持续[c]秒
--a[属性],b[float],c[int],d[改变类型]
[32] = function(role, args)
local pro = args[1]
local f1 = args[2]
local f2 = args[3]
local ct = args[4]
local OnBuffCaster = function(buff)
if buff.type == BuffName.DOT then
role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct))
end
end
role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
end,
--[d]改变自身[a]属性[b],持续[c]秒
--a[属性],b[float],c[int],d[改变类型]
[33] = function(role, args)
local pro = args[1]
local f1 = args[2]
local f2 = args[3]
local ct = args[4]
role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct))
end,
--造成伤害时,额外增加[a]点伤害。
--a[int]
[34] = function(role, args)
local f1 = args[1]
local OnPassiveDamaging = function(damagingFunc)
damagingFunc(-f1)
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
end,
--进入战斗[a]秒后,造成的伤害提升[b],持续[c]秒
--a[int],b[float],c[int]
[35] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local f3 = args[3]
BattleLogic.WaitForTrigger(f1, function ()
role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, RoleDataName.DamageBocusFactor, f2, 1))
end)
end,
--进入战斗[a]秒后,[d]改变[b]属性[c],持续[e]秒
--a[int],b[属性],c[int],d[改变类型],e[int]
[36] = function(role, args)
local f1 = args[1]
local pro = args[2]
local f2 = args[3]
local ct = args[4]
local f3 = args[5]
BattleLogic.WaitForTrigger(f1, function ()
role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro], f2, ct))
end)
end,
--进入战斗[a]秒后,免疫控制效果,持续[b]秒
--a[int],b[int]
[37] = function(role, args)
local f1 = args[1]
local f2 = args[2]
BattleLogic.WaitForTrigger(f1, function ()
role:AddBuff(Buff.Create(role, BuffName.Immune, f2, 1))
end)
end,
--每[a]秒,[d]改变[b]的[c][g改变[e]的[f],最高叠加[h]层 (举例:每5秒扣除10%的生命提高5%的速度, 最高叠加5层)
--a[int],b[float],c[属性],d[改变类型],e[float],f[属性],g[改变类型],h[int]
[38] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local pro1 = args[3]
local ct1 = args[4]
local f3 = args[5]
local pro2 = args[6]
local ct2 = args[7]
local i1 = args[8]
local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
local changeBuff1 = Buff.Create(r, BuffName.PropertyChange, 0, BattlePropList[pro1], f2, ct1)
changeBuff1.cover = true
changeBuff1.maxLayer = i1
local changeBuff2 = Buff.Create(r, BuffName.PropertyChange, 0, BattlePropList[pro2], f3, ct2)
changeBuff2.cover = true
changeBuff2.maxLayer = i1
r:AddBuff(changeBuff1)
r:AddBuff(changeBuff2)
end)
auraBuff.interval = f1
role:AddBuff(auraBuff)
end,
--进入战斗后,每[a]秒回复[b]生命
--a[int],b[int]
[39] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
BattleUtil.CalTreat(r, r, f2)
end)
auraBuff.interval = f1
role:AddBuff(auraBuff)
end,
--被指定[a]造成伤害时,回复[b]生命
--a[职业],b[int]
[40] = function(role, args)
local i1 = args[1]
local f1 = args[2]
local OnBeHit = function(atkRole)
if atkRole.isTeam then
return
end
if atkRole.roleData.professionId == i1 then
BattleUtil.CalTreat(role, role, f1)
end
end
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
end,
--造成伤害时,将伤害的[a]%转化为自身生命
--a[float]
[41] = function(role, args)
local f1 = args[1]
local OnDamage = function(defRole, damage, bCrit, finalDmg)
BattleUtil.CalTreat(role, role, floor(f1 * finalDmg))
end
role.Event:AddEvent(BattleEventName.RoleDamage, OnDamage)
end,
--造成暴击伤害时,有[a]的概率造成[b]的暴击伤害。
--a[float],b[float]
[42] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local OnPassiveCriting = function(crit)
BattleUtil.RandomAction(f1, function ()
crit(f2)
end)
end
role.Event:AddEvent(BattleEventName.PassiveCriting, OnPassiveCriting)
end,
--发动技能后,[d]改变仇恨目标[a]属性[b],持续整场战斗,属性最多可改变[c]
--a[属性],b[float],c[float],d[改变类型]
[43] = function(role, args)
local pro = args[1]
local f1 = args[2]
local i1 = args[3]
local ct = args[4]
local OnSkillCastEnd = function(skill)
local arr = BattleUtil.ChooseTarget(role, 40000)
if arr[1] then
local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, ct)
buff.cover = true
buff.maxLayer = i1
arr[1]:AddBuff(buff)
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--发动技能后,[a]的概率[e]改变自身[b]属性[c],持续[d]秒。
--a[float],b[属性],c[float],d[int],e[改变类型]
[44] = function(role, args)
local f1 = args[1]
local pro = args[2]
local f2 = args[3]
local f3 = args[4]
local ct = args[5]
local OnSkillCastEnd = function(skill)
BattleUtil.RandomAction(f1, function ()
role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro], f2, ct))
end)
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--免疫[a]次[b]控制状态。
--a[int],b[控制类型]
[45] = function(role, args)
local i1 = args[1]
local ct = args[2]
local triggerCount = 0
role.buffFilter:Add(function(buff)
local isTarget = buff.type == BuffName.Control and (ct == 0 or buff.ctrlType == ct)
if isTarget then
triggerCount = triggerCount + 1
return i1 == 0 or (i1 > 0 and triggerCount <= i1)
else
return isTarget
end
end)
end,
--免疫[a]持续伤害状态。
--a[持续伤害类型]
[46] = function(role, args)
local dt = args[1]
role.buffFilter:Add(function(buff)
return buff.type == BuffName.DOT and (dt == 0 or buff.damageType == dt)
end)
end,
--战斗中,[c]改变[a]属性[b]。
--a[属性],b[float],c[改变类型]
[47] = function(role, args)
local pro = args[1]
local f1 = args[2]
local ct = args[3]
if ct == 1 then --加算
role.data:AddValue(BattlePropList[pro], f1)
elseif ct == 2 then --乘加算(百分比属性加算)
role.data:AddPencentValue(BattlePropList[pro], f1)
elseif ct == 3 then --减算
role.data:SubValue(BattlePropList[pro], f1)
elseif ct == 4 then --乘减算(百分比属性减算)
role.data:SubPencentValue(BattlePropList[pro], f1)
end
end,
--战斗中,[c]改变[a]属性[b][f]改变[d]属性[e]。
--a[属性],b[float],c[改变类型],d[属性],e[float],f[改变类型]
[48] = function(role, args)
local pro = args[1]
local f1 = args[2]
local ct = args[3]
local pro2 = args[4]
local f2 = args[5]
local ct2 = args[6]
if ct == 1 then --加算
role.data:AddValue(BattlePropList[pro], f1)
elseif ct == 2 then --乘加算(百分比属性加算)
role.data:AddPencentValue(BattlePropList[pro], f1)
elseif ct == 3 then --减算
role.data:SubValue(BattlePropList[pro], f1)
elseif ct == 4 then --乘减算(百分比属性减算)
role.data:SubPencentValue(BattlePropList[pro], f1)
end
if ct2 == 1 then --加算
role.data:AddValue(BattlePropList[pro2], f2)
elseif ct2 == 2 then --乘加算(百分比属性加算)
role.data:AddPencentValue(BattlePropList[pro2], f2)
elseif ct2 == 3 then --减算
role.data:SubValue(BattlePropList[pro2], f2)
elseif ct2 == 4 then --乘减算(百分比属性减算)
role.data:SubPencentValue(BattlePropList[pro2], f2)
end
end,
--发动技能后,[a]概率[e]改变敌方全体[b]属性[c],持续[d]秒
--a[float],b[属性],c[float],d[int],e[改变类型]
[49] = function(role, args)
local f1 = args[1]
local pro = args[2]
local f2 = args[3]
local f3 = args[4]
local ct = args[5]
local OnSkillCastEnd = function(skill)
BattleUtil.RandomAction(f1, function ()
local arr = BattleUtil.ChooseTarget(role, 20000)
for i=1, #arr do
arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro], f2, ct))
end
end)
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--战斗中,每[a]秒增加[b]%的异妖能量
--a[int],b[float]
[50] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
--BattleLogic.AddMP(role.camp, f2 * 100)
end)
auraBuff.interval = f1
BattleLogic.BuffMgr:AddBuff(role, auraBuff)
end,
--战斗中,初始拥有[a]%的异妖能量
--a[float]
[51] = function(role, args)
local f1 = args[1]
--BattleLogic.AddMP(role.camp, f1 * 100)
end,
--战斗中,队伍每损失[a]%的生命值,增加[b]%的异妖能量
--a[float],b[float]
[52] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local maxHp = 0
local curHp = 0
if f1 == 0 then
return
end
local curHpGears = 0
local arr = BattleUtil.ChooseTarget(role, 10000)
for i=1, #arr do
curHp = curHp + arr[i]:GetRoleData(RoleDataName.Hp)
maxHp = maxHp + arr[i]:GetRoleData(RoleDataName.MaxHp)
end
local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
local hp = 0
for i=1, #arr do
hp = hp + arr[i]:GetRoleData(RoleDataName.Hp)
end
if hp < curHp then
local gears = floor((maxHp - hp) / (f1 * maxHp))
if gears > curHpGears then
--BattleLogic.AddMP(role.camp, f2 * (gears - curHpGears) * 100)
curHpGears = gears
end
curHp = hp
end
end)
auraBuff.interval = 0
BattleLogic.BuffMgr:AddBuff(role, auraBuff)
end,
--战斗中,治疗技能有概率额外造成[a]%的治疗,概率等于自身暴击率。
--a[float]
[53] = function(role, args)
local f1 = args[1]
local OnPassiveTreating = function(treatingFunc)
BattleUtil.RandomAction(role:GetRoleData(RoleDataName.Crit), function ()
treatingFunc(f1)
end)
end
role.Event:AddEvent(BattleEventName.PassiveTreating, OnPassiveTreating)
end,
--受击后,有[a]的概率对攻击者造成眩晕,持续[b]秒。
--a[float],b[int]
[54] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
if atkRole.isTeam then
return
end
BattleUtil.RandomAction(f1, function ()
atkRole:AddBuff(Buff.Create(role, BuffName.Control, f2, 1))
end)
end
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
end,
--造成伤害时,有[a]的概率立即造成攻击[b]%的伤害。
--a[float],b[float]
[55] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local lastTrigger = 0
local OnDamage = function(defRole, damage, bCrit, finalDmg)
lastTrigger = lastTrigger + 1
if lastTrigger > 1 then --加入限定避免循环触发
return
end
BattleUtil.RandomAction(f1, function ()
local val = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), f2))
BattleUtil.ApplyDamage(nil, role, defRole, val)
end)
lastTrigger = 0
end
role.Event:AddEvent(BattleEventName.RoleHit, OnDamage)
end,
--造成暴击时,额外造成目标最大生命值[a]%的伤害。目标最大生命值伤害总上限为施法者2.5倍攻击)
--a[float]
[56] = function(role, args)
local f1 = args[1]
local lastTrigger = 0
local OnRoleCrit = function(defRole)
lastTrigger = lastTrigger + 1
if lastTrigger > 1 then --加入限定避免循环触发
return
end
local ar1 = BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp), f1)
local ar2 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), 2.5)
BattleUtil.ApplyDamage(nil, role, defRole, floor(min(ar1, ar2)))
lastTrigger = 0
end
role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
end,
--发动技能时,若技能目标与自身发动的上一个技能目标相同,则增加[a]%的伤害,最多叠加[b]层。
--a[float],b[int]
[57] = function(role, args)
local f1 = args[1]
local i2 = args[2]
local damageDic = {}
local lastDamageDic = {}
local OnSkillCastEnd = function(skill)
for k in pairs(damageDic) do
if lastDamageDic[k] then
damageDic[k] = damageDic[k] + 1
end
end
lastDamageDic = damageDic
damageDic = {}
end
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
if lastDamageDic[defRole] then
local layer = i2 == 0 and lastDamageDic[defRole] or min(i2, lastDamageDic[defRole])
damagingFunc(-floor(f1 * layer * damage))
damageDic[defRole] = lastDamageDic[defRole]
else
damageDic[defRole] = 1
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
end,
--发动技能后,每个敌方角色有[a]概率获得[b],每秒造成[c]%的[d]伤害,持续[e]秒。
--a[float],b[持续伤害类型],c[float],d[伤害类型],e[int]
[58] = function(role, args)
local f1 = args[1]
local d1 = args[2]
local f2 = args[3]
local dt = args[4]
local f3 = args[5]
local OnSkillCastEnd = function(skill)
local arr = BattleUtil.ChooseTarget(role, 20000)
for i=1, #arr do
BattleUtil.RandomAction(f1, function ()
arr[i]:AddBuff(Buff.Create(role, BuffName.DOT, f3, 1, d1, dt, f2))
end)
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--每隔[a]秒,抵挡一个负面状态。(控制 dot 减益)
--a[int]
[59] = function(role, args)
local f1 = args[1]
local count = 0
role.buffFilter:Add(function(buff)
local b = buff.isDeBuff or buff.type == BuffName.DOT or buff.type == BuffName.Control
if b then
count = count + 1
end
return b and count <= 1
end)
local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
count = 0
end)
auraBuff.interval = f1
BattleLogic.BuffMgr:AddBuff(role, auraBuff)
end,
--我方生命最低的其他角色受到技能攻击后,自身[a]的概率对攻击者造成攻击[b]%的[c]伤害,并造成[d],持续[e]秒。若自身处于沉默或眩晕状态,则不会触发。播放攻击特效,特效时间[f]秒。
--a[float],b[float],c[伤害类型],d[控制状态],e[int],f[float]
[60] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local dt = args[3]
local ct = args[4]
local f3 = args[5]
local f4 = args[6]
local triggerUid = {}
BattleLogic.Event:AddEvent(BattleEventName.RoleBeDamaged, function (defRole, atkRole, damage, bCrit, finalDmg, damageType, isDot)
if atkRole.isTeam or role.isDead or isDot then
return
end
if triggerUid[atkRole.uid] then --加入限定避免循环触发
return
end
if not BattleLogic.BuffMgr:HasBuff(role, BuffName.Control, function (buff) return buff.ctrlType == 1 or buff.ctrlType == 2 end) then
local arr = BattleUtil.ChooseTarget(role, 10110)
local target
if arr[1] then
if arr[1] == role and arr[2] then
target = arr[2]
else
target = arr[1]
end
end
if defRole == target then
BattleUtil.RandomAction(f1, function ()
role.Event:DispatchEvent(BattleEventName.RoleViewBullet, f4, atkRole)
BattleLogic.WaitForTrigger(f4, function ()
triggerUid[atkRole.uid] = atkRole.uid
BattleUtil.CalDamage(nil, role, atkRole, dt, f2)
atkRole:AddBuff(Buff.Create(role, BuffName.Control, f3, ct))
triggerUid[atkRole.uid] = nil
end)
end)
end
end
end)
end,
--自身受到的非暴击伤害,可以转化[a]%的伤害为自身攻击,持续[b]秒。上限自身攻击的[c]%。
--a[float],b[int],c[float]
[61] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local f3 = args[3]
local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
if not bCrit then
local ar1 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), f3)
local ar2 = BattleUtil.FP_Mul(damage, f1)
role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, RoleDataName.Attack, floor(min(ar1, ar2)), 1))
end
end
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
end,
--发动技能后,有[a]的概率为自身及相邻加持[b][c]%的护盾,持续[d]秒。
--a[float],b[属性],c[float],d[int]
[62] = function(role, args)
local f1 = args[1]
local pro = args[2]
local f2 = args[3]
local f3 = args[4]
local OnSkillCastEnd = function(skill)
BattleUtil.RandomAction(f1, function ()
local list = BattleLogic.GetNeighbor(role, 1)
for i=1, #list do
local val = floor(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[pro]), f2))
list[i]:AddBuff(Buff.Create(role, BuffName.Shield, f3, ShieldTypeName.NormalReduce, val, 0))
end
end)
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--自身拥有护盾时,我方角色每次释放技能后,有[a]概率回复[b]%的[c]的治疗。
--a[float],b[float],c[属性]
[63] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local pro1 = args[3]
BattleLogic.Event:AddEvent(BattleEventName.SkillCastEnd, function (skill)
if skill.owner.isTeam then
return
end
if skill.owner.camp == role.camp then
if BattleLogic.BuffMgr:HasBuff(role, BuffName.Shield, function (buff) return true end) then
BattleUtil.RandomAction(f1, function ()
local val = floor(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[pro1]), f2))
BattleUtil.CalTreat(role, skill.owner, val)
end)
end
end
end)
end,
--基于生命损失的百分比,受到的伤害降低[b]%。
--a[float]
[64] = function(role, args)
local f1 = args[1]
local OnPassiveDamaging = function(damagingFunc, atkRole, damage)
damagingFunc(floor(BattleUtil.FP_Mul(f1, damage,1-BattleUtil.GetHPPencent(role))))
end
role.Event:AddEvent(BattleEventName.PassiveBeDamaging, OnPassiveDamaging)
end,
--我方角色死亡时,对击杀者造成[a]%的[b]伤害,令其眩晕,持续[c]秒。
--a[float],b[伤害类型],c[int]
[65] = function(role, args)
local f1 = args[1]
local dt = args[2]
local f2 = args[3]
BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead, function (defRole, atkRole)
if role.isDead or atkRole.isTeam then
return
end
if defRole.camp == role.camp then
BattleUtil.CalDamage(nil, role, atkRole, dt, f1)
atkRole:AddBuff(Buff.Create(role, BuffName.Control, f2, 1))
end
end)
end,
--免疫减益状态。
--无
[66] = function(role, args)
role.buffFilter:Add(function(buff)
return buff.isDeBuff
end)
end,
--敌方累计发动[a]次技能,有[b]概率发动(发动特效),对敌方全体造成眩晕效果,持续[c]秒。然后清空累计次数。播放攻击特效,特效时间[d]秒。
--a[int],b[float],c[float]
[67] = function(role, args)
local i1 = args[1]
local f1 = args[2]
local f2 = args[3]
local f3 = args[4]
local count = 0
BattleLogic.Event:AddEvent(BattleEventName.SkillCast, function (skill)
if skill.owner.isTeam or role.isDead then
return
end
if skill.owner.camp ~= role.camp then
count = count + 1
if count == i1 then
BattleUtil.RandomAction(f1, function ()
role.Event:DispatchEvent(BattleEventName.AOE, 1-role.camp)
BattleLogic.WaitForTrigger(f3, function ()
local arr = BattleUtil.ChooseTarget(role, 20000)
for i=1, #arr do
arr[i]:AddBuff(Buff.Create(role, BuffName.Control, f2, 1))
end
end)
end)
count = 0
end
end
end)
end,
--受到伤害后,[a]概率为自身施加[b]的[c]%的护盾。持续[d]秒。
--a[float],b[属性],c[float],d[int]
[68] = function(role, args)
local f1 = args[1]
local pro1 = args[2]
local f2 = args[3]
local f3 = args[4]
local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
BattleUtil.RandomAction(f1, function ()
local val = floor(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[pro1]), f2))
role:AddBuff(Buff.Create(role, BuffName.Shield, f3, ShieldTypeName.NormalReduce, val, 0))
end)
end
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
end,
--造成暴击时,额外造成目标最大生命值[a]%的伤害。造成伤害时,有[a]的概率立即造成攻击[b]%的伤害该伤害造成的暴击伤害不会触发额外最大生命值伤害。效果55+效果56目标最大生命值伤害总上限为施法者5倍攻击
--a[float],b[float],c[float]
[69] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local f3 = args[3]
local lastTrigger = 0
local OnDamage = function(defRole, damage, bCrit, finalDmg)
lastTrigger = lastTrigger + 1
if lastTrigger > 1 then --加入限定避免循环触发
return
end
if bCrit then
local ar1 = BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp), f1)
local ar2 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), 5)
BattleUtil.ApplyDamage(nil, role, defRole, floor(min(ar1, ar2)))
else
BattleUtil.RandomAction(f2, function ()
local val = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), f3))
BattleUtil.ApplyDamage(nil, role, defRole, val)
end)
end
lastTrigger = 0
end
role.Event:AddEvent(BattleEventName.RoleDamage, OnDamage)
end,
--击杀每个敌人会永久增加[a]%的[b],持续[c]秒。0表示永久不可驱散
--a[float],b[属性],c[int]
[70] = function(role, args)
local f1 = args[1]
local pro = args[2]
local f2 = args[3]
local OnKill = function(defRole)
local buff = Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, 2)
buff.cover = true
buff.clear = false
role:AddBuff(buff)
end
role.Event:AddEvent(BattleEventName.RoleKill, OnKill)
end,
--受击后,[a]对攻击者造成自身[c]%的[d]伤害。
--a[float],c[float],d[伤害类型]
[71] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local dt = args[3]
local lastTrigger = 0
local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
if atkRole.isTeam then
return
end
lastTrigger = lastTrigger + 1
if lastTrigger > 1 then --加入限定避免循环触发
return
end
BattleUtil.RandomAction(f1, function ()
BattleUtil.CalDamage(nil, role, atkRole, dt, f2)
end)
lastTrigger = 0
end
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
end,
--造成的伤害暴击时,有[a]概率在计算伤害时额外计算[b]的暴击伤害。
--a[float],b[float]
[72] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local OnPassiveCriting = function(crit)
BattleUtil.RandomAction(f1, function ()
crit(role:GetRoleData(RoleDataName.CritDamageFactor)+f2)
end)
end
role.Event:AddEvent(BattleEventName.PassiveCriting, OnPassiveCriting)
end,
--释放技能时,自己损失[a]%当前生命值,为此次技能增加等量伤害。
--a[float]
[73] = function(role, args)
local f1 = args[1]
local hp=0
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
damagingFunc(-hp)
end
local OnSkillCast, OnSkillCastEnd
OnSkillCast = function(skill)
hp = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Hp), f1))
role.data:SubValue(RoleDataName.Hp, hp)
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
end
OnSkillCastEnd = function(skill)
BattleLogic.WaitForTrigger(BattleLogic.GameDeltaTime, function () --延迟一帧移除事件,防止触发帧和结束帧为同一帧时,被动未移除
role.Event:RemoveEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
role.Event:RemoveEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
end)
end
role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
end,
--死亡时,为所有我方角色增加[a]%的[b]属性,持续[c]秒。
--a[float],b[属性],c[int]
[74] = function(role, args)
local f1 = args[1]
local pro = args[2]
local f2 = args[3]
local OnDead = function(atkRole)
local arr = BattleUtil.ChooseTarget(role, 10000)
for i=1, #arr do
arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, 2))
end
end
role.Event:AddEvent(BattleEventName.RoleDead, OnDead)
end,
--boss每受到[a]*印记层数)点伤害,为自身永久增加一层印记,每层印记为自身增加[b]点攻击,[c]点护甲和[d]点魔抗。【不可驱散】
--a[int],b[int],c[int],d[int]
[75] = function(role, args)
local i1 = args[1]
local i2 = args[2]
local i3 = args[3]
local i4 = args[4]
if i1 <= 0 then return end --防止死循环
local total = 0
local layer = 0
local OnBeDamaged = function(atkRole, damage, bCrit, finalDmg, damageType)
total = total + damage
local count = 0
while total >= i1 * layer do
total = total - i1 * layer
layer = layer + 1
count = count + 1
end
if count > 0 then
local buff1 = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[1], i2 * count, 1)
buff1.cover = true
buff1.layer = count
buff1.clear = false
local buff2 = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[2], i3 * count, 1)
buff2.cover = true
buff2.layer = count
buff2.clear = false
local buff3 = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[3], i4 * count, 1)
buff3.cover = true
buff3.layer = count
buff3.clear = false
role:AddBuff(buff1)
role:AddBuff(buff2)
role:AddBuff(buff3)
end
end
role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnBeDamaged)
end,
--战斗中,若自己是[a],[d]改变[b]属性[c]。
--a[职业],b[属性],c[float],d[改变类型]
[76] = function(role, args)
local i1 = args[1]
local pro = args[2]
local f1 = args[3]
local ct = args[4]
if role.roleData.professionId == i1 then
if ct == 1 then --加算
role.data:AddValue(BattlePropList[pro], f1)
elseif ct == 2 then --乘加算(百分比属性加算)
role.data:AddPencentValue(BattlePropList[pro], f1)
elseif ct == 3 then --减算
role.data:SubValue(BattlePropList[pro], f1)
elseif ct == 4 then --乘减算(百分比属性减算)
role.data:SubPencentValue(BattlePropList[pro], f1)
end
end
end,
--战斗开始时,为自身施加[a]*[b]的护盾,持续[c]秒0为无限
--a[属性],b[float],c[int]
[77] = function(role, args)
local pro1 = args[1]
local f1 = args[2]
local f2 = args[3]
local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro1])))
role:AddBuff(Buff.Create(role, BuffName.Shield, f2, ShieldTypeName.NormalReduce, val, 0))
end,
--战斗开始时,为自身回复[a]*[b]的血量。
--a[属性],b[float]
[78] = function(role, args)
local pro = args[1]
local f1 = args[2]
local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro])))
BattleUtil.CalTreat(role, role, val)
end,
--战斗结束时,为自身回复[a]*[b]的血量。
--a[属性],b[float]
[79] = function(role, args)
local pro = args[1]
local f1 = args[2]
local OnEnd = function(order)
if order == BattleLogic.TotalOrder then
local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro])))
BattleUtil.CalTreat(role, role, val)
end
end
BattleLogic.Event:AddEvent(BattleEventName.BattleOrderEnd, OnEnd)
end,
--战斗中,若自己是[a],[d]改变[b]属性[c]。-- 2020/3/6 高鑫
--a[元素],b[属性],c[float],d[改变类型]
[80] = function(role, args)
local i1 = args[1]
local pro = args[2]
local f1 = args[3]
local ct = args[4]
if role.roleData.element == i1 then
if ct == 1 then --加算
role.data:AddValue(BattlePropList[pro], f1)
elseif ct == 2 then --乘加算(百分比属性加算)
role.data:AddPencentValue(BattlePropList[pro], f1)
elseif ct == 3 then --减算
role.data:SubValue(BattlePropList[pro], f1)
elseif ct == 4 then --乘减算(百分比属性减算)
role.data:SubPencentValue(BattlePropList[pro], f1)
end
end
end,
-- [a]增加[b], [c]改变
-- a[属性]b[float]
[90] = function(role, args)
local pro = args[1]
local f1 = args[2]
local ct = args[3]
role.data:CountValue(BattlePropList[pro], f1, ct)
end,
-- 技能伤害增加[a]%[b]改变
-- a[float]b[改变类型]
[91] = function(role, args)
local f1 = args[1]
local ct = args[2]
local passivityDamaging = function(func, caster, damage)
if func then
local dd = BattleUtil.CountValue(damage, f1, ct) - damage
func(-floor(BattleUtil.ErrorCorrection(dd)))
end
end
local OnSkillCast = function(skill)
if skill.type == BattleSkillType.Special then
role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
end
end
local OnSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Special then
role.Event:RemoveEvent(BattleEventName.PassiveDamaging, passivityDamaging)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
-- (直接伤害(目前没有明确定义直接伤害))直接伤害击杀目标自身增加[a]点怒气
-- a[int]
[92] = function(role, args)
local i1 = args[1]
local OnRoleHit = function(defRole)
-- local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], i1, 1)
-- buff.cover = true -- 可以叠加
-- buff.clear = false -- 不可驱散
-- role:AddBuff(buff)
if defRole.isDead then
role:AddRage(i1, CountTypeName.Add)
end
end
role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit)
end,
-- 技能治疗量增加[a]
-- a[float]
[93] = function(role, args)
local f1 = args[1]
local passiveTreating = function(func, caster)
if func then func(f1) end
end
local OnSkillCast = function(skill)
if skill.type == BattleSkillType.Special then
role.Event:AddEvent(BattleEventName.PassiveTreating, passiveTreating)
end
end
local OnSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Special then
role.Event:RemoveEvent(BattleEventName.PassiveTreating, passiveTreating)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
-- 全体上阵武将增加[a][b] [c]改变
-- a[float]b[属性]c[改变类型]
[94] = function(role, args)
local f1 = args[1]
local pro = args[2]
local ct = args[3]
local list = BattleLogic.Query(function(v) return role.camp == v.camp end)
for _, r in pairs(list) do
r.data:CountValue(BattlePropList[pro], f1, ct)
end
end,
-- 行动后增加[a]点怒气
-- a[int]
[95] = function(role, args)
local i1 = args[1]
-- 行动结束后
local onTurnEnd = function()
role:AddRage(i1, CountTypeName.Add)
end
role.Event:AddEvent(BattleEventName.RoleTurnEnd, onTurnEnd)
end,
-- 普攻伤害增加[a]%[b]改变
-- a[float]b[改变类型]
[96] = function(role, args)
local f1 = args[1]
local ct = args[2]
local passivityDamaging = function(func, caster, damage)
if func then
local dd = BattleUtil.CountValue(damage, f1, ct) - damage
func(-floor(BattleUtil.ErrorCorrection(dd)))
end
end
local OnSkillCast = function(skill)
if skill.type == BattleSkillType.Normal then
role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
end
end
local OnSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Normal then
role.Event:RemoveEvent(BattleEventName.PassiveDamaging, passivityDamaging)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
-- 释放技能有[a]%对全体造成[c]%[d]伤害
-- a[float]b[int]c[float]d[伤害类型]
[97] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local dt = args[3]
-- 释放技能后
local onSkillEnd = function(skill)
BattleUtil.RandomAction(f1, function()
BattleLogic.WaitForTrigger(0.1, function()
local list = BattleLogic.Query(function(v)
return v.camp == (role.camp + 1) % 2
end)
for _, r in ipairs(list) do
BattleUtil.CalDamage(nil, role, r, dt, f2)
end
end)
end)
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- 释放技能[a]概率不消耗怒气
-- a[float]
[98] = function(role, args)
local f1 = args[1]
local onRageCost = function(noCostRate, costRage, func)
local dRate = f1
local dCost = 0
if func then func(dRate, dCost) end
end
role.Event:AddEvent(BattleEventName.RoleRageCost, onRageCost)
end,
-- 技能直接伤害的[a]%治疗友方生命最少队友。
-- a[float]
[99] = function(role, args)
local f1 = args[1]
local OnHit = function(atkRole, damage, bCrit, finalDmg, damageType)
local arr = BattleLogic.Query(function (r) return r.camp == role.camp end)
BattleUtil.SortByHpFactor(arr, 1)
-- 治疗血量最低队友实际伤害的f1%
BattleUtil.ApplyTreat(role, arr[1], floor(BattleUtil.ErrorCorrection(finalDmg*f1)))
end
role.Event:AddEvent(BattleEventName.RoleHit, OnHit)
end,
-- 释放技能不消耗怒气几率[a]改变[b]%
-- a[改变类型]b[float]
[100] = function(role, args)
local ct = args[1]
local f1 = args[2]
local onRageCost = function(noCostRate, costRage, func)
local dRate = BattleUtil.CountValue(noCostRate, f1, ct) - noCostRate
dRate = BattleUtil.ErrorCorrection(dRate)
local dCost = 0
if func then func(dRate, dCost) end
end
role.Event:AddEvent(BattleEventName.RoleRageCost, onRageCost)
end,
-- 释放技能技能[a]概率[b]改变[c]%
-- a[控制状态]b[改变类型]c[float]
[101] = function(role, args)
local ctl = args[1]
local ct = args[2]
local f1 = args[3]
local onSkillControl = function(target, buff, rate, func)
if buff.type == BuffName.Control and buff.ctrlType == ctl then
local finalRate = BattleUtil.CountValue(rate, f1, ct)
if func then func(finalRate) end
end
end
local onSkillCast = function(skill)
if skill.type == BattleSkillType.Special then
role.Event:AddEvent(BattleEventName.SkillRandomBuff, onSkillControl)
end
end
local onSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Special then
role.Event:RemoveEvent(BattleEventName.SkillRandomBuff, onSkillControl)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
end,
-- 释放技能后追加[a]次普攻
-- a[int]
[102] = function(role, args)
local i1 = args[1]
-- 释放技能后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Special then
for i = 1, i1 do
role:AddSkill(BattleSkillType.Normal, false, true, nil)
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- 直接伤害每次击杀目标增加[a]%的[b]可叠加持续至战斗结束[c]改变
-- a[float]b[属性]c[改变类型]
[103] = function(role, args)
local f1 = args[1]
local pro = args[2]
local ct = args[3]
-- 释放技能后
local onRoleHit = function(defRole)
if defRole.isDead then
local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, ct)
-- buff.cover = true
role:AddBuff(buff)
end
end
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
end,
-- 释放技能后给除自己外己方生命最少的武将附加无敌盾持续[b]回合(只剩自己则不加)
--b[属性]
[104] = function(role, args)
local i1 = args[1]
-- 释放技能后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Special then
local list = BattleLogic.Query(function(v) return v.camp == role.camp end)
BattleUtil.SortByHpFactor(list, 1)
local target = nil
for i = 1, #list do
if not list[i].isDead and list[i] ~= role then
target = list[i]
break
end
end
if target then
target:AddBuff(Buff.Create(role, BuffName.Shield, i1, ShieldTypeName.AllReduce, 0, 0))
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- 释放技能后增加友方全体[a]点怒气
-- a[int]
[105] = function(role, args)
local i1 = args[1]
-- 释放技能后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Special then
local list = BattleLogic.Query(function(v) return v.camp == role.camp end)
for i = 1, #list do
local r = list[i]
r:AddRage(i1, CountTypeName.Add)
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- 受到直接伤害[a]%治疗友方[b]最少[c]个单位
-- a[float]b[属性]c[int]
[106] = function(role, args)
local f1 = args[1]
local pro = args[2]
local i1 = args[3]
local onBeHit = function(caster, damage)
local list = BattleLogic.Query(function(v) return v.camp == role.camp end)
list = BattleUtil.SortByProp(list, BattlePropList[pro], 1)
for i = 1, i1 do
local r = list[i]
if r and not r.isDead then
local treatValue = floor(BattleUtil.ErrorCorrection(f1 * damage))
BattleUtil.ApplyTreat(role, r, treatValue)
end
end
end
role.Event:AddEvent(BattleEventName.RoleBeHit, onBeHit)
end,
-- 释放技能后自身回[a]点怒气
-- a[int]
[107] = function(role, args)
local i1 = args[1]
-- 释放技能后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Special then
role:AddRage(i1, CountTypeName.Add)
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- 受到技能或普攻直接伤害的[a]%反弹给攻击者
-- a[float]
[108] = function(role, args)
local f1 = args[1]
local onBeHit = function(caster, damage, bCrit, finalDmg, damageType, skill)
if skill then --技能造成的直接伤害
local rDamage = floor(BattleUtil.ErrorCorrection(f1 * damage))
BattleUtil.ApplyDamage(nil, role, caster, rDamage)
end
end
role.Event:AddEvent(BattleEventName.RoleBeHit, onBeHit)
end,
-- 受到普通攻击或直接伤害时回复自身[a]点怒气
-- a[int]
[109] = function(role, args)
local i1 = args[1]
local onBeSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Normal then
role:AddRage(i1, CountTypeName.Add)
end
end
role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onBeSkillCastEnd)
end,
-- 释放技能后降低目标[a]点怒气
-- a[int]
[110] = function(role, args)
local i1 = args[1]
-- 释放技能后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Special then
local list = skill:GetDirectTargets()
if list then
for i = 1, #list do
list[i]:AddRage(i1, CountTypeName.Sub)
end
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- 被击杀时[a]%概率[b]敌方武将[c]回合
-- a[float]b[控制状态]c[int]
[111] = function(role, args)
local f1 = args[1]
local ctl = args[2]
local i1 = args[3]
local onRoleBeDamaged = function(caster, damage, bCrit, finalDmg, damageType, isDot, skill)
if role.isDead and skill then
BattleUtil.RandomAction(f1, function()
caster:AddBuff(Buff.Create(role, BuffName.Control, i1, ctl))
end)
end
end
role.Event:AddEvent(BattleEventName.RoleBeDamaged, onRoleBeDamaged)
end,
-- 战斗第[a]回合造成伤害必定暴击
-- a[int]
[112] = function(role, args)
local i1 = args[1]
local function onRoleDamageAfter(target)
target.isFlagCrit = false
role.Event:RemoveEvent(BattleEventName.RoleDamageAfter, onRoleDamageAfter)
end
local function onRoleDamageBefore(target)
if BattleLogic.GetCurRound() == i1 then
target.isFlagCrit = true
role.Event:AddEvent(BattleEventName.RoleDamageAfter, onRoleDamageAfter)
end
end
role.Event:AddEvent(BattleEventName.RoleDamageBefore, onRoleDamageBefore)
end,
-- 追加的普攻[a]%概率暴击
-- a[float]
[113] = function(role, args)
local f1 = args[1]
local function onSkillCast(skill)
if skill.type == BattleSkillType.Normal and skill.isAdd then
role.data:AddValue(RoleDataName.Crit, f1)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
local function onSkillCastEnd(skill)
if skill.type == BattleSkillType.Normal and skill.isAdd then
role.data:SubValue(RoleDataName.Crit, f1)
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
end,
-- 直接伤害击杀目标后追加[a]次普攻
-- a[int]
[114] = function(role, args)
local i1 = args[1]
-- 释放技能后
local onRoleHit = function(target)
if target.isDead then
for i = 1, i1 do
role:AddSkill(BattleSkillType.Normal, false, true, nil)
end
end
end
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
end,
-- 战斗第[a]回合增加[c]%的自身伤害持续[e]回合,[f]改变
-- a[int]c[float]e[int]f[改变]
[115] = function(role, args)
local i1 = args[1]
local f1 = args[2]
local i2 = args[3] or 1
local ct = args[4]
-- 如果是技能的伤害则判断加成
local onPassiveDamaging = function(func, target, damage, skill)
if skill then
local dd = BattleUtil.CountValue(damage, f1, ct) - damage
if func then func(-floor(BattleUtil.ErrorCorrection(dd))) end
end
end
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound)
-- 第i1回合开始
if curRound == i1 then
role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
end
-- 第i1+i2回合结束
if curRound == i1 + i2 then
role.Event:RemoveEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
end
end)
end,
-- 直接伤害击杀目标回复自身[a]%的[b]
-- a[float]
[116] = function(role, args)
local f1 = args[1]
-- 释放技能后
local onRoleHit = function(target)
if target.isDead then
local treat = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.MaxHp), f1))
BattleUtil.CalTreat(role, role, treat)
end
end
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
end,
-- 技能目标每[a]改变[b]个,技能伤害增加[c]%[d]改变
-- a[改变类型]b[int]c[float]d[改变类型]
[117] = function(role, args)
local ct = args[1] -- 对方阵营中死亡数量(目前没有用到)
local i1 = args[2]
local f1 = args[3]
local ct2 = args[4]
-- 每次释放技能时提前计算额外加成的伤害
local extra = 0
local onSkillCast = function(skill)
extra = 0
if skill and skill.type == BattleSkillType.Special then
-- local roleList =BattleLogic.Query(function (r) return r.camp ~= role.camp end)
-- local deadNum = 6 - #roleList
-- local level = math.floor(deadNum/i1)
-- extra = BattleUtil.ErrorCorrection(level * f1)
-- 改变值 = 技能最大目标数 - 当前目标数
local maxNum = skill:GetMaxTargetNum()
local curNum = #skill:GetDirectTargets()
local lessNum = max(maxNum - curNum, 0)
local level = math.floor(lessNum/i1)
extra = BattleUtil.ErrorCorrection(level * f1)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
-- 如果是技能的伤害则判断加成
local onPassiveDamaging = function(func, target, damage, skill)
if skill and skill.type == BattleSkillType.Special then
local dd = BattleUtil.CountValue(damage, extra, ct2) - damage
if func then func(-floor(BattleUtil.ErrorCorrection(dd))) end
end
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
end,
-- 每次释放技能,技能伤害增加[a]%,无限叠加释放普攻时清除加成,[b]改变
-- a[float]b[改变类型]
[118] = function(role, args)
local f1 = args[1]
local ct = args[2]
local af = 0
local onSkillCast = function(skill)
if skill.type == BattleSkillType.Normal then
af = 0
elseif skill.type == BattleSkillType.Normal then
af = af + f1
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
-- 如果是技能的伤害则判断加成
local onPassiveDamaging = function(func, target, damage, skill)
if skill and skill.type == BattleSkillType.Special then
local dd = BattleUtil.CountValue(damage, af, ct) - damage
if func then func(-floor(BattleUtil.ErrorCorrection(dd))) end
end
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
end,
-- 普攻后[a]改变自身[b]%的[c]持续[d]回合可叠加
-- a[改变类型]b[float]c[属性]d[int]
[119] = function(role, args)
local ct = args[1]
local f1 = args[2]
local pro = args[3]
local i1 = args[4]
-- 释放技能后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Normal then
local buff = Buff.Create(role, BuffName.PropertyChange, i1, BattlePropList[pro], f1, ct)
buff.cover = true
role:AddBuff(buff)
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- 受到直接伤害[a]%治疗友方全体
-- a[float]
[120] = function(role, args)
local f1 = args[1]
local onBeHit = function(caster, damage)
local list = BattleLogic.Query(function(v) return v.camp == role.camp end)
for i = 1, #list do
local r = list[i]
if r and not r.isDead then
local treatValue = floor(BattleUtil.ErrorCorrection(f1 * damage))
BattleUtil.ApplyTreat(role, r, treatValue)
end
end
end
role.Event:AddEvent(BattleEventName.RoleBeHit, onBeHit)
end,
-- 普攻后回复[a]点怒气
-- a[int]
[121] = function(role, args)
local i1 = args[1]
-- 释放技能后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Normal then
role:AddRage(i1, CountTypeName.Add)
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- TODO 减伤盾效果未添加
-- 释放技能后给己方前排武将附加减伤盾持续时间[a]改变[b]回合
-- a[改变类型]b[int]
[122] = function(role, args)
local ct = args[1]
local i1 = args[2]
-- 释放技能后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Special then
local list = BattleLogic.Query(function(v) return v.camp == role.camp and v.position <= 3 end)
for _, role in ipairs(list) do
BattleLogic.BuffMgr:QueryBuff(role, function(buff)
if buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.RateReduce then
buff:ChangeBuffDuration(ct, i1)
end
end)
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
--TODO 减伤盾效果未添加
-- 释放技能后给己方前排附加减伤盾效果[a]改变[b]%
-- a[改变类型]b[float]
[123] = function(role, args)
local ct = args[1]
local f1 = args[2]
-- 释放技能后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Special then
local list = BattleLogic.Query(function(v) return v.camp == role.camp and v.position <= 3 end)
for _, role in ipairs(list) do
BattleLogic.BuffMgr:QueryBuff(role, function(buff)
if buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.RateReduce then
buff:ChangeShieldValue(ct, f1)
end
end)
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- 释放技能后回复己方后排[a]点怒气
-- a[int]
[124] = function(role, args)
local i1 = args[1]
-- 释放技能后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Special then
local list = BattleLogic.Query(function(v) return v.position > 3 end)
for _, r in ipairs(list) do
r:AddRage(i1, CountTypeName.Add)
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- 直接伤害击杀目标下回合攻击[a]%暴击(TODO:目前为增加[a]%)
-- a[float]
[125] = function(role, args)
local f1 = args[1]
-- 释放技能后
local onRoleHit = function(target)
if target.isDead then
local buff = Buff.Create(role, BuffName.PropertyChange, 1, RoleDataName.Crit, f1, CountTypeName.Add)
role:AddBuff(buff)
end
end
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
end,
-- 战斗中生命每减少[c]%[d]就[e]改变[f]%
-- c[float]d[属性]e[改变类型]f[float]
[126] = function(role, args)
local f1 = args[1]
local pro = args[2]
local dt = args[3]
local f2 = args[4]
local curLevel = 0
-- 释放技能后
local onRoleBeDamaged = function(caster, damage)
local levelDamage = floor(role:GetRoleData(RoleDataName.MaxHp)*f1)
local lostDamage = role:GetRoleData(RoleDataName.MaxHp) - role:GetRoleData(RoleDataName.Hp)
local level = floor(lostDamage/levelDamage)
if level > curLevel then
local dl = level - curLevel
local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f2*dl, dt)
role:AddBuff(buff)
curLevel = level
end
end
role.Event:AddEvent(BattleEventName.RoleBeDamaged, onRoleBeDamaged)
end,
-- 与48相同
-- [127] = {},
-- 普攻后降低目标[b]点怒气
-- a[int]
[128] = function(role, args)
local i1 = args[1]
-- 普攻后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Normal then
local list = skill:GetDirectTargets()
if list then
for _, r in ipairs(list) do
r:AddRage(i1, CountTypeName.Sub)
end
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- TODO
-- 全体蜀国武将增加[a]%[b]
-- a[float]b[属性]
-- [129] = {},
-- TODO
-- 死亡后持续战斗两回合期间受伤不致死,[a]回合后自动死亡。期间技能伤害降低[b]%无法触发追击效果且死后无法被复活。
-- a[int]b[float]
-- [130] = {},
-- 敌方每[a]改变[b]人自身伤害就[d]改变[e]% (敌方每死亡i1个则自身属性改变)
-- a[改变类型]b[int]d[改变类型]e[float]
[131] = function(role, args)
local ct1 = args[1]
local i1 = args[2]
local ct2 = args[3]
local f1 = args[4]
local deadNum = 0
local extra = 0
-- 释放技能后
local OnDead = function(deadRole)
if deadRole.camp == (role.camp + 1)%2 then
deadNum = deadNum + 1
if deadNum >= i1 then
deadNum = 0
extra = extra + f1
-- local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, ct2)
-- role:AddBuff(buff)
end
end
end
BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead, OnDead)
local passivityDamaging = function(func, caster, damage, skill)
if skill then
if func then
local dd = BattleUtil.CountValue(damage, extra, ct2) - damage
func(-floor(BattleUtil.ErrorCorrection(dd)))
end
end
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
end,
-- 直接伤害每次击杀目标增加自身伤害[a]%[b]改变,可叠加持续至战斗结束
-- a[float]b[改变类型]
[132] = function(role, args)
local f1 = args[1]
local ct = args[2]
local killNum = 0
local extra = 0
-- 击杀数量累加
local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
if skill and defRole.isDead then
killNum = killNum + 1
end
end
role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit)
-- 释放技能时计算额外伤害
local OnSkillCast = function(skill)
if skill then
extra = f1 * killNum
end
end
role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
-- 造成伤害时判断额外伤害
local passivityDamaging = function(func, caster, damage, skill)
if skill then
if func then
local dd = BattleUtil.CountValue(damage, extra, ct) - damage
func(-floor(BattleUtil.ErrorCorrection(dd)))
end
end
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
end,
-- 攻击时若目标[a]则当次攻击自身[b][c]改变[d]%
-- a[持续伤害状态]b[属性]c[改变类型]d[float}
[133] = function(role, args)
local dot = args[1]
local pro = args[2]
local ct = args[3]
local f1 = args[4]
local index, tran
local OnRoleDamageBefore = function(target)
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
index, tran = role:AddPropertyTransfer(BattlePropList[pro], f1, BattlePropList[pro], ct)
end
end
local OnRoleDamageAfter = function()
if index and tran then
role:RemovePropertyTransfer(index, tran)
end
end
role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
role.Event:AddEvent(BattleEventName.RoleDamageAfter, OnRoleDamageAfter)
end,
-- 释放技能技能[a]概率[b]改变[c]%
-- a[持续伤害状态]b[改变类型]c[float]
[134] = function(role, args)
local dot = args[1]
local ct = args[2]
local f1 = args[3]
local onSkillControl = function(target, buff, rate, func)
if buff.type == BuffName.DOT and buff.damageType == dot then
local finalRate = BattleUtil.CountValue(rate, f1, ct)
if func then func(finalRate) end
end
end
local onSkillCast = function(skill)
if skill.type == BattleSkillType.Special then
role.Event:AddEvent(BattleEventName.SkillRandomBuff, onSkillControl)
end
end
-- 技能后后
local onSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Special then
role.Event:RemoveEvent(BattleEventName.SkillRandomBuff, onSkillControl)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
end,
-- 普攻有[a]%概率使目标[b]持续[c]回合每回合造成攻击者20%攻击力的伤害)
-- a[float]b[持续伤害状态]c[int]
[135] = function(role, args)
local f1 = args[1]
local dot = args[2]
local i1 = args[3]
-- 普攻后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Normal then
local list = skill:GetDirectTargets()
if list then
local attack = role:GetRoleData(RoleDataName.Attack)
local damage = floor(BattleUtil.ErrorCorrection(attack * 0.2))
for _, r in ipairs(list) do
BattleUtil.RandomAction(f1, function()
local buff = Buff.Create(role, BuffName.DOT, i1, 1, dot, damage)
buff.isRealDamage = true
r:AddBuff(buff)
end)
end
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- 受到普攻有[a]%概率使攻击者[b]持续[c]回合每回合造成攻击者20%攻击力的伤害)
-- a[float]b[持续伤害状态]c[int]
[136] = function(role, args)
local f1 = args[1]
local dot = args[2]
local i1 = args[3]
-- 普攻后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Normal then
local caster = skill.owner
BattleUtil.RandomAction(f1, function()
local attack = role:GetRoleData(RoleDataName.Attack)
local damage = floor(BattleUtil.ErrorCorrection(attack * 0.2))
local buff = Buff.Create(role, BuffName.DOT, i1, 1, dot, damage)
buff.isRealDamage = true
caster:AddBuff(buff)
end)
end
end
role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onSkillEnd)
end,
-- 释放技能后给目标附加治疗效果每回合回复[a]的[b]%点生命持续[c]回合
-- a[属性]b[float]c[int]
[137] = function(role, args)
local pro = args[1]
local f1 = args[2]
local i1 = args[3]
-- 技能后后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Special then
local list = skill:GetDirectTargets()
if list then
local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(pro) * f1))
for _, r in ipairs(list) do
local auraBuff = Buff.Create(role, BuffName.HOT, i1, 1, tv)
auraBuff.interval = 1
r:AddBuff(auraBuff)
end
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- 释放普攻后给目标附加治疗效果每回合回复[a]的[b]%点生命持续[c]回合
-- a[属性]b[float]c[int]
[138] = function(role, args)
local pro = args[1]
local f1 = args[2]
local i1 = args[3]
-- 技能后后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Normal then
local list = skill:GetDirectTargets()
if list then
local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(pro) * f1))
for _, r in ipairs(list) do
local auraBuff = Buff.Create(role, BuffName.HOT, i1, 1, tv)
auraBuff.interval = 1
r:AddBuff(auraBuff)
end
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- TODO
-- 释放技能后给目标附加治疗效果[a]改变[b]%
-- a[改变类型]b[float]
[139] = function(role, args)
local dt = args[1]
local f1 = args[2]
local tFactor = function(factorFunc)
factorFunc(dt, f1)
end
role.Event:AddEvent(BattleEventName.SkillCast, function(skill)
if skill.type == BattleSkillType.Special then
role.Event:AddEvent(BattleEventName.PassiveTreatingFactor, tFactor)
end
end)
role.Event:AddEvent(BattleEventName.SkillCastEnd, function(skill)
if skill.type == BattleSkillType.Special then
role.Event:RemoveEvent(BattleEventName.PassiveTreatingFactor, tFactor)
end
end)
end,
-- 受到[a]状态敌人攻击时受到伤害[b]改变[c]%
-- a[持续伤害状态]b[改变类型]c[float]
[140] = function(role, args)
local dot = args[1]
local ct = args[2]
local f1 = args[3]
local onPassiveBeDamaging = function(func, caster, damage)
if BattleLogic.BuffMgr:HasBuff(caster, BuffName.DOT, function(buff) return buff.damageType == dot end) then
local dmgDeduction = damage - floor(BattleUtil.ErrorCorrection(BattleUtil.CountValue(damage, f1, ct)))
if func then func(dmgDeduction) end
end
end
role.Event:AddEvent(BattleEventName.PassiveBeDamaging, onPassiveBeDamaging)
end,
-- 战斗第[a]回合无敌
-- a[int]
[141] = function(role, args)
local i1 = args[1]
local buff
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound)
-- 第i1回合开始
if curRound == i1 then
buff = Buff.Create(role, BuffName.Shield, 0, ShieldTypeName.AllReduce, 0, 0)
buff.clear = false
role:AddBuff(buff)
end
if curRound == i1 + 1 then
if buff then
buff.disperse = true
end
end
end)
end,
-- 释放技能时如目标处于[a]状态则伤害的[b]%转化为生命治疗自己
-- a[持续伤害状态]b[float]
[142] = function(role, args)
local dot = args[1]
local f1 = args[2]
local onHit = function(target, damage, bCrit, finalDmg)
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(finalDmg * f1)))
end
end
local onSkillCast = function(skill)
if skill.type == BattleSkillType.Special then
role.Event:AddEvent(BattleEventName.RoleHit, onHit)
end
end
-- 技能后后
local onSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Special then
role.Event:RemoveEvent(BattleEventName.RoleHit, onHit)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
end,
-- 释放技能时如目标处于[a]状态则[b]的概率[c]改变[d]%
-- a[持续伤害状态]b[控制状态]c[改变类型]d[float]
[143] = function(role, args)
local dot = args[1]
local ctrl = args[2]
local ct = args[3]
local f1 = args[4]
local onSkillControl = function(target, buff, rate, func)
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(b) return b.damageType == dot end) then
if buff.type == BuffName.Control and buff.ctrlType == ctrl then
local finalRate = BattleUtil.CountValue(rate, f1, ct)
if func then func(finalRate) end
end
end
end
local onSkillCast = function(skill)
if skill.type == BattleSkillType.Special then
role.Event:AddEvent(BattleEventName.SkillRandomBuff, onSkillControl)
end
end
-- 技能后后
local onSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Special then
role.Event:RemoveEvent(BattleEventName.SkillRandomBuff, onSkillControl)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
end,
-- TODO
-- 死亡时释放[a]次技能
-- a[int]
-- [144] =
-- 技能对[a]目标[b]额外提升[c]%(当次),[d]改变
-- a[持续伤害状态]b[属性]c[float]d[改变类型]
[145] = function(role, args)
local dot = args[1]
local pro = args[2]
local f1 = args[3]
local ct = args[4]
local index, tran
local OnRoleDamageBefore = function(target, factorFunc, damageType, skill)
if skill and skill.type == BattleSkillType.Special and
BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
index, tran = role:AddPropertyTransfer(BattlePropList[pro], f1, BattlePropList[pro], ct)
end
end
local OnRoleDamageAfter = function()
if index and tran then
role:RemovePropertyTransfer(index, tran)
end
end
role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
role.Event:AddEvent(BattleEventName.RoleDamageAfter, OnRoleDamageAfter)
end,
-- 普攻对[a]目标伤害额外增加[b]%(当次),[c]改变
-- a[持续伤害状态]b[float]c[改变类型]
[146] = function(role, args)
local dot = args[1]
local f1 = args[2]
local ct = args[3]
local onPassiveDamaging = function(damagingFunc, defRole, damage)
if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return buff.damageType == dot end) then
if damagingFunc then
local dd = BattleUtil.CountValue(damage, f1, ct) - damage
damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
end
end
end
local onSkillCast = function(skill)
if skill.type == BattleSkillType.Normal then
role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
end
end
local onSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Normal then
role.Event:RemoveEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
end,
-- 受到攻击有[a]%概率使攻击者[b]每回合造成被击者自身20%攻击力的伤害)持续[c]回合
-- a[float]b[持续伤害状态]c[int]
[147] = function(role, args)
local f1 = args[1]
local dot = args[2]
local i1 = args[3]
-- 技能后后
local onRoleBeHit = function(caster)
BattleUtil.RandomAction(f1, function()
local attack = role:GetRoleData(RoleDataName.Attack)
local damage = floor(BattleUtil.ErrorCorrection(attack * 0.2))
local buff = Buff.Create(role, BuffName.DOT, i1, 1, dot, damage)
buff.isRealDamage = true
caster:AddBuff(buff)
end)
end
role.Event:AddEvent(BattleEventName.RoleBeHit, onRoleBeHit)
end,
-- 直接伤害击杀[a]目标回复[b]%的最大生命
-- a[持续伤害状态]b[float]
[148] = function(role, args)
local dot = args[1]
local f1 = args[2]
local function onHit(target)
if target.isDead then
local maxHp = role:GetRoleData(RoleDataName.MaxHp)
local value = floor(BattleUtil.ErrorCorrection(maxHp* f1))
BattleUtil.ApplyTreat(role, role, value)
end
role.Event:RemoveEvent(BattleEventName.RoleHit, onHit)
end
local onDamaging = function(func, target)
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
role.Event:AddEvent(BattleEventName.RoleHit, onHit)
end
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, onDamaging)
end,
-- TODO
-- 技能攻击的目标如本回合直接攻击过自己则对其造成伤害增加[a]%(如目标[b]则伤害增加[c]%)
-- a[float]b[持续伤害状态]c[float]
-- [149]
-- 技能对[a]目标当次伤害提升[b]%[c]改变
-- a[持续伤害状态]b[flaot]c[改变类型]
[150] = function(role, args)
local dot = args[1]
local f1 = args[2]
local ct = args[3]
local onPassiveDamaging = function(damagingFunc, defRole, damage)
if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return buff.damageType == dot end) then
if damagingFunc then
local dd = BattleUtil.CountValue(damage, f1, ct) - damage
damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
end
end
end
local onSkillCast = function(skill)
if skill.type == BattleSkillType.Special then
role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
end
end
local onSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Special then
role.Event:RemoveEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
end,
-- 释放普通攻击如目标[a],且血量低于[b]%则有[c]%概率秒杀
-- a[持续伤害状态]b[float]c[float]
[151] = function(role, args)
local dot = args[1]
local f1 = args[2]
local f2 = args[3]
--
local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
if skill and skill.type == BattleSkillType.Normal then
if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
local ft = defRole:GetRoleData(RoleDataName.Hp)/defRole:GetRoleData(RoleDataName.MaxHp)
if ft < f1 then
BattleUtil.RandomAction(f2, function()
-- 秒杀
BattleUtil.Seckill(skill, role, defRole)
end)
end
end
end
end
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
end,
-- 释放技能有[a]%概率附加[b]效果持续[c]回合
-- a[float]b[控制状态]c[int]
[152] = function(role, args)
local f1 = args[1]
local ctrl = args[2]
local i1 = args[3]
-- 技能后后
local onSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Special then
local targets = skill:GetDirectTargets()
if targets then
for _, r in ipairs(targets) do
BattleUtil.RandomAction(f1, function()
local buff = Buff.Create(role, BuffName.Control, i1, ctrl)
r:AddBuff(buff)
end)
end
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
end,
-- 直接伤害击杀目标回复自身[a]点怒气
-- a[int]
[153] = function(role, args)
local i1 = args[1]
local onHit = function(target, damage, bCrit, finalDmg)
if target.isDead then
role:AddRage(i1, CountTypeName.Add)
end
end
role.Event:AddEvent(BattleEventName.RoleHit, onHit)
end,
-- TODO
-- 复活友方第[a]位阵亡的英雄并回复其[b]%的生命每场战斗触发[c]次
-- a[int]b[float]c[int]
-- [154]
-- 目标血量每降低[c]%(只看当前血量),对其治疗量就[e]改变[f]%
-- c[float]e[改变类型]f[float]
[155] = function(role, args)
local f1 = args[1]
local ct = args[2]
local f2 = args[3]
local function onPassiveTreatingFactor(treatFactorFunc, targetRole)
local lf = targetRole:GetRoleData(RoleDataName.Hp)/targetRole:GetRoleData(RoleDataName.MaxHp)
local df = 1 - lf -- 血量降低百分比 = 1 - 当前血量百分比
local level = floor(df/f1)
if treatFactorFunc then
treatFactorFunc(ct, BattleUtil.ErrorCorrection(level*f2))
end
end
role.Event:AddEvent(BattleEventName.PassiveTreatingFactor, onPassiveTreatingFactor)
end,
-- 受到普攻后降低攻击自己武将的[c]点怒气
-- c[int]
[156] = function(role, args)
local i1 = args[1]
local onBeSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Normal then
skill.owner:AddRage(i1, CountTypeName.Sub)
end
end
role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onBeSkillCastEnd)
end,
-- 减伤盾减伤比例[a]改变[b]%
-- a[改变类型]b[float]
[157] = function(role, args)
local ct = args[1]
local f1 = args[2]
local OnBuffCaster = function(buff)
if buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.RateReduce then
buff:ChangeShieldValue(ct, f1)
end
end
role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
end,
-- 释放技能后回复当前本方阵容最靠前武将[a]点怒气
-- a[int]
[158] = function(role, args)
local i1 = args[1]
local onSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Special then
local list = BattleLogic.Query(function(v) return v.camp == role.camp end)
table.sort(list, function(a, b)
return a.position < b.position
end)
for i= 1, #list do
if list[i] and not list[i].isDead then
list[i]:AddRage(i1, CountTypeName.Add)
break
end
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
end,
-- [a]伤害[b]改变[c]%技能效果111专属被动
-- a[持续伤害状态]b[改变类型]c[float]
[159] = function(role, args)
local dot = args[1]
local ct = args[2]
local f1 = args[3]
local onSkillEffectBefore = function(skill, e, func)
if skill.type == BattleSkillType.Special then
if e.type == 111 then -- 当前只对技能效果103生效
if e.args[2] == dot then
local factor = BattleUtil.ErrorCorrection(BattleUtil.CountValue(e.args[3], f1, ct))
e.args[3] = factor
if func then func(e) end
end
end
end
end
role.Event:AddEvent(BattleEventName.SkillEffectBefore, onSkillEffectBefore)
end,
-- 受到普攻是有[a]%概率给攻击者附加[b],每回合对目标造成自身攻击的[c]%伤害,持续[d]回合
-- a[float]b[持续伤害状态]c[float]d[int]
[160] = function(role, args)
local f1 = args[1]
local dot = args[2]
local f2 = args[3]
local i1 = args[3]
-- 技能后后
local onBeSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Normal then
BattleUtil.RandomAction(f1, function()
local attack = role:GetRoleData(RoleDataName.Attack)
local damage = floor(BattleUtil.ErrorCorrection(attack * f2))
local buff = Buff.Create(role, BuffName.DOT, i1, 1, dot, damage)
buff.isRealDamage = true
skill.owner:AddBuff(buff)
end)
end
end
role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onBeSkillCastEnd)
end,
-- 战斗中生命每减少[a]%,自身伤害就[b]改变[c]%,减少为[d]改变
-- a[float]b[改变类型]c[float]d[改变类型]
[165] = function(role, args)
local f1 = args[1]
local ct = args[2]
local f2 = args[3]
local ct2 = args[4]
-- 释放技能后
local onPassiveDamaging = function(damagingFunc, defRole, damage, skill)
local levelDamage = floor(role:GetRoleData(RoleDataName.MaxHp)*f1)
local lostDamage = role:GetRoleData(RoleDataName.MaxHp) - role:GetRoleData(RoleDataName.Hp)
local level = floor(lostDamage/levelDamage)
local dd = BattleUtil.CountValue(damage, f2*level, ct) - damage
damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
end,
-- 普通攻击时如目标处于[a]状态则伤害的[b]%转化为生命治疗自己
-- a[持续伤害状态]b[float]
[166] = function(role, args)
local dot = args[1]
local f1 = args[2]
local onHit = function(target, damage, bCrit, finalDmg)
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(finalDmg * f1)))
end
end
local onSkillCast = function(skill)
if skill.type == BattleSkillType.Normal then
role.Event:AddEvent(BattleEventName.RoleHit, onHit)
end
end
-- 技能后后
local onSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Normal then
role.Event:RemoveEvent(BattleEventName.RoleHit, onHit)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
end,
-- 如果目标数量大于[a]个,增加自身[b]点怒气
-- a[int]b[int]
[167] = function(role, args)
local i1 = args[1]
local i2 = args[2]
-- 释放技能后
local onSkillEnd = function(skill)
local targets = skill:GetDirectTargets()
if targets and #targets > i1 then
role:AddRage(i2, 1)
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- 释放技能后给当前血量最少的2名队友附加无敌吸血盾持续[a]回合
-- a[int]
[168] = function(role, args)
local i1 = args[1]
-- 释放技能后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Special then
local list = BattleLogic.Query(function(v) return v.camp == role.camp end)
BattleUtil.SortByHpFactor(list, 1)
local index = 0
for i = 1, #list do
if not list[i].isDead and index < 2 then
index = index + 1
-- 吸血率%25 策划说写死
list[i]:AddBuff(Buff.Create(role, BuffName.Shield, i1, ShieldTypeName.AllReduce, 0.25, 0))
end
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- 行动后增加自身[a]%的[b](可叠加持续至结束)
-- a[float]b[属性]
[169] = function(role, args)
local f1 = args[1]
local pro = args[2]
-- 行动结束后
local onTurnEnd = function()
local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, CountTypeName.AddPencent)
role:AddBuff(buff)
end
role.Event:AddEvent(BattleEventName.RoleTurnEnd, onTurnEnd)
end,
-- 击杀目标后对敌方血量百分比最低两名角色造成[a]%[b]伤害
-- a[float]b[伤害类型]
[170] = function(role, args)
local f1 = args[1]
local dt = args[2]
-- 直接伤害后
local onRoleHit = function(target)
if target.isDead then
local list = BattleLogic.Query(function(v) return v.camp ~= role.camp end)
BattleUtil.SortByHpFactor(list, 1)
local index = 0
for i = 1, #list do
if not list[i].isDead and index < 2 then
index = index + 1
BattleUtil.CalDamage(nil, role, list[i], dt, f1)
end
end
end
end
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
end,
--技能治疗系数[a]改变[b]%(作用于主动技能效果103)
--a[改变类型]b[float]
[206] = function(role, args)
local ct = args[1]
local f1 = args[2]
local onSkillEffectBefore = function(skill, e, func)
if skill.type == BattleSkillType.Special then
if e.type == 103 then -- 当前只对技能效果103生效
local factor = BattleUtil.ErrorCorrection(BattleUtil.CountValue(e.args[3], f1, ct))
e.args[3] = factor
if func then func(e) end
end
end
end
role.Event:AddEvent(BattleEventName.SkillEffectBefore, onSkillEffectBefore)
end,
-- 释放技能有[a]%几率对敌方后排造成[b]%[c]伤害
-- a[float]b[float]c[伤害类型]
[207] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local dt = args[3]
-- 释放技能后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Special then
BattleUtil.RandomAction(f1, function()
BattleLogic.WaitForTrigger(0.1, function()
local list = BattleLogic.Query(function(v)
return v.camp == (role.camp + 1) % 2 and v.position > 3
end)
for _, r in ipairs(list) do
BattleUtil.CalDamage(nil, role, r, dt, f2)
end
end)
end)
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
}
return passivityList