战斗逻辑

back_recharge
lvxinran 2020-01-14 16:16:09 +08:00
parent 4148f0d9ee
commit 1de89f726a
5 changed files with 88 additions and 21 deletions

View File

@ -162,7 +162,7 @@ function BuffManager:Update()
local isCovered = false
for i=1, buffList.size do
local oldBuff = buffList.buffer[i]
if oldBuff.cover and oldBuff.target == buff.target and oldBuff:OnCover(buff) then --判定该效果能否被覆盖
if oldBuff.cover and oldBuff.target == buff.target and oldBuff.clear == buff.clear and oldBuff:OnCover(buff) then --判定该效果能否被覆盖
oldBuff:OnEnd()
oldBuff.target.Event:DispatchEvent(BattleEventName.BuffEnd, oldBuff)
putBuff(oldBuff)

View File

@ -431,17 +431,17 @@ local effectList = {
local f2 = args[3]
BattleLogic.WaitForTrigger(interval, function ()
local trigger = function(defRole, damageFunc, damage)
if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function (buff)
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff)
return dot == 0 or buff.damageType == dot
end) then
damage = damage + floor(damage * f1)
end
damageFunc(damage)
end
caster.Event:AddEvent(BattleEventName.RoleDamageAfter, trigger)
target.Event:AddEvent(BattleEventName.RoleBeDamagedAfter, trigger)
if f2 > 0 then
BattleLogic.WaitForTrigger(f2, function ()
caster.Event:RemoveEvent(BattleEventName.RoleDamageAfter, trigger)
target.Event:RemoveEvent(BattleEventName.RoleBeDamagedAfter, trigger)
end)
end
end)
@ -843,13 +843,12 @@ local effectList = {
caster.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
end)
end,
--造成[a]%的[b]伤害,如果目标受到此次伤害前,生命低于最大生命[c]%,则直接击杀(击杀值不超过攻击者10倍攻击)。
--造成[a]%的[b]伤害【AOE】,如果目标受到此次伤害前,生命低于最大生命[c]%,则直接击杀(击杀值不超过攻击者10倍攻击)。
--a[float],b[伤害类型],c[float]
[50] = function(caster, target, args, interval)
local f1 = args[1]
local dt = args[2]
local f2 = args[3]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
BattleLogic.WaitForTrigger(interval, function ()
if BattleUtil.GetHPPencent(target) < f2 then
BattleUtil.ApplyDamage(caster, target, min(target:GetRoleData(RoleDataName.Hp), caster:GetRoleData(RoleDataName.Attack)*10))
@ -1140,7 +1139,7 @@ local effectList = {
caster.Event:RemoveEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
end)
end,
--造成[a]%的[b]伤害,[c]的概率造成眩晕,持续[d]秒。若未造成眩晕,则为随机1名敌人施加增伤印记。最大[e]层(减益印记,不可驱散)
--造成[a]%的[b]伤害,[c]的概率造成眩晕,持续[d]秒。若未造成眩晕,则为目标施加增伤印记。最大[e]层(减益印记,不可驱散)
--a[float],b[伤害类型],c[float],d[int],e[int]
[65] = function(caster, target, args, interval)
local f1 = args[1]
@ -1154,14 +1153,11 @@ local effectList = {
if Random.Range01() <= f2 then
target:AddBuff(Buff.Create(caster, BuffName.Control, f3, 1))
else
local arr = BattleUtil.ChooseTarget(caster, 20001)
if arr[1] then
local brand = Buff.Create(caster, BuffName.Brand, 0, "zengshang")
brand.maxLayer = i1
brand.clear = false
brand.isDeBuff = true
arr[1]:AddBuff(brand)
end
local brand = Buff.Create(caster, BuffName.Brand, 0, "zengshang")
brand.maxLayer = i1
brand.clear = false
brand.isDeBuff = true
target:AddBuff(brand)
end
end)
end,
@ -1556,7 +1552,7 @@ local effectList = {
end)
end)
end,
--施加[a]的[b]%护盾,持续[c]秒。护盾被击破时,对击破者造成自身最大生命值[d]%的伤害。
--施加[a]的[b]%护盾,持续[c]秒。护盾被击破时,对击破者造成施法者最大生命值[d]%的伤害。
--a[属性],b[float],c[int],d[float]
[84] = function(caster, target, args, interval)
local pro1 = args[1]
@ -1569,7 +1565,7 @@ local effectList = {
local OnBuffEnd = function(buff)
if buff == shield and buff.framePass < buff.frameDuration then --护盾被击破
if buff.atk and not buff.atk.isTeam then
BattleUtil.ApplyDamage(target, buff.atk, floor(BattleUtil.FP_Mul(target:GetRoleData(RoleDataName.MaxHp), f3)))
BattleUtil.ApplyDamage(target, buff.atk, floor(BattleUtil.FP_Mul(caster:GetRoleData(RoleDataName.MaxHp), f3)))
end
end
end
@ -1849,6 +1845,35 @@ local effectList = {
buffRandomAction(f4, target, HOT)
end)
end,
--造成[a]到[b]段[c]%的[d]伤害【AOE】每段伤害有[e]的概率造成[f],持续[g]秒。若目标处于[h]状态,则必定暴击。
--a[int],b[int],c[float],d[伤害类型],e[float],f[控制状态],g[int],h[控制状态]
[98] = function(caster, target, args, interval)
local i1 = args[1]
local i2 = args[2]
local f1 = args[3]
local dt = args[4]
local f2 = args[5]
local c1 = args[6]
local f4 = args[7]
local c2 = args[8]
local count = Random.RangeInt(i1, i2)
local d = interval / count
for i=1, count do
BattleLogic.WaitForTrigger(d * (i-1), function ()
BattleLogic.WaitForTrigger(d, function ()
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Control, function (buff) return c2 == 0 or buff.ctrlType == c2 end) then
target.isFlagCrit = true
BattleUtil.CalDamage(caster, target, dt, f1)
target.isFlagCrit = false
else
BattleUtil.CalDamage(caster, target, dt, f1)
end
buffRandomAction(f2, target, Buff.Create(caster, BuffName.Control, f4, c1))
end)
end)
end
end,
}
return effectList

