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

283 lines
10 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 RoleDataName = RoleDataName
--local BattleLogic = BattleLogic
--local BattleUtil = BattleUtil
--local BattleEventName = BattleEventName
--local BuffName = BuffName
local function queryAllies(role) return function (r) return r.camp == role.camp end end
local function queryEnemy(role) return function (r) return r.camp ~= role.camp end end
--被动技能表
local passivityList = {
--受到暴击伤害时a%的概率发动一次反击对敌人造成【b*c+d】的【e】伤害
[201011] = function(role, args)
local f1 = args[1]/100
local pro1 = args[2]
local f2 = args[3]
local pro2 = args[4]
local dt = args[5]
local OnCrit = function(atkRole)
BattleUtil.RandomAction(f1, function ()
local value = role:GetRoleData(BattleUtil.GetPropertyName(pro1)) * f2 + role:GetRoleData(BattleUtil.GetPropertyName(pro2))
BattleUtil.CalDamage(role, atkRole, value, 1, dt)
end)
end
role.Event:AddEvent(BattleEventName.RoleBeCrit, OnCrit)
end,
--生命低于a%的时候提升自身减伤率b%持续c秒。每场战斗只能触发一次。
[201021] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local f3 = args[3]
local buffId1 = BattleUtil.CreateBuffId(role, 1)
local triggerCount = 0
local OnDamaged = function(atkRole)
if BattleUtil.GetHPPencent(role) < f1 then
if triggerCount < 1 then
local buff = Buff.Create(role, BuffName.PropertyChange, buffId1, f3, RoleDataName.DamageReduceFactor, f2, 1)
role:AddBuff(buff)
triggerCount = triggerCount + 1
end
end
end
role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnDamaged)
end,
--开场降低敌方全体a%的【c】持续bs
[202011] = function(role, args)
local f1 = args[1]/100
local f2 = args[2]
local pro1 = args[3]
local buffId1 = BattleUtil.CreateBuffId(role, 1)
local arr = BattleLogic.Query(queryEnemy(role))
local v
for i=1, #arr do
v = arr[i]
local buff = Buff.Create(role, BuffName.PropertyChange, buffId1, f2, BattleUtil.GetPropertyName(pro1), f1, 2)
v:AddBuff(buff)
end
end,
--开场增加增加全队暴击率a%持续b秒。
[202021] = function(role, args)
local f1 = args[1]/100
local f2 = args[2]
local buffId1 = BattleUtil.CreateBuffId(role, 1)
local arr = BattleLogic.Query(queryAllies(role))
local v
for i=1, #arr do
v = arr[i]
local buff = Buff.Create(role, BuffName.PropertyChange, buffId1, f2, RoleDataName.Crit, f1, 2)
v:AddBuff(buff)
end
end,
--场上每有1个流血目标GCD降低a秒。最高降低b秒。
[203011] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local buffId1 = BattleUtil.CreateBuffId(role, 1)
local originGcd = role:GetRoleData(RoleDataName.GCD)
local aurabuff = Buff.Create(role, BuffName.Aura, buffId1, 0, function (role)
local arr = BattleLogic.Query(queryEnemy(role))
local count = 0
local v
for i=1, #arr do
v = arr[i]
if v.BuffMgr:HasBuff(BuffName.Bleed) then
count = count + 1
end
end
role.data:SetValue(RoleDataName.GCD, max(originGcd - count * f1, f2))
end)
aurabuff.interval = 0
role:AddBuff(aurabuff)
end,
--每次受到伤害额外提升伤害a%最多b%)。
[203021] = function(role, args)
local f1 = args[1]/100
local f2 = args[2]/100
local buffId1 = BattleUtil.CreateBuffId(role, 1)
local totalFactor = 0
local OnDamaged = function(atkRole)
if totalFactor <= f2 then
local buff = Buff.Create(role, BuffName.PropertyChange, buffId1, 0, RoleDataName.DamageBocusFactor, f2, 1)
role:AddBuff(buff)
totalFactor = totalFactor + f1
end
end
role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnDamaged)
end,
--开场额外增加暴击率a%)。
[204011] = function(role, args)
local f1 = args[1]/100
local buffId1 = BattleUtil.CreateBuffId(role, 1)
local buff = Buff.Create(role, BuffName.PropertyChange, buffId1, 0, RoleDataName.Crit, f1, 1)
role:AddBuff(buff)
end,
--受到攻击时攻击者有a%的概率被附加1个印记。
[204021] = function(role, args)
local f1 = args[1]/100
local buffId1 = BattleUtil.CreateBuffId(role, 1)
local OnDamaged = function(atkRole)
BattleUtil.RandomAction(f1, function ()
local buff = Buff.Create(role, BuffName.Brand, buffId1, 0, "咒术师印记")
atkRole:AddBuff(buff)
end)
end
role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnDamaged)
end,
--生命低于a%治疗量增加b%持续c秒。每场战斗只能触发一次。
[205011] = function(role, args)
local f1 = args[1]
local f2 = args[2]/100
local f3 = args[3]
local buffId1 = BattleUtil.CreateBuffId(role, 1)
local triggerCount = 0
local OnDamaged = function(atkRole)
if BattleUtil.GetHPPencent(role) < f1 then
if triggerCount < 1 then
local buff = Buff.Create(role, BuffName.PropertyChange, buffId1, f3, RoleDataName.TreatFacter, f2, 1)
role:AddBuff(buff)
triggerCount = triggerCount + 1
end
end
end
role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnDamaged)
end,
--生命低于a%提升友军b%的【e】并且d%概率眩晕对方全体c每场战斗只能触发一次。
[205021] = function(role, args)
local f1 = args[1]
local f2 = args[2]/100
local f3 = args[3]
local f4 = args[4]/100
local pro1 = args[5]
local f5 = args[6]
local buffId1 = BattleUtil.CreateBuffId(role, 1)
local buffId2 = BattleUtil.CreateBuffId(role, 2)
local triggerCount = 0
local OnDamaged = function(atkRole)
if BattleUtil.GetHPPencent(role) < f1 then
if triggerCount < 1 then
local arr = BattleLogic.Query(queryAllies(role))
local v
for i=1, #arr do
v = arr[i]
local buff = Buff.Create(role, BuffName.PropertyChange, buffId1, f5, BattleUtil.GetPropertyName(pro1), f2, 1)
v:AddBuff(buff)
end
BattleUtil.RandomAction(f4, function ()
local arr = BattleLogic.Query(queryEnemy(role))
local v
for i=1, #arr do
v = arr[i]
local stun = Buff.Create(role, BuffName.Stun, buffId2, f3)
v:AddBuff(stun)
end
end)
triggerCount = triggerCount + 1
end
end
end
role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnDamaged)
end,
--每a秒恢复b魂能
[206021] = function(role, args)
local f1 = args[1]
local i1 = args[2]
local buffId1 = BattleUtil.CreateBuffId(role, 1)
local aurabuff = Buff.Create(role, BuffName.Aura, buffId1, 0, function (role)
BattleLogic.AddMP(role.camp, i1)
end)
aurabuff.interval = f1
role:AddBuff(aurabuff)
end,
--自身生命高于a%暴击率提高b%
[207011] = function(role, args)
local f1 = args[1]
local f2 = args[2]/100
local buffId1 = BattleUtil.CreateBuffId(role, 1)
local buffId2 = BattleUtil.CreateBuffId(role, 2)
local buff = Buff.Create(role, BuffName.PropertyChange, buffId2, 0, RoleDataName.Crit, f2, 1)
local active = BattleUtil.GetHPPencent(role) > f1
if active then
role:AddBuff(buff)
end
local aurabuff = Buff.Create(role, BuffName.Aura, buffId1, 0, function (role)
local curActive = BattleUtil.GetHPPencent(role) > f1
if active ~= curActive then
active = curActive
if active then
buff.disperse = false
role:AddBuff(buff)
else
buff.disperse = true
end
end
end)
aurabuff.interval = 0
role:AddBuff(aurabuff)
end,
--召唤物存在期间场上伙伴阵亡超过2名时冰雪皇后会牺牲并复活所有已阵亡的队友保留其a%的生命全场只可触发1次
[208011] = function(role, args)
local f1 = args[1]/100
local deadCount = 0
local triggerCount = 0
local OnDead = function(role)
if role.camp == role.camp and role.roleType ~= 3 then
deadCount = deadCount + 1
if deadCount > 2 and role.summon and triggerCount < 1 then
BattleLogic.RemoveSummon(role.summon)
local arr = BattleLogic.Query(function (r) return r.camp == role.camp and r.roleType ~= 3 end, true)
local v
for i=1, #arr do
v = arr[i]
local hp = v:GetRoleData(RoleDataName.MaxHp)
v.data:AddValue(RoleDataName.Hp, floor(hp*f1))
v.Event:DispatchEvent(BattleEventName.RoleRevive)
end
triggerCount = triggerCount + 1
end
end
end
BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead, OnDead)
end,
}
return passivityList