luafight
parent
07cfe90a46
commit
106af8c853
|
@ -412,21 +412,18 @@ local effectList = {
|
||||||
local f1 = args[2]
|
local f1 = args[2]
|
||||||
local f2 = args[3]
|
local f2 = args[3]
|
||||||
BattleLogic.WaitForTrigger(interval, function ()
|
BattleLogic.WaitForTrigger(interval, function ()
|
||||||
local func = function(damage)
|
local trigger = function(defRole, damageFunc, damage)
|
||||||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
|
if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function (buff)
|
||||||
|
return dot == 0 or buff.damageType == dot
|
||||||
|
end) then
|
||||||
damage = damage + floor(damage * f1)
|
damage = damage + floor(damage * f1)
|
||||||
end
|
end
|
||||||
return damage
|
damageFunc(damage)
|
||||||
end
|
end
|
||||||
target.exCalDmgList:Add(func)
|
target.Event:AddEvent(BattleEventName.RoleDamageAfter, trigger)
|
||||||
if f2 > 0 then
|
if f2 > 0 then
|
||||||
BattleLogic.WaitForTrigger(f2, function ()
|
BattleLogic.WaitForTrigger(f2, function ()
|
||||||
for i=1, target.exCalDmgList.size do
|
target.Event:RemoveEvent(BattleEventName.RoleDamageAfter, trigger)
|
||||||
if target.exCalDmgList.buffer[i] == func then
|
|
||||||
target.exCalDmgList:Remove(i)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
@ -591,21 +588,16 @@ local effectList = {
|
||||||
local f1 = args[2]
|
local f1 = args[2]
|
||||||
local f2 = args[3]
|
local f2 = args[3]
|
||||||
BattleLogic.WaitForTrigger(interval, function ()
|
BattleLogic.WaitForTrigger(interval, function ()
|
||||||
local func = function(damage)
|
local trigger = function(defRole, damageFunc, damage)
|
||||||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Control, function (buff) return ct == 0 or buff.ctrlType == ct end) then
|
if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.Control, function (buff) return ct == 0 or buff.ctrlType == ct end) then
|
||||||
damage = damage + floor(damage * f1)
|
damage = damage + floor(damage * f1)
|
||||||
end
|
end
|
||||||
return damage
|
damageFunc(damage)
|
||||||
end
|
end
|
||||||
target.exCalDmgList:Add(func)
|
target.Event:AddEvent(BattleEventName.RoleDamageAfter, trigger)
|
||||||
if f2 > 0 then
|
if f2 > 0 then
|
||||||
BattleLogic.WaitForTrigger(f2, function ()
|
BattleLogic.WaitForTrigger(f2, function ()
|
||||||
for i=1, target.exCalDmgList.size do
|
target.Event:RemoveEvent(BattleEventName.RoleDamageAfter, trigger)
|
||||||
if target.exCalDmgList.buffer[i] == func then
|
|
||||||
target.exCalDmgList:Remove(i)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
@ -1324,9 +1316,10 @@ local effectList = {
|
||||||
local remainCount = floor(remainFrame / buff.frameInterval)+1
|
local remainCount = floor(remainFrame / buff.frameInterval)+1
|
||||||
buff.disperse = true
|
buff.disperse = true
|
||||||
if buff.caster and not buff.caster.isTeam then
|
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)
|
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
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
local floor = math.floor
|
local floor = math.floor
|
||||||
local max = math.max
|
local max = math.max
|
||||||
|
local min = math.min
|
||||||
--local RoleDataName = RoleDataName
|
--local RoleDataName = RoleDataName
|
||||||
--local BattleLogic = BattleLogic
|
--local BattleLogic = BattleLogic
|
||||||
--local BattleUtil = BattleUtil
|
--local BattleUtil = BattleUtil
|
||||||
|
@ -1021,27 +1022,36 @@ local passivityList = {
|
||||||
end
|
end
|
||||||
local ar1 = BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp), f1)
|
local ar1 = BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp), f1)
|
||||||
local ar2 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), 2.5)
|
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
|
lastTrigger = 0
|
||||||
end
|
end
|
||||||
role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
|
role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
|
||||||
end,
|
end,
|
||||||
--发动技能时,若技能目标与自身发动的上一个技能目标相同,则增加[a]%的伤害。
|
--发动技能时,若技能目标与自身发动的上一个技能目标相同,则增加[a]%的伤害,最多叠加[b]层。
|
||||||
--a[float]
|
--a[float],b[int]
|
||||||
[57] = function(role, args)
|
[57] = function(role, args)
|
||||||
local f1 = args[1]
|
local f1 = args[1]
|
||||||
|
local i2 = args[2]
|
||||||
|
|
||||||
local damageDic = {}
|
local damageDic = {}
|
||||||
local lastDamageDic = {}
|
local lastDamageDic = {}
|
||||||
local OnSkillCastEnd = function(skill)
|
local OnSkillCastEnd = function(skill)
|
||||||
|
for k in pairs(damageDic) do
|
||||||
|
if lastDamageDic[k] then
|
||||||
|
damageDic[k] = damageDic[k] + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
lastDamageDic = damageDic
|
lastDamageDic = damageDic
|
||||||
damageDic = {}
|
damageDic = {}
|
||||||
end
|
end
|
||||||
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
|
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
|
||||||
if lastDamageDic[defRole] then
|
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
|
end
|
||||||
damageDic[defRole] = 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
|
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
|
||||||
|
@ -1139,7 +1149,7 @@ local passivityList = {
|
||||||
if not bCrit then
|
if not bCrit then
|
||||||
local ar1 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), f3)
|
local ar1 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), f3)
|
||||||
local ar2 = BattleUtil.FP_Mul(damage, f1)
|
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
|
||||||
end
|
end
|
||||||
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
|
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
|
||||||
|
@ -1280,7 +1290,7 @@ local passivityList = {
|
||||||
if bCrit then
|
if bCrit then
|
||||||
local ar1 = BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp), f1)
|
local ar1 = BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp), f1)
|
||||||
local ar2 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), 5)
|
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
|
else
|
||||||
BattleUtil.RandomAction(f2, function ()
|
BattleUtil.RandomAction(f2, function ()
|
||||||
local val = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), f3))
|
local val = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), f3))
|
||||||
|
|
|
@ -20,6 +20,8 @@ BattleEventName = {
|
||||||
RoleDamage = indexAdd(),
|
RoleDamage = indexAdd(),
|
||||||
RoleBeDamagedBefore = indexAdd(),
|
RoleBeDamagedBefore = indexAdd(),
|
||||||
RoleDamageBefore = indexAdd(),
|
RoleDamageBefore = indexAdd(),
|
||||||
|
RoleBeDamagedAfter = indexAdd(),
|
||||||
|
RoleDamageAfter = indexAdd(),
|
||||||
RoleBeTreated = indexAdd(),
|
RoleBeTreated = indexAdd(),
|
||||||
RoleTreat = indexAdd(),
|
RoleTreat = indexAdd(),
|
||||||
RoleBeHealed = indexAdd(),
|
RoleBeHealed = indexAdd(),
|
||||||
|
|
|
@ -287,10 +287,9 @@ function BattleUtil.CalDamage(atkRole, defRole, damageType, baseFactor, ignoreDe
|
||||||
baseDamage = floor(max(baseDamage, BattleUtil.FP_Mul(0.1, attack)))
|
baseDamage = floor(max(baseDamage, BattleUtil.FP_Mul(0.1, attack)))
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1, atkRole.exCalDmgList.size do
|
local damageFunc = function(damage) baseDamage = damage end
|
||||||
local func = atkRole.exCalDmgList.buffer[i]
|
atkRole.Event:DispatchEvent(BattleEventName.RoleDamageAfter, defRole, damageFunc, baseDamage)
|
||||||
baseDamage = func(baseDamage)
|
defRole.Event:DispatchEvent(BattleEventName.RoleBeDamagedAfter, atkRole, damageFunc, baseDamage)
|
||||||
end
|
|
||||||
|
|
||||||
baseDamage = BattleUtil.CalShield(atkRole, defRole, baseDamage)
|
baseDamage = BattleUtil.CalShield(atkRole, defRole, baseDamage)
|
||||||
local finalDmg = 0 --计算实际造成的扣血
|
local finalDmg = 0 --计算实际造成的扣血
|
||||||
|
|
Loading…
Reference in New Issue