743 lines
31 KiB
Lua
743 lines
31 KiB
Lua
local floor = math.floor
|
||
local min = math.min
|
||
local max = math.max
|
||
--local RoleDataName = RoleDataName
|
||
--local BattleLogic = BattleLogic
|
||
--local BattleUtil = BattleUtil
|
||
|
||
--属性编号
|
||
local propertyList = {
|
||
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.MaxHp,
|
||
}
|
||
|
||
local function buffRandomAction(random, caster, target, buffType, duration, ...)
|
||
local b = Random.Range01() <= random
|
||
if b then
|
||
target:AddBuff(Buff.Create(caster, buffType, duration, ...))
|
||
else
|
||
target.Event:DispatchEvent(BattleEventName.BuffDodge, caster, buffType, ...)
|
||
end
|
||
end
|
||
|
||
local function casterBulletEffect(caster, target, interval)
|
||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||
if caster.camp == 0 and target.camp == 1 then
|
||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
|
||
end
|
||
end
|
||
|
||
--效果表
|
||
local effectList = {
|
||
--造成[a]%的[b]伤害
|
||
--a[float],b[伤害类型]
|
||
[1] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
casterBulletEffect(caster, target, interval)
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
end)
|
||
end,
|
||
--造成[a]%的[b]伤害【AOE】
|
||
--a[float],b[伤害类型]
|
||
[2] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
end)
|
||
end,
|
||
--[a]%概率[b],持续[c]秒
|
||
--a[float],b[控制状态],c[float]
|
||
[3] = function(caster, target, args, interval)
|
||
local f1 = args[1] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||
local cb1 = args[2]
|
||
local f2 = args[3]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
buffRandomAction(f1, caster, target, BuffName.Control, f2, cb1)
|
||
end)
|
||
end,
|
||
--[d]改变[a]属性[b]%,持续[c]秒
|
||
--a[属性],b[float],c[int],d[改变类型]
|
||
[4] = function(caster, target, args, interval)
|
||
local pro1 = args[1]
|
||
local f1 = args[2]
|
||
local f2 = args[3]
|
||
local ct = args[4]
|
||
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
target:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro1], f1, ct))
|
||
end)
|
||
end,
|
||
--持续恢复[a]*[b]%生命,持续[c]秒
|
||
--a[属性],b[float],c[int]
|
||
[5] = function(caster, target, args, interval)
|
||
local pro1 = args[1]
|
||
local f1 = args[2]
|
||
local f2 = args[3]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
target:AddBuff(Buff.Create(caster, BuffName.HOT, f2, 1, floor(caster:GetRoleData(propertyList[pro1]) * f1)))
|
||
end)
|
||
end,
|
||
--造成[a]到[b]次[c]%的[d]伤害
|
||
--a[int],b[int],c[float],d[伤害类型]
|
||
[6] = function(caster, target, args, interval)
|
||
local i1 = args[1]
|
||
local i2 = args[2]
|
||
local f1 = args[3]
|
||
local dt = args[4]
|
||
|
||
local count = Random.RangeInt(i1, i2)
|
||
local d = interval / count
|
||
if caster.camp == 0 and target.camp == 1 then
|
||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, d)
|
||
end
|
||
for i=1, count do
|
||
BattleLogic.WaitForTrigger(d * (i-1), function ()
|
||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, d, target)
|
||
BattleLogic.WaitForTrigger(d, function ()
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
end)
|
||
end)
|
||
end
|
||
end,
|
||
--造成[a]到[b]次[c]%的[d]伤害【AOE】
|
||
--a[int],b[int],c[float],d[伤害类型]
|
||
[7] = function(caster, target, args, interval)
|
||
local i1 = args[1]
|
||
local i2 = args[2]
|
||
local f1 = args[3]
|
||
local dt = args[4]
|
||
|
||
local count = Random.RangeInt(i1, i2)
|
||
local d = interval / count
|
||
for i=1, count do
|
||
BattleLogic.WaitForTrigger(d * (i-1), function ()
|
||
BattleLogic.WaitForTrigger(d, function ()
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
end)
|
||
end)
|
||
end
|
||
end,
|
||
--[b]%改变[c]下次重击技能CD[a]秒
|
||
--a[float],b[float],c[改变类型]
|
||
[8] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local f2 = args[2] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||
local ct = args[3]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
BattleUtil.RandomAction(f2, function ()
|
||
if target.skill then
|
||
if f1 == 0 then --值为0时,直接清除CD
|
||
target.skill.sp = target.skill.spPass
|
||
else
|
||
if ct == 1 then --加算
|
||
target.skill.sp = max(target.skill.sp - floor(f1 * BattleLogic.GameFrameRate), 0)
|
||
elseif ct == 2 then --乘加算(百分比属性加算)
|
||
target.skill.sp = max(target.skill.sp - floor(target.skill.spPass * f1),0)
|
||
elseif ct == 3 then --减算
|
||
target.skill.sp = min(target.skill.sp + floor(f1 * BattleLogic.GameFrameRate), target.skill.spPass)
|
||
elseif ct == 4 then --乘减算(百分比属性减算)
|
||
target.skill.sp = min(target.skill.sp + floor(target.skill.spPass * f1), target.skill.spPass)
|
||
end
|
||
end
|
||
target.Event:DispatchEvent(BattleEventName.RoleCDChanged, target.skill.sp, target.skill.spPass)
|
||
end
|
||
end)
|
||
end)
|
||
end,
|
||
--添加[a]的[b]%护盾,持续[c]秒,盾消失的时候反射吸收伤害的[d]%
|
||
--a[属性],b[float],c[int],d[float]
|
||
[9] = function(caster, target, args, interval)
|
||
local pro1 = args[1]
|
||
local f1 = args[2]
|
||
local f2 = args[3]
|
||
local f3 = args[4]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
target:AddBuff(Buff.Create(caster, BuffName.Shield, f2, floor(caster:GetRoleData(propertyList[pro1]) * f1), f3))
|
||
end)
|
||
end,
|
||
--造成[a]%的[b]伤害,自身恢复造成伤害[c]%的生命
|
||
--a[float],b[伤害类型],c[float]
|
||
[10] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local f2 = args[3]
|
||
casterBulletEffect(caster, target, interval)
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
local dmg = BattleUtil.CalDamage(caster, target, dt, f1)
|
||
BattleUtil.CalTreat(caster, caster, floor(dmg * f2))
|
||
end)
|
||
end,
|
||
--造成[a]%的[b]伤害,对[c]造成额外[d]%伤害
|
||
--a[float],b[伤害类型,]c[职业],d[float]
|
||
[11] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local i1 = args[3]
|
||
local f2 = args[4]
|
||
casterBulletEffect(caster, target, interval)
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
if target.professionId == i1 then
|
||
f1 = f1 + f2
|
||
end
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
end)
|
||
end,
|
||
--每秒造成[a]的[b]的伤害,持续[c]秒
|
||
--a[float],b[伤害类型],c[int]
|
||
[12] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local f2 = args[3]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
target:AddBuff(Buff.Create(caster, BuffName.DOT, f2, 1, 0, dt, f1))
|
||
end)
|
||
end,
|
||
--造成[a],每秒造成[b]的[c]的伤害,持续[d]秒
|
||
--a[持续伤害状态].b[float],c[伤害类型],d[int]
|
||
[13] = function(caster, target, args, interval)
|
||
local d1 = args[1]
|
||
local f1 = args[2]
|
||
local dt = args[3]
|
||
local f2 = args[4]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
target:AddBuff(Buff.Create(caster, BuffName.DOT, f2, 1, d1, dt, f1))
|
||
end)
|
||
end,
|
||
--造成[a]%的[b]伤害,[c]%概率[d]专属伤害加深印记(如果有印记,[a]*(1+印记数量*[e])),印记最多[f]层
|
||
--a[float],b[伤害类型],c[float],d[角色id],e[float],f[int]
|
||
[14] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local f2 = args[3] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||
local rid = args[4]
|
||
local f3 = args[5]
|
||
local i1 = args[6]
|
||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
local layer
|
||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Brand, function (buff)
|
||
local b = buff.flag == rid
|
||
if b then
|
||
layer = buff.layer
|
||
end
|
||
return b
|
||
end) then
|
||
BattleUtil.CalDamage(caster, target, dt,f1 * (1 + min(layer, i1) * f3))
|
||
else
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
end
|
||
buffRandomAction(f2, caster, target, BuffName.Brand, 0, rid)
|
||
end)
|
||
end,
|
||
--造成[a]%的[b]伤害,如果击杀,则其他人再受到此次伤害的[c]%的伤害
|
||
--a[float],b[伤害类型],c[float]
|
||
[15] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local f2 = args[3]
|
||
casterBulletEffect(caster, target, interval)
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
local dmg, crit = BattleUtil.CalDamage(caster, target, dt, f1)
|
||
if target.isDead then
|
||
local arr = BattleLogic.Query(function (r) return r.camp ~= caster.camp and r.uid ~= target.uid end)
|
||
for i=1, #arr do
|
||
BattleUtil.ApplyDamage(caster, arr[i], floor(dmg * f2))
|
||
end
|
||
end
|
||
end)
|
||
end,
|
||
--吸取[a]%的[b],持续[c]秒(属于增益),累积不高于自身该属性的[d]%
|
||
--a[float],b[属性],c[float],d[float]
|
||
[16] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local pro = args[2]
|
||
local f2 = args[3]
|
||
local f3 = args[4]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
--计算上限值
|
||
local total = caster.data:GetOrginData(propertyList[pro]) * (1 + f3)
|
||
--计算预期吸取后的值
|
||
local targetValue = caster:GetRoleData(propertyList[pro]) + target:GetRoleData(propertyList[pro]) * f1
|
||
--计算有效吸收值
|
||
local delta = min(targetValue, total) - caster:GetRoleData(propertyList[pro])
|
||
|
||
if delta > 0 then
|
||
target:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro], delta, 3))
|
||
caster:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro], delta, 1))
|
||
end
|
||
end)
|
||
end,
|
||
--造成[a]%的[b]伤害,如果是[c],有[d]%必定暴击
|
||
--a[float],b[伤害类型],c[职业],d[float]
|
||
[17] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local i1 = args[3]
|
||
local f2 = args[4] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||
casterBulletEffect(caster, target, interval)
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
local dmg = floor(caster:GetRoleData(propertyList[dt]) * f1)
|
||
if target.professionId == i1 then
|
||
BattleUtil.RandomAction(f2, function ()
|
||
target.isFlagCrit = true
|
||
BattleUtil.CalDamage(caster, target, dmg)
|
||
target.isFlagCrit = false
|
||
end)
|
||
else
|
||
BattleUtil.CalDamage(caster, target, dmg)
|
||
end
|
||
end)
|
||
end,
|
||
--造成[a]%的[b]伤害,若暴击,则减少下次发动技能CD[c]秒。
|
||
--a[float],b[伤害类型],c[float]
|
||
[18] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local f2 = args[3]
|
||
casterBulletEffect(caster, target, interval)
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
local d, crit = BattleUtil.CalDamage(caster, target, dt, f1)
|
||
if crit then
|
||
if target.skill then
|
||
target.skill.sp = target.skill.sp + floor(f2 * BattleLogic.GameFrameRate)
|
||
end
|
||
end
|
||
end)
|
||
end,
|
||
--造成[a]%的[b]伤害,有[c]%的概率追加伤害,最多可追加[d]次。(0无限追加)
|
||
--a[float],b[伤害类型],c[float],d[int]
|
||
[19] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local f2 = args[3]
|
||
local i1 = args[4]
|
||
|
||
if i1 == 0 then
|
||
i1 = floor(interval * BattleLogic.GameFrameRate)
|
||
end
|
||
local count = 1
|
||
while Random.Range01() <= f2 and count <= i1 do
|
||
count = count + 1
|
||
end
|
||
local d = interval / count
|
||
if caster.camp == 0 and target.camp == 1 then
|
||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, d)
|
||
end
|
||
for i=1, count do
|
||
BattleLogic.WaitForTrigger(d * (i-1), function ()
|
||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, d, target)
|
||
BattleLogic.WaitForTrigger(d, function ()
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
end)
|
||
end)
|
||
end
|
||
end,
|
||
--造成[a]%的[b]伤害,对[c]造成额外[d]%伤害
|
||
--a[float],b[伤害类型,]c[控制状态],d[float]
|
||
[20] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local i1 = args[3]
|
||
local f2 = args[4]
|
||
casterBulletEffect(caster, target, interval)
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Control, function (buff) return i1 == 0 or buff.ctrlType == i1 end) then
|
||
f1 = f1 + f2
|
||
end
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
end)
|
||
end,
|
||
--造成[a]%的[b]伤害,对[c]有[d]%造成[e],持续[f]秒【AOE】
|
||
--a[float],b[伤害类型,]c[持续伤害状态],d[float],e[控制状态],f[int]
|
||
[21] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local dot = args[3]
|
||
local f2 = args[4] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||
local ct = args[5]
|
||
local f3 = args[6]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
|
||
buffRandomAction(f2, caster, target, BuffName.Control, f3, ct)
|
||
end
|
||
end)
|
||
end,
|
||
--造成[a]%的[b]伤害,对[c]造成额外[d]%伤害【AOE】
|
||
--a[float],b[伤害类型,]c[持续伤害状态],d[float]
|
||
[22] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local dot = args[3]
|
||
local f2 = args[4]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
|
||
f1 = f1 + f2
|
||
end
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
end)
|
||
end,
|
||
--造成[a]%的[b]伤害,对[c]造成额外[d]%伤害
|
||
--a[float],b[伤害类型,]c[持续回复状态],d[float]
|
||
[23] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local ht = args[3]
|
||
local f2 = args[4]
|
||
casterBulletEffect(caster, target, interval)
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.HOT, function (buff) return true end) then
|
||
f1 = f1 + f2
|
||
end
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
end)
|
||
end,
|
||
--瞬间恢复[a]*[b]%生命
|
||
--a[属性],b[float]
|
||
[24] = function(caster, target, args, interval)
|
||
local pro1 = args[1]
|
||
local f1 = args[2]
|
||
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
BattleUtil.CalTreat(caster, target, floor(caster:GetRoleData(propertyList[pro1]) * f1))
|
||
end)
|
||
end,
|
||
--对[a]的伤害[b]%,持续[c]秒
|
||
--a[持续伤害状态],b[float],c[int]
|
||
[25] = function(caster, target, args, interval)
|
||
local dot = args[1]
|
||
local f1 = args[2]
|
||
local f2 = args[3]
|
||
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
local func = function(damage)
|
||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
|
||
damage = damage + floor(damage * f1)
|
||
end
|
||
return damage
|
||
end
|
||
target.exCalDmgList:Add(func)
|
||
if f2 > 0 then
|
||
BattleLogic.WaitForTrigger(f2, function ()
|
||
for i=1, target.exCalDmgList.size do
|
||
if target.exCalDmgList.buffer[i] == func then
|
||
target.exCalDmgList:Remove(i)
|
||
break
|
||
end
|
||
end
|
||
end)
|
||
end
|
||
end)
|
||
end,
|
||
--造成[a]的伤害【AOE】(真实伤害)
|
||
--a[int]
|
||
[26] = function(caster, target, args, interval)
|
||
local d = args[1]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
if not target.isDead then
|
||
BattleUtil.ApplyDamage(caster, target, d)
|
||
end
|
||
end)
|
||
end,
|
||
--每秒造成[d]的伤害,持续[f]秒【AOE】(真实伤害)
|
||
--d[float],f[int]
|
||
[27] = function(caster, target, args, interval)
|
||
local d1 = args[1]
|
||
local d2 = args[2]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
target:AddBuff(Buff.Create(caster, BuffName.DOT, d2, 1, 0, d1, 1))
|
||
end)
|
||
end,
|
||
--造成[a]%的[b]伤害,对[c]造成额外[d]%伤害
|
||
--a[float],b[伤害类型,]c[持续伤害状态],d[float]
|
||
[28] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local dot = args[3]
|
||
local f2 = args[4]
|
||
casterBulletEffect(caster, target, interval)
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
|
||
f1 = f1 + f2
|
||
end
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
end)
|
||
end,
|
||
--造成[a]到[b]次[c]%的[d]伤害,对[e]造成额外[f]%伤害
|
||
--a[int],b[int],c[float],d[伤害类型],e[职业],f[float]
|
||
[29] = function(caster, target, args, interval)
|
||
local i1 = args[1]
|
||
local i2 = args[2]
|
||
local f1 = args[3]
|
||
local dt = args[4]
|
||
local pt = args[5]
|
||
local f2 = args[6]
|
||
|
||
local count = Random.RangeInt(i1, i2)
|
||
local d = interval / count
|
||
if caster.camp == 0 and target.camp == 1 then
|
||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, d)
|
||
end
|
||
for i=1, count do
|
||
BattleLogic.WaitForTrigger(d * (i-1), function ()
|
||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, d, target)
|
||
BattleLogic.WaitForTrigger(d, function ()
|
||
if target.professionId == pt then
|
||
f1 = f1 + f2
|
||
end
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
end)
|
||
end)
|
||
end
|
||
end,
|
||
--造成[a]%的[b]伤害,若为[c],则无视敌人[d]%的防御
|
||
--a[float],b[伤害类型,]c[控制状态],d[float]
|
||
[30] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local ct = args[3]
|
||
local f2 = args[4]
|
||
casterBulletEffect(caster, target, interval)
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Control, function (buff) return ct == 0 or buff.ctrlType == ct end) then
|
||
BattleUtil.CalDamage(caster, target, dt, f1, f2)
|
||
else
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
end
|
||
end)
|
||
end,
|
||
--[a]%概率[b],持续[c]秒
|
||
--a[float],b[免疫buff],c[int]
|
||
[31] = function(caster, target, args, interval)
|
||
local f1 = args[1] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||
local ib1 = args[2]
|
||
local f2 = args[3]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
buffRandomAction(f1, caster, target, BuffName.Immune, f2, ib1)
|
||
end)
|
||
end,
|
||
--[b]%改变[d]重击技能CD[a]秒 ,持续[c]秒 (0代表清除所有)
|
||
--a[float],b[float],c[改变类型]
|
||
[32] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local f2 = args[2] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||
local ct = args[3]
|
||
local d = args[4]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
BattleUtil.RandomAction(f2, function ()
|
||
local func = function()
|
||
if target.skill then
|
||
if f1 == 0 then --值为0时,直接清除CD
|
||
target.skill.sp = target.skill.spPass
|
||
else
|
||
if ct == 1 then --加算
|
||
target.skill.sp = max(target.skill.sp - floor(f1 * BattleLogic.GameFrameRate), 0)
|
||
elseif ct == 2 then --乘加算(百分比属性加算)
|
||
target.skill.sp = max(target.skill.sp - floor(target.skill.spPass * f1),0)
|
||
elseif ct == 3 then --减算
|
||
target.skill.sp = min(target.skill.sp + floor(f1 * BattleLogic.GameFrameRate), target.skill.spPass)
|
||
elseif ct == 4 then --乘减算(百分比属性减算)
|
||
target.skill.sp = min(target.skill.sp + floor(target.skill.spPass * f1), target.skill.spPass)
|
||
end
|
||
end
|
||
target.Event:DispatchEvent(BattleEventName.RoleCDChanged, target.skill.sp, target.skill.spPass)
|
||
end
|
||
end
|
||
func()
|
||
local trigger = function(skill) --新增监听事件,在印记技能结束回调时移除(印记buff可覆盖旧buff)
|
||
func()
|
||
end
|
||
target.Event:AddEvent(BattleEventName.SkillCast, trigger)
|
||
target:AddBuff(Buff.Create(caster, BuffName.Brand, d, "cd", function ()
|
||
target.Event:RemoveEvent(BattleEventName.SkillCast, trigger)
|
||
end))
|
||
end)
|
||
end)
|
||
end,
|
||
--造成[a]%的[b]伤害,[c]%概率添加[d]的印记,该角色在攻击拥有印记的目标时,额外获得(印记层数*[e])的暴击伤害,印记最多叠加[f]层。
|
||
--a[folat],b[伤害类型],c[float],d[角色id],e[float],f[float]
|
||
[33] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local f2 = args[3] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||
local rid = args[4]
|
||
local f3 = args[5]
|
||
local i1 = args[6]
|
||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
local layer
|
||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Brand, function (buff)
|
||
local b = buff.flag == rid
|
||
if b then
|
||
layer = buff.layer
|
||
end
|
||
return b
|
||
end) then
|
||
local OnPassiveCriting = function(crit)
|
||
crit(min(layer, i1) * f3)
|
||
end
|
||
caster.Event:AddEvent(BattleEventName.PassiveCriting, OnPassiveCriting)
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
caster.Event:RemoveEvent(BattleEventName.PassiveCriting, OnPassiveCriting)
|
||
else
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
end
|
||
buffRandomAction(f2, caster, target, BuffName.Brand, 0, rid)
|
||
end)
|
||
end,
|
||
--对[a]职业,[e]改变目标的[b]属性[c]%,持续[d]秒
|
||
--a[职业],b[属性],c[float],d[int],e[改变类型]
|
||
[34] = function(caster, target, args, interval)
|
||
local pt = args[1]
|
||
local pro1 = args[2]
|
||
local f1 = args[3]
|
||
local f2 = args[4]
|
||
local ct = args[5]
|
||
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
if target.professionId == pt then
|
||
target:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro1], f1, ct))
|
||
end
|
||
end)
|
||
end,
|
||
--对[a]的伤害[b]%,持续[c]秒
|
||
--a[控制状态],b[float],c[int]
|
||
[35] = function(caster, target, args, interval)
|
||
local ct = args[1]
|
||
local f1 = args[2]
|
||
local f2 = args[3]
|
||
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
local func = function(damage)
|
||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Control, function (buff) return ct == 0 or buff.ctrlType == ct end) then
|
||
damage = damage + floor(damage * f1)
|
||
end
|
||
return damage
|
||
end
|
||
target.exCalDmgList:Add(func)
|
||
if f2 > 0 then
|
||
BattleLogic.WaitForTrigger(f2, function ()
|
||
for i=1, target.exCalDmgList.size do
|
||
if target.exCalDmgList.buffer[i] == func then
|
||
target.exCalDmgList:Remove(i)
|
||
break
|
||
end
|
||
end
|
||
end)
|
||
end
|
||
end)
|
||
end,
|
||
|
||
--[d]改变[a]属性[b]%,最大叠加[c]层
|
||
--a[属性],b[float],c[int],d[改变类型]
|
||
[36] = function(caster, target, args, interval)
|
||
local pro1 = args[1]
|
||
local f1 = args[2]
|
||
local i1 = args[3]
|
||
local ct = args[4]
|
||
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
local changeBuff = Buff.Create(caster, BuffName.PropertyChange, 0, propertyList[pro1], f1, ct)
|
||
changeBuff.cover = true
|
||
changeBuff.maxLayer = i1
|
||
|
||
target:AddBuff(changeBuff)
|
||
end)
|
||
end,
|
||
--清除[a]状态
|
||
--a[控制状态]
|
||
[37] = function(caster, target, args, interval)
|
||
local ct = args[1]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
BattleLogic.BuffMgr:ClearBuff(target, function (buff)
|
||
return buff.type == BuffName.Control and (ct == 0 or buff.ctrlType == ct)
|
||
end)
|
||
end)
|
||
end,
|
||
--造成[a]的伤害(真实伤害)
|
||
--a[int]
|
||
[38] = function(caster, target, args, interval)
|
||
local d = args[1]
|
||
casterBulletEffect(caster, target, interval)
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
if not target.isDead then
|
||
BattleUtil.ApplyDamage(caster, target, d)
|
||
end
|
||
end)
|
||
end,
|
||
--每秒造成[d]的伤害,持续[f]秒(真实伤害)
|
||
--d[float],f[int]
|
||
[39] = function(caster, target, args, interval)
|
||
local d1 = args[1]
|
||
local d2 = args[2]
|
||
casterBulletEffect(caster, target, interval)
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
target:AddBuff(Buff.Create(caster, BuffName.DOT, d2, 1, 0, d1, 1))
|
||
end)
|
||
end,
|
||
--添加[a]的伤害吸收护盾,持续[b]秒,盾消失的时候反射吸收伤害的[c]%
|
||
--a[int],b[int],c[float]
|
||
[40] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local f2 = args[2]
|
||
local f3 = args[3]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
target:AddBuff(Buff.Create(caster, BuffName.Shield, f2, f1, f3))
|
||
end)
|
||
end,
|
||
--造成[a]%的[b]伤害,同时有[c]%的概率对该敌人造成[d]%的伤害,若该技能造成击杀,则有[e]%的概率清除自身CD
|
||
--a[folat],b[伤害类型],c[float],d[float],e[float]
|
||
[41] = function(caster, target, args, interval)
|
||
local f1 = args[1]
|
||
local dt = args[2]
|
||
local f2 = args[3] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||
local f3 = args[4]
|
||
local f4 = args[5] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||
casterBulletEffect(caster, target, interval)
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
BattleUtil.RandomAction(f2, function ()
|
||
f1 = f1 + f3
|
||
end)
|
||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||
if target.isDead then
|
||
BattleUtil.RandomAction(f4, function ()
|
||
caster.skill.sp = caster.skill.spPass
|
||
end)
|
||
end
|
||
end)
|
||
end,
|
||
--进入虚弱状态,有[a]%的概率受到额外[b]%的伤害,状态持续[c]秒
|
||
--a[folat],b[float],c[int]
|
||
[42] = function(caster, target, args, interval)
|
||
local f1 = args[1] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||
local f2 = args[2]
|
||
local f3 = args[3]
|
||
BattleLogic.WaitForTrigger(interval, function ()
|
||
local trigger = function(damagingFunc)
|
||
BattleUtil.RandomAction(f1, function ()
|
||
damagingFunc(f2)
|
||
end)
|
||
end
|
||
target.Event:AddEvent(BattleEventName.RoleBeDamagedBefore, trigger)
|
||
target:AddBuff(Buff.Create(caster, target, BuffName.Brand, f3, "weak", function ()
|
||
target.Event:RemoveEvent(BattleEventName.RoleBeDamagedBefore, trigger)
|
||
end))
|
||
end)
|
||
end,
|
||
}
|
||
|
||
return effectList |