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

921 lines
32 KiB
Lua
Raw Normal View History

2019-03-12 14:05:45 +08:00
local floor = math.floor
local max = math.max
--local RoleDataName = RoleDataName
--local BattleLogic = BattleLogic
--local BattleUtil = BattleUtil
--local BattleEventName = BattleEventName
--local BuffName = BuffName
2019-05-07 20:01:07 +08:00
--属性编号
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 chooseTarget(role, chooseId)
local chooseType = floor(chooseId / 10000) % 10
local chooseWeight = floor(chooseId / 100) % 10
local sort = floor(chooseId / 10) % 10
local num = chooseId % 10
local arr
if chooseType == 1 then
arr = BattleLogic.Query(function (r) return r.camp == role.camp end)
elseif chooseType == 2 then
if role.lockTarget and num == 1 then --嘲讽时对单个敌军生效
return {role.lockTarget}
end
arr = BattleLogic.Query(function (r) return r.camp ~= role.camp end)
elseif chooseType == 3 then
if role.ctrl_blind then --致盲时自身变随机友军
arr = BattleLogic.Query(function (r) return r.camp == role.camp end)
BattleUtil.RandomList(arr)
return {arr[1]}
end
return {role}
elseif chooseType == 4 then
if role.lockTarget then --嘲讽时对仇恨目标生效
return {role.lockTarget}
end
if role.ctrl_blind then --致盲时仇恨目标变随机
arr = BattleLogic.Query(function (r) return r.camp ~= role.camp end)
BattleUtil.RandomList(arr)
return {arr[1]}
end
return {BattleLogic.GetAggro(role.camp)}
else
arr = BattleLogic.Query()
end
if chooseWeight == 0 or role.ctrl_blind then --致盲时排序无效
BattleUtil.RandomList(arr)
elseif chooseWeight == 1 then
BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.Hp)
local r2 = b:GetRoleData(RoleDataName.Hp)
if sort == 1 then return r1 > r2 else return r1 < r2 end
end)
elseif chooseWeight == 2 then
BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.Hp) / a:GetRoleData(RoleDataName.MaxHp)
local r2 = b:GetRoleData(RoleDataName.Hp) / b:GetRoleData(RoleDataName.MaxHp)
if sort == 1 then return r1 > r2 else return r1 < r2 end
end)
elseif chooseWeight == 3 then
BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.Attack)
local r2 = b:GetRoleData(RoleDataName.Attack)
if sort == 1 then return r1 > r2 else return r1 < r2 end
end)
elseif chooseWeight == 4 then
BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.PhysicalDefence)
local r2 = b:GetRoleData(RoleDataName.PhysicalDefence)
if sort == 1 then return r1 > r2 else return r1 < r2 end
end)
elseif chooseWeight == 5 then
BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.PhysicalDefence)
local r2 = b:GetRoleData(RoleDataName.PhysicalDefence)
if sort == 1 then return r1 > r2 else return r1 < r2 end
end)
elseif chooseWeight == 6 then
BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.MagicDefence)
local r2 = b:GetRoleData(RoleDataName.MagicDefence)
if sort == 1 then return r1 > r2 else return r1 < r2 end
end)
elseif chooseWeight == 7 then
BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.MagicDefence)
local r2 = b:GetRoleData(RoleDataName.MagicDefence)
if sort == 1 then return r1 > r2 else return r1 < r2 end
end)
end
return arr
end
2019-03-12 14:05:45 +08:00
--被动技能表
local passivityList = {
2019-05-07 20:01:07 +08:00
--发动技能时,[a]的概率将[b]*[c]算作[d]计算
--a[float],b[属性],c[float],d[属性]
[1] = function(role, args)
local f1 = args[1]
2019-03-12 14:05:45 +08:00
local pro1 = args[2]
local f2 = args[3]
local pro2 = args[4]
2019-05-07 20:01:07 +08:00
local OnSkillCast = function(skill)
2019-03-12 14:05:45 +08:00
BattleUtil.RandomAction(f1, function ()
2019-05-07 20:01:07 +08:00
local duration = 0
for i=1, skill.effectList.size do
duration = max(duration, skill.effectList.buffer[i].duration)
end
2019-05-13 09:51:36 +08:00
role:AddPropertyTransfer(propertyList[pro1], f2, propertyList[pro2], duration + BattleLogic.GameDeltaTime * 2)
2019-03-12 14:05:45 +08:00
end)
end
2019-05-07 20:01:07 +08:00
role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
2019-03-12 14:05:45 +08:00
end,
2019-05-07 20:01:07 +08:00
--发动技能后,[a]的概率对敌方随机1名施加攻击*[c]的[d]伤害。
--a[float],c[float],d[伤害类型]
[2] = function(role, args)
2019-03-12 14:05:45 +08:00
local f1 = args[1]
local f2 = args[2]
2019-05-07 20:01:07 +08:00
local dt = args[3]
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
local OnSkillCastEnd = function(skill)
BattleUtil.RandomAction(f1, function ()
local arr = chooseTarget(role, 20001)
if arr[1] then
BattleUtil.CalDamage(role, arr[1], dt, f2)
2019-03-12 14:05:45 +08:00
end
2019-05-07 20:01:07 +08:00
end)
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
2019-05-09 17:50:38 +08:00
--发动技能后,[c]使仇恨目标受到治疗效果降低[a],持续[b]
--a[float],b[int],c[float]
2019-05-07 20:01:07 +08:00
[3] = function(role, args)
local f1 = args[1]
local f2 = args[2]
2019-05-09 17:50:38 +08:00
local f3 = args[3]
2019-05-07 20:01:07 +08:00
local OnSkillCastEnd = function(skill)
2019-05-09 17:50:38 +08:00
BattleUtil.RandomAction(f3, function ()
local arr = chooseTarget(role, 40000)
if arr[1] then
arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, RoleDataName.CureFacter, f1, 3))
end
end)
2019-03-12 14:05:45 +08:00
end
2019-05-07 20:01:07 +08:00
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
--发动技能后,[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, propertyList[pro], f1, ct))
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
2019-03-12 14:05:45 +08:00
end,
2019-05-07 20:01:07 +08:00
--发动技能后,[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]
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
local OnSkillCastEnd = function(skill)
BattleUtil.RandomAction(f1, function ()
2019-05-13 09:51:36 +08:00
local arr = chooseTarget(role, 10321)
2019-05-07 20:01:07 +08:00
if arr[1] then
arr[1]:AddBuff(Buff.Create(role, BuffName.HOT, f3, 1, floor(role:GetRoleData(propertyList[pro]) * f2)))
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]
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
local OnSkillCastEnd = function(skill)
BattleUtil.RandomAction(f1, function ()
local arr = chooseTarget(role, 10001)
if arr[1] then
arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, propertyList[pro1], floor(role:GetRoleData(propertyList[pro2]) * f2), 1))
end
end)
2019-03-12 14:05:45 +08:00
end
2019-05-07 20:01:07 +08:00
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
2019-03-12 14:05:45 +08:00
end,
2019-05-07 20:01:07 +08:00
--使用回复技能时,[a]的概率提高恢复效果[b]。
--a[float],b[float]
[7] = function(role, args)
local f1 = args[1]
2019-03-12 14:05:45 +08:00
local f2 = args[2]
2019-05-07 20:01:07 +08:00
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]
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
local OnRoleBeDamaged = function(treatingFunc)
BattleUtil.RandomAction(f1, function ()
BattleUtil.CalTreat(role, role, floor(role:GetRoleData(propertyList[pro]) * f2))
end)
2019-03-12 14:05:45 +08:00
end
2019-05-07 20:01:07 +08:00
role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnRoleBeDamaged)
2019-03-12 14:05:45 +08:00
end,
2019-05-07 20:01:07 +08:00
--受击后,[a]对攻击者造成的攻击*[c]的持续伤害,持续[d]秒。
--a[float],c[float],d[int]
[9] = function(role, args)
2019-03-12 14:05:45 +08:00
local f1 = args[1]
local f2 = args[2]
2019-05-07 20:01:07 +08:00
local f3 = args[3]
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
local triggerUid = {}
local OnRoleBeDamaged = 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.RoleBeDamaged, OnRoleBeDamaged)
end,
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
--受击时[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(propertyList[pro1], f2, propertyList[pro2], BattleLogic.GameDeltaTime)
end)
2019-03-12 14:05:45 +08:00
end
2019-05-07 20:01:07 +08:00
end
role.Event:AddEvent(BattleEventName.RoleBeDamagedBefore, OnRoleBeDamagedBefore)
2019-03-12 14:05:45 +08:00
end,
2019-05-07 20:01:07 +08:00
--受击时,有[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)
BattleUtil.RandomAction(f1, function ()
damagingFunc(floor(role:GetRoleData(propertyList[pro]) * f2))
end)
end
2019-05-13 09:51:36 +08:00
role.Event:AddEvent(BattleEventName.PassiveBeDamaging, OnPassiveDamaging)
2019-05-07 20:01:07 +08:00
end,
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
--受击后,有[a]的概率对敌方全体造成攻击*[c]的[d]伤害
--a[float],c[float],d[伤害类型]
[12] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local dt = args[3]
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
local lastTrigger = 0
local OnRoleBeDamaged = function(atkRole)
if atkRole.isTeam then
return
end
lastTrigger = lastTrigger + 1
if lastTrigger > 1 then --加入限定避免循环触发
return
2019-03-12 14:05:45 +08:00
end
2019-05-07 20:01:07 +08:00
BattleUtil.RandomAction(f1, function ()
local arr = chooseTarget(role, 20000)
for i=1, #arr do
BattleUtil.CalDamage(role, arr[i], dt, f2)
end
end)
lastTrigger = 0
2019-03-12 14:05:45 +08:00
end
2019-05-07 20:01:07 +08:00
role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnRoleBeDamaged)
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 OnRoleBeDamaged = function(atkRole)
if atkRole.isTeam then
return
end
lastTrigger = lastTrigger + 1
if lastTrigger > 1 then --加入限定避免循环触发
return
end
BattleUtil.RandomAction(f1, function ()
local arr = chooseTarget(role, 20001)
if arr[1] then
2019-05-13 09:51:36 +08:00
BattleUtil.ApplyDamage(role, arr[1], floor(role:GetRoleData(propertyList[pro]) * f2))
2019-05-07 20:01:07 +08:00
end
end)
lastTrigger = 0
end
role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnRoleBeDamaged)
2019-03-12 14:05:45 +08:00
end,
2019-05-07 20:01:07 +08:00
--受击后[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 OnRoleBeDamaged = function(atkRole, damage, bCrit, finalDmg, damageType)
if damageType == dt then
BattleUtil.RandomAction(f1, function ()
role:AddPropertyTransfer(propertyList[pro1], f2, propertyList[pro2], f3)
end)
end
end
role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnRoleBeDamaged)
end,
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
--免疫[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)
2019-03-12 14:05:45 +08:00
end,
2019-05-07 20:01:07 +08:00
--发动技能后,[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]
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
local OnSkillCastEnd = function(skill)
BattleUtil.RandomAction(f1, function ()
role:AddPropertyTransfer(propertyList[pro1], f2, propertyList[pro2], f3)
end)
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
2019-05-09 17:50:38 +08:00
--发动技能后,[d]改变仇恨目标[a]属性[b],持续[c]秒
2019-05-07 20:01:07 +08:00
--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)
2019-05-09 17:50:38 +08:00
local arr = chooseTarget(role, 40000)
if arr[1] then
arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, propertyList[pro1], f1, ct))
end
2019-03-12 14:05:45 +08:00
end
2019-05-07 20:01:07 +08:00
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
--发动技能后,[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 = chooseTarget(role, 10000)
for i=1, #arr do
arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, propertyList[pro1], f1, ct))
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
2019-03-12 14:05:45 +08:00
end,
2019-05-07 20:01:07 +08:00
--受到治疗效果提高[a]。
--a[float]
[19] = function(role, args)
2019-03-12 14:05:45 +08:00
local f1 = args[1]
2019-05-09 17:50:38 +08:00
role.data:AddValue(RoleDataName.CureFacter, f1)
2019-05-07 20:01:07 +08:00
end,
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
--[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]
2019-05-13 09:51:36 +08:00
local f3 = args[3]
2019-03-12 14:05:45 +08:00
local triggerCount = 0
local OnDamaged = function(atkRole)
if BattleUtil.GetHPPencent(role) < f1 then
if triggerCount < 1 then
2019-05-07 20:01:07 +08:00
BattleUtil.RandomAction(f2, function ()
role:AddBuff(Buff.Create(role, BuffName.Immune, f3, 1))
triggerCount = triggerCount + 1
end)
2019-03-12 14:05:45 +08:00
end
end
end
role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnDamaged)
end,
2019-05-07 20:01:07 +08:00
--死亡时,立即回复己方全体[a]*[b]的血量。
--a[属性],b[float]
[23] = function(role, args)
local pro = args[1]
local f1 = args[2]
local OnDead = function(atkRole)
local arr = chooseTarget(role, 10000)
for i=1, #arr do
BattleUtil.CalTreat(role, arr[i], floor(role:GetRoleData(propertyList[pro]) * f1))
end
end
role.Event:AddEvent(BattleEventName.RoleDead, OnDead)
end,
--控制效果命中后,[a]的概率施加[c]的[d]伤害
--a[float],c[float],d[伤害类型]
[24] = function(role, args)
2019-03-12 14:05:45 +08:00
local f1 = args[1]
2019-05-07 20:01:07 +08:00
local f2 = args[2]
local dt = args[3]
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
local OnBuffCaster = function(buff)
if buff.type == BuffName.Control then
BattleUtil.RandomAction(f1, function ()
BattleUtil.CalDamage(role, buff.target, dt, f2)
end)
end
end
role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
end,
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
--控制效果命中后,[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 = chooseTarget(buff.target, 10000)
2019-03-12 14:05:45 +08:00
for i=1, #arr do
2019-05-07 20:01:07 +08:00
BattleUtil.CalDamage(role, arr[i], dt, f2)
2019-03-12 14:05:45 +08:00
end
2019-05-07 20:01:07 +08:00
end)
end
end
role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster)
end,
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
--造成的伤害暴击后,[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
2019-03-12 14:05:45 +08:00
end
2019-05-07 20:01:07 +08:00
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)
2019-03-12 14:05:45 +08:00
end
2019-05-07 20:01:07 +08:00
role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
2019-03-12 14:05:45 +08:00
end,
2019-05-07 20:01:07 +08:00
--造成的伤害暴击后,[a]的概率回复自身[b]*[c]的血量
--a[float],b[属性],c[float]
[27] = function(role, args)
2019-03-12 14:05:45 +08:00
local f1 = args[1]
2019-05-07 20:01:07 +08:00
local pro = args[2]
local f2 = args[3]
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
local OnRoleCrit = function(defRole)
BattleUtil.RandomAction(f1, function ()
BattleUtil.CalTreat(role, role, floor(role:GetRoleData(propertyList[pro]) * f2))
end)
end
role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
2019-03-12 14:05:45 +08:00
end,
2019-05-07 20:01:07 +08:00
--对血量高于[a]的敌人伤害提高[b]。
--a[float],b[float]
[28] = function(role, args)
2019-03-12 14:05:45 +08:00
local f1 = args[1]
2019-05-07 20:01:07 +08:00
local f2 = args[2]
2019-03-12 14:05:45 +08:00
2019-05-13 09:51:36 +08:00
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
2019-05-07 20:01:07 +08:00
if BattleUtil.GetHPPencent(defRole) > f1 then
2019-05-13 09:51:36 +08:00
damagingFunc(-floor(f2 * damage))
2019-05-07 20:01:07 +08:00
end
end
2019-05-13 09:51:36 +08:00
role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
2019-05-07 20:01:07 +08:00
end,
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
--对血量低于[a]的敌人伤害提高[b]。
--a[float],b[float]
[29] = function(role, args)
local f1 = args[1]
local f2 = args[2]
2019-05-13 09:51:36 +08:00
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
2019-05-07 20:01:07 +08:00
if BattleUtil.GetHPPencent(defRole) < f1 then
2019-05-13 09:51:36 +08:00
damagingFunc(-floor(f2 * damage))
2019-05-07 20:01:07 +08:00
end
2019-03-12 14:05:45 +08:00
end
2019-05-13 09:51:36 +08:00
role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
2019-05-07 20:01:07 +08:00
end,
2019-05-09 17:50:38 +08:00
--发动技能后,[d]改变敌方全体[a]属性[b],持续[c]秒
2019-05-07 20:01:07 +08:00
--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)
2019-05-09 17:50:38 +08:00
local arr = chooseTarget(role, 20000)
2019-05-07 20:01:07 +08:00
for i=1, #arr do
arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, propertyList[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]
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
local OnSkillCastEnd = function(skill)
BattleUtil.RandomAction(f1, function ()
local arr = chooseTarget(role, 20001)
if arr[1] then
arr[1]:AddBuff(Buff.Create(role, BuffName.Control, f2, 1))
2019-03-12 14:05:45 +08:00
end
2019-05-07 20:01:07 +08:00
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, propertyList[pro], f1, ct))
2019-03-12 14:05:45 +08:00
end
2019-05-07 20:01:07 +08:00
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, propertyList[pro], f1, ct))
end,
--造成伤害时,额外增加[a]点伤害。
--a[int]
[34] = function(role, args)
local f1 = args[1]
local OnPassiveDamaging = function(damagingFunc)
damagingFunc(-f1)
end
2019-05-13 09:51:36 +08:00
role.Event:AddEvent(BattleEventName.PassiveBeDamaging, OnPassiveDamaging)
2019-05-07 20:01:07 +08:00
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))
2019-03-12 14:05:45 +08:00
end)
end,
2019-05-07 20:01:07 +08:00
--进入战斗[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]
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
BattleLogic.WaitForTrigger(f1, function ()
role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, propertyList[pro], f2, ct))
end)
end,
2019-03-12 14:05:45 +08:00
2019-05-07 20:01:07 +08:00
--进入战斗[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 (role)
local changeBuff1 = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[pro1], f2, ct1)
changeBuff1.cover = true
changeBuff1.maxLayer = i1
local changeBuff2 = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[pro2], f3, ct2)
changeBuff2.cover = true
changeBuff2.maxLayer = i1
role:AddBuff(changeBuff1)
role: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 (role)
BattleUtil.CalTreat(role, role, 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 OnDamaged = function(atkRole)
if atkRole.professionId == i1 then
BattleUtil.CalTreat(role, role, f1)
2019-03-12 14:05:45 +08:00
end
end
2019-05-07 20:01:07 +08:00
role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnDamaged)
end,
--造成伤害时,将伤害的[a]%转化为自身生命
--a[float]
[41] = function(role, args)
local f1 = args[1]
2019-05-13 09:51:36 +08:00
local OnDamage = function(defRole, damage, bCrit, finalDmg)
2019-05-07 20:01:07 +08:00
BattleUtil.CalTreat(role, role, floor(f1 * finalDmg))
end
2019-05-13 09:51:36 +08:00
role.Event:AddEvent(BattleEventName.RoleDamage, OnDamage)
2019-05-07 20:01:07 +08:00
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)
2019-03-12 14:05:45 +08:00
end,
2019-05-09 17:50:38 +08:00
--发动技能后,[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 = chooseTarget(role, 40000)
if arr[1] then
local buff = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[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, propertyList[pro], f2, ct))
end)
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--免疫[a]控制状态。
--a[控制类型]
[45] = function(role, args)
local ct = args[1]
role.buffFilter:Add(function(buff)
return buff.type == BuffName.Control and (ct == 0 or buff.ctrlType == ct)
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(propertyList[pro], f1)
elseif ct == 2 then --乘加算(百分比属性加算)
role.data:AddPencentValue(propertyList[pro], f1)
elseif ct == 3 then --减算
role.data:SubValue(propertyList[pro], f1)
elseif ct == 4 then --乘减算(百分比属性减算)
role.data:SubPencentValue(propertyList[pro], f1)
end
end,
2019-03-12 14:05:45 +08:00
}
return passivityList