back_recharge
wangyuan 2019-12-02 10:11:58 +08:00
parent 07cfe90a46
commit 106af8c853
4 changed files with 37 additions and 33 deletions

View File

@ -412,21 +412,18 @@ local effectList = {
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
local trigger = function(defRole, damageFunc, damage)
if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function (buff)
return dot == 0 or buff.damageType == dot
end) then
damage = damage + floor(damage * f1)
end
return damage
damageFunc(damage)
end
target.exCalDmgList:Add(func)
target.Event:AddEvent(BattleEventName.RoleDamageAfter, trigger)
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
target.Event:RemoveEvent(BattleEventName.RoleDamageAfter, trigger)
end)
end
end)
@ -591,21 +588,16 @@ local effectList = {
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
local trigger = function(defRole, damageFunc, damage)
if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.Control, function (buff) return ct == 0 or buff.ctrlType == ct end) then
damage = damage + floor(damage * f1)
end
return damage
damageFunc(damage)
end
target.exCalDmgList:Add(func)
target.Event:AddEvent(BattleEventName.RoleDamageAfter, trigger)
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
target.Event:RemoveEvent(BattleEventName.RoleDamageAfter, trigger)
end)
end
end)
@ -1324,9 +1316,10 @@ local effectList = {
local remainCount = floor(remainFrame / buff.frameInterval)+1
buff.disperse = true
if buff.caster and not buff.caster.isTeam then
buff.caster.exCalDmgList:Add(function(damage) return damage * remainCount end)
local trigger = function(defRole, damageFunc, damage) damageFunc(damage * remainCount) end
buff.caster.Event:AddEvent(BattleEventName.RoleDamageAfter, trigger)
BattleUtil.CalDamage(buff.caster, buff.target, buff.damagePro, buff.damageFactor,0, true)
buff.caster.exCalDmgList:Remove(buff.caster.exCalDmgList.size)
buff.caster.Event:RemoveEvent(BattleEventName.RoleDamageAfter, trigger)
end
end
return true

View File

@ -1,5 +1,6 @@
local floor = math.floor
local max = math.max
local min = math.min
--local RoleDataName = RoleDataName
--local BattleLogic = BattleLogic
--local BattleUtil = BattleUtil
@ -1021,27 +1022,36 @@ local passivityList = {
end
local ar1 = BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp), f1)
local ar2 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), 2.5)
BattleUtil.ApplyDamage(role, defRole, floor(math.min(ar1, ar2)))
BattleUtil.ApplyDamage(role, defRole, floor(min(ar1, ar2)))
lastTrigger = 0
end
role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
end,
--发动技能时,若技能目标与自身发动的上一个技能目标相同,则增加[a]%的伤害
--a[float]
--发动技能时,若技能目标与自身发动的上一个技能目标相同,则增加[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
damagingFunc(-floor(f1 * damage))
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
damageDic[defRole] = 1
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
@ -1139,7 +1149,7 @@ local passivityList = {
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(math.min(ar1, ar2)), 1))
role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, RoleDataName.Attack, floor(min(ar1, ar2)), 1))
end
end
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
@ -1280,7 +1290,7 @@ local passivityList = {
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(role, defRole, floor(math.min(ar1, ar2)))
BattleUtil.ApplyDamage(role, defRole, floor(min(ar1, ar2)))
else
BattleUtil.RandomAction(f2, function ()
local val = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), f3))

View File

@ -20,6 +20,8 @@ BattleEventName = {
RoleDamage = indexAdd(),
RoleBeDamagedBefore = indexAdd(),
RoleDamageBefore = indexAdd(),
RoleBeDamagedAfter = indexAdd(),
RoleDamageAfter = indexAdd(),
RoleBeTreated = indexAdd(),
RoleTreat = indexAdd(),
RoleBeHealed = indexAdd(),

View File

@ -287,10 +287,9 @@ function BattleUtil.CalDamage(atkRole, defRole, damageType, baseFactor, ignoreDe
baseDamage = floor(max(baseDamage, BattleUtil.FP_Mul(0.1, attack)))
end
for i=1, atkRole.exCalDmgList.size do
local func = atkRole.exCalDmgList.buffer[i]
baseDamage = func(baseDamage)
end
local damageFunc = function(damage) baseDamage = damage end
atkRole.Event:DispatchEvent(BattleEventName.RoleDamageAfter, defRole, damageFunc, baseDamage)
defRole.Event:DispatchEvent(BattleEventName.RoleBeDamagedAfter, atkRole, damageFunc, baseDamage)
baseDamage = BattleUtil.CalShield(atkRole, defRole, baseDamage)
local finalDmg = 0 --计算实际造成的扣血