View File

@ -1392,5 +1392,47 @@ local passivityList = {
end
role.Event:AddEvent(BattleEventName.RoleDead, OnDead)
end,
--boss每受到[a]*印记层数)点伤害,为自身永久增加一层印记,每层印记为自身增加[b]点攻击,[c]点护甲和[d]点魔抗。【不可驱散】
--a[int],b[int],c[int],d[int]
[75] = function(role, args)
local i1 = args[1]
local i2 = args[2]
local i3 = args[3]
local i4 = args[4]
if i1 <= 0 then return end --防止死循环
local total = 0
local layer = 0
local OnBeDamaged = function(atkRole, damage, bCrit, finalDmg, damageType)
total = total + damage
local count = 0
while total >= i1 * layer do
total = total - i1 * layer
layer = layer + 1
count = count + 1
end
if count > 0 then
local buff1 = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[1], i2 * count, 1)
buff1.cover = true
buff1.layer = count
buff1.clear = false
local buff2 = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[2], i3 * count, 1)
buff2.cover = true
buff2.layer = count
buff2.clear = false
local buff3 = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[3], i4 * count, 1)
buff3.cover = true
buff3.layer = count
buff3.clear = false
role:AddBuff(buff1)
role:AddBuff(buff2)
role:AddBuff(buff3)
end
end
role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnBeDamaged)
end,
}
return passivityList

View File

@ -36,9 +36,9 @@ function Brand:OnCover(newBuff)
local b = newBuff.flag == self.flag
if b then
if newBuff.maxLayer == 0 then
newBuff.layer = self.layer + 1
newBuff.layer = newBuff.layer + self.layer
else
newBuff.layer = math.min(self.layer + 1, newBuff.maxLayer)
newBuff.layer = math.min(newBuff.layer + self.layer, newBuff.maxLayer)
end
if newBuff.coverFunc then
newBuff.coverFunc(self)

View File

@ -57,7 +57,7 @@ function PropertyChange:OnCover(newBuff)
local b = self.propertyName == newBuff.propertyName and self.changeType == newBuff.changeType
if b then
if newBuff.maxLayer == 0 then
newBuff.layer = self.layer + 1
newBuff.layer = newBuff.layer + self.layer
newBuff.Value = newBuff.Value + self.Value
else
if self.layer < newBuff.maxLayer then
@ -65,7 +65,7 @@ function PropertyChange:OnCover(newBuff)
else
newBuff.Value = self.Value
end
newBuff.layer = math.min(self.layer + 1, newBuff.maxLayer)
newBuff.layer = math.min(newBuff.layer + self.layer, newBuff.maxLayer)
end
end
return b