战斗逻辑
parent
d254b2793b
commit
b2404f1326
|
@ -181,7 +181,7 @@ local effectList = {
|
|||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
if target.roleData.professionId == i1 then
|
||||
f1 = f1 + f2
|
||||
f1 = f1*(1+f2)
|
||||
end
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
end)
|
||||
|
@ -304,7 +304,7 @@ local effectList = {
|
|||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local d, crit = BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
if crit then
|
||||
target.sp = target.sp + floor(f2 * BattleLogic.GameFrameRate)
|
||||
caster:AddSkillCD(f2, 3)
|
||||
end
|
||||
end)
|
||||
end,
|
||||
|
@ -343,7 +343,7 @@ local effectList = {
|
|||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
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
|
||||
f1 = f1*(1+f2)
|
||||
end
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
end)
|
||||
|
@ -373,7 +373,7 @@ local effectList = {
|
|||
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
|
||||
f1 = f1*(1+f2)
|
||||
end
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
end)
|
||||
|
@ -388,7 +388,7 @@ local effectList = {
|
|||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.HOT, function (buff) return true end) then
|
||||
f1 = f1 + f2
|
||||
f1 = f1*(1+f2)
|
||||
end
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
end)
|
||||
|
@ -457,7 +457,7 @@ local effectList = {
|
|||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
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
|
||||
f1 = f1*(1+f2)
|
||||
end
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
end)
|
||||
|
@ -479,7 +479,7 @@ local effectList = {
|
|||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, d, target)
|
||||
BattleLogic.WaitForTrigger(d, function ()
|
||||
if target.roleData.professionId == pt then
|
||||
f1 = f1 + f2
|
||||
f1 = f1*(1+f2)
|
||||
end
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
end)
|
||||
|
@ -785,7 +785,7 @@ local effectList = {
|
|||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
if target.roleData.professionId == pt then
|
||||
BattleUtil.CalDamage(caster, target, dt, f1+f3, f2)
|
||||
BattleUtil.CalDamage(caster, target, dt, f1*(1+f3), f2)
|
||||
else
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
end
|
||||
|
@ -1131,7 +1131,7 @@ local effectList = {
|
|||
end)
|
||||
|
||||
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
|
||||
damagingFunc(-floor((1 + f2 * factor) * damage))
|
||||
damagingFunc(-floor(f2*factor*damage))
|
||||
end
|
||||
caster.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
|
@ -1186,7 +1186,12 @@ local effectList = {
|
|||
end
|
||||
return b
|
||||
end) then
|
||||
BattleUtil.CalDamage(caster, target, dt,f1 + (1+layer)*f3)
|
||||
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
|
||||
damagingFunc(-floor(f3*layer*damage))
|
||||
end
|
||||
caster.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
caster.Event:RemoveEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
|
||||
else
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
end
|
||||
|
@ -1252,7 +1257,7 @@ local effectList = {
|
|||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local factor = 1 - BattleUtil.GetHPPencent(caster)
|
||||
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
|
||||
damagingFunc(-floor((1 + f2 * factor) * damage))
|
||||
damagingFunc(-floor(f2*factor*damage))
|
||||
end
|
||||
caster.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
|
@ -1312,11 +1317,13 @@ local effectList = {
|
|||
BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff)
|
||||
if buff.duration > 0 and buff.frameInterval > 0 then
|
||||
local remainFrame = buff.frameDuration - buff.framePass
|
||||
local remainCount = floor(remainFrame / buff.frameInterval)
|
||||
local remainCount = floor(remainFrame / buff.frameInterval)+1
|
||||
buff.disperse = true
|
||||
target.exCalDmgList:Add(function(damage) return damage * remainCount end)
|
||||
BattleUtil.CalDamage(buff.caster, buff.target, buff.damagePro, buff.damageFactor,0, true)
|
||||
target.exCalDmgList:Remove(target.exCalDmgList.size)
|
||||
if buff.caster and not buff.caster.isTeam then
|
||||
buff.caster.exCalDmgList:Add(function(damage) return damage * remainCount end)
|
||||
BattleUtil.CalDamage(buff.caster, buff.target, buff.damagePro, buff.damageFactor,0, true)
|
||||
buff.caster.exCalDmgList:Remove(buff.caster.exCalDmgList.size)
|
||||
end
|
||||
end
|
||||
return true
|
||||
end)
|
||||
|
@ -1365,7 +1372,7 @@ local effectList = {
|
|||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Shield, function (buff) return true end) then
|
||||
f1 = f1 + f2
|
||||
f1 = f1*(1+f2)
|
||||
end
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
end)
|
||||
|
@ -1736,7 +1743,12 @@ local effectList = {
|
|||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local dmg, crit = BattleUtil.CalDamage(caster, target, dt, f4)
|
||||
if crit then
|
||||
buffRandomAction(f3, target, Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro1], f1, ct))
|
||||
BattleUtil.RandomAction(f3, function ()
|
||||
local arr = BattleUtil.ChooseTarget(caster, 10001)
|
||||
for i=1, #arr do
|
||||
arr[i]:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro1], f1, ct))
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end,
|
||||
|
|
|
@ -965,10 +965,10 @@ local passivityList = {
|
|||
local f1 = args[1]
|
||||
local f2 = args[2]
|
||||
local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
|
||||
if atkRole.isTeam then
|
||||
return
|
||||
end
|
||||
BattleUtil.RandomAction(f1, function ()
|
||||
if atkRole.isTeam then
|
||||
return
|
||||
end
|
||||
atkRole:AddBuff(Buff.Create(role, BuffName.Control, f2, 1))
|
||||
end)
|
||||
end
|
||||
|
@ -991,7 +991,7 @@ local passivityList = {
|
|||
end)
|
||||
lastTrigger = 0
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleDamage, OnDamage)
|
||||
role.Event:AddEvent(BattleEventName.RoleHit, OnDamage)
|
||||
end,
|
||||
--造成暴击时,额外造成目标最大生命值[a]%的伤害。(目标最大生命值伤害总上限为施法者5倍攻击)
|
||||
--a[float]
|
||||
|
@ -1069,14 +1069,15 @@ local passivityList = {
|
|||
auraBuff.interval = f1
|
||||
BattleLogic.BuffMgr:AddBuff(role, auraBuff)
|
||||
end,
|
||||
--我方生命最低的其他角色受到技能攻击后,自身[a]的概率对攻击者造成攻击[b]%的伤害,并造成[c],持续[d]秒。若自身处于沉默或眩晕状态,则不会触发。播放攻击特效,特效时间[e]秒。
|
||||
--a[float],b[float],c[控制状态],d[int],e[float]
|
||||
--我方生命最低的其他角色受到技能攻击后,自身[a]的概率对攻击者造成攻击[b]%的[c]伤害,并造成[d],持续[e]秒。若自身处于沉默或眩晕状态,则不会触发。播放攻击特效,特效时间[f]秒。
|
||||
--a[float],b[float],c[伤害类型],d[控制状态],e[int],f[float]
|
||||
[60] = function(role, args)
|
||||
local f1 = args[1]
|
||||
local f2 = args[2]
|
||||
local ct = args[3]
|
||||
local f3 = args[4]
|
||||
local f4 = args[5]
|
||||
local dt = args[3]
|
||||
local ct = args[4]
|
||||
local f3 = args[5]
|
||||
local f4 = args[6]
|
||||
|
||||
local triggerUid = {}
|
||||
BattleLogic.Event:AddEvent(BattleEventName.RoleBeDamaged, function (defRole, atkRole, damage, bCrit, finalDmg, damageType, isDot)
|
||||
|
@ -1101,7 +1102,7 @@ local passivityList = {
|
|||
role.Event:DispatchEvent(BattleEventName.RoleViewBullet, f4, atkRole)
|
||||
BattleLogic.WaitForTrigger(f4, function ()
|
||||
triggerUid[atkRole.uid] = atkRole.uid
|
||||
BattleUtil.ApplyDamage(role, atkRole, floor(role:GetRoleData(RoleDataName.Attack) * f2))
|
||||
BattleUtil.CalDamage(role, atkRole, dt, f2)
|
||||
atkRole:AddBuff(Buff.Create(role, BuffName.Control, f3, ct))
|
||||
triggerUid[atkRole.uid] = nil
|
||||
end)
|
||||
|
@ -1265,5 +1266,44 @@ local passivityList = {
|
|||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleDamage, OnDamage)
|
||||
end,
|
||||
--击杀每个敌人会永久增加[a]%的[b],持续[c]秒。(0表示永久)(不可驱散)
|
||||
--a[float],b[属性],c[int]
|
||||
[70] = function(role, args)
|
||||
local f1 = args[1]
|
||||
local pro = args[2]
|
||||
local f2 = args[3]
|
||||
|
||||
local OnKill = function(defRole)
|
||||
local buff = Buff.Create(role, BuffName.PropertyChange, f2, propertyList[pro], f1, 2)
|
||||
buff.cover = true
|
||||
buff.clear = false
|
||||
role:AddBuff(buff)
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleKill, OnKill)
|
||||
end,
|
||||
|
||||
--受击后,[a]对攻击者造成自身[c]%的[d]伤害。
|
||||
--a[float],c[float],d[伤害类型]
|
||||
[71] = function(role, args)
|
||||
local f1 = args[1]
|
||||
local f2 = args[2]
|
||||
local dt = args[3]
|
||||
|
||||
local lastTrigger = 0
|
||||
local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
|
||||
if atkRole.isTeam then
|
||||
return
|
||||
end
|
||||
lastTrigger = lastTrigger + 1
|
||||
if lastTrigger > 1 then --加入限定避免循环触发
|
||||
return
|
||||
end
|
||||
BattleUtil.RandomAction(f1, function ()
|
||||
BattleUtil.CalDamage(role, atkRole, dt, f2)
|
||||
end)
|
||||
lastTrigger = 0
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
|
||||
end,
|
||||
}
|
||||
return passivityList
|
|
@ -43,8 +43,8 @@ local stageFrame2 = 30 * BattleLogic.GameFrameRate --中期转后期的时间点
|
|||
local curStageFrame
|
||||
|
||||
local teamSkillCastTime = {7 * BattleLogic.GameFrameRate,
|
||||
25 * BattleLogic.GameFrameRate,
|
||||
55 * BattleLogic.GameFrameRate}
|
||||
22 * BattleLogic.GameFrameRate,
|
||||
45 * BattleLogic.GameFrameRate}
|
||||
local teamSkillCastIndex
|
||||
|
||||
local maxFrame --战斗最大用时,超时判负
|
||||
|
@ -453,10 +453,12 @@ end
|
|||
function BattleLogic.GetNeighbor(role, chooseType)
|
||||
local posList = {}
|
||||
local target = chooseType == 1 and role or BattleLogic.GetAggro(role)
|
||||
local list = BattleUtil.ChooseTarget(target, 10000)
|
||||
for i=1, #list do
|
||||
if not list[i].isDead and math.abs(posDic[target.position] - posDic[list[i].position]) <= 1 then
|
||||
table.insert(posList, list[i])
|
||||
if target then
|
||||
local list = BattleLogic.Query(function (r) return r.camp == target.camp end)
|
||||
for i=1, #list do
|
||||
if not list[i].isDead and math.abs(posDic[target.position] - posDic[list[i].position]) <= 1 then
|
||||
table.insert(posList, list[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
return posList
|
||||
|
|
|
@ -30,6 +30,7 @@ BattleEventName = {
|
|||
RoleBeDodge = indexAdd(),
|
||||
RoleDodge = indexAdd(),
|
||||
RoleDead = indexAdd(),
|
||||
RoleKill = indexAdd(),
|
||||
RoleRevive = indexAdd(),
|
||||
RolePropertyChanged = indexAdd(),
|
||||
RoleCDChanged = indexAdd(),
|
||||
|
|
|
@ -193,6 +193,7 @@ function BattleUtil.ApplyDamage(atkRole, defRole, damage, bCrit, damageType, isD
|
|||
defRole.isDead = true
|
||||
BattleLogic.BuffMgr:ClearBuff(defRole)
|
||||
defRole.Event:DispatchEvent(BattleEventName.RoleDead, atkRole)
|
||||
atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole)
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue