Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
39bff04d03
|
@ -10,14 +10,14 @@ require("Modules.Battle.Logic.Misc.BattleObjectPool")
|
||||||
require("Modules.Battle.Logic.Base.BattleEvent")
|
require("Modules.Battle.Logic.Base.BattleEvent")
|
||||||
require("Modules.Battle.Logic.Base.Random")
|
require("Modules.Battle.Logic.Base.Random")
|
||||||
|
|
||||||
require("Modules.Battle.Logic.BattleLogic")
|
|
||||||
require("Modules.Battle.Logic.RoleLogic")
|
|
||||||
|
|
||||||
require("Modules.Battle.Logic.Base.RoleData")
|
require("Modules.Battle.Logic.Base.RoleData")
|
||||||
require("Modules.Battle.Logic.Base.Buff")
|
require("Modules.Battle.Logic.Base.Buff")
|
||||||
require("Modules.Battle.Logic.Base.Skill")
|
require("Modules.Battle.Logic.Base.Skill")
|
||||||
require("Modules.Battle.Logic.Base.Passivity")
|
require("Modules.Battle.Logic.Base.Passivity")
|
||||||
|
|
||||||
|
require("Modules.Battle.Logic.BattleLogic")
|
||||||
|
require("Modules.Battle.Logic.RoleLogic")
|
||||||
|
|
||||||
local BattleMain = {}
|
local BattleMain = {}
|
||||||
local BattleLogic = BattleLogic
|
local BattleLogic = BattleLogic
|
||||||
local Random = Random
|
local Random = Random
|
||||||
|
@ -123,7 +123,7 @@ function BattleMain.Execute(seed, fightData, optionData)
|
||||||
_fightData = fightData
|
_fightData = fightData
|
||||||
_optionData = optionData
|
_optionData = optionData
|
||||||
|
|
||||||
print(PrintTable(fightData))
|
--print(PrintTable(fightData))
|
||||||
--该开关用于输出战斗过程中的日志,用于验证前后端是否出现战斗不同步
|
--该开关用于输出战斗过程中的日志,用于验证前后端是否出现战斗不同步
|
||||||
BattleLogic.IsOpenBattleRecord = false
|
BattleLogic.IsOpenBattleRecord = false
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,10 @@ local putBuff = function(buff)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local buffListPool = BattleObjectPool.New(function ()
|
||||||
|
return BattleList.New()
|
||||||
|
end)
|
||||||
|
|
||||||
function Buff:New()
|
function Buff:New()
|
||||||
local o = {}
|
local o = {}
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
|
@ -51,13 +55,24 @@ function BuffManager.New()
|
||||||
return instance
|
return instance
|
||||||
end
|
end
|
||||||
|
|
||||||
function BuffManager:Init(owner)
|
function BuffManager:Init()
|
||||||
self.buffQueue:Clear()
|
for i=1, self.buffQueue.size do
|
||||||
|
buffListPool:Put(self.buffQueue:Dequeue())
|
||||||
|
end
|
||||||
|
local list
|
||||||
|
for i = 1, self.buffList.size do
|
||||||
|
list = self.buffList.vList[i]
|
||||||
|
for j=1, list.size do
|
||||||
|
putBuff(list.buffer[j])
|
||||||
|
end
|
||||||
|
list:Clear()
|
||||||
|
buffListPool:Put(list)
|
||||||
|
end
|
||||||
self.buffList:Clear()
|
self.buffList:Clear()
|
||||||
self.owner = owner
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BuffManager:AddBuff(buff)
|
function BuffManager:AddBuff(target, buff)
|
||||||
|
buff.target = target
|
||||||
self.buffQueue:Enqueue(buff)
|
self.buffQueue:Enqueue(buff)
|
||||||
if not buff.exCtrlTime then
|
if not buff.exCtrlTime then
|
||||||
buff.exCtrlTime = 0
|
buff.exCtrlTime = 0
|
||||||
|
@ -76,12 +91,13 @@ function BuffManager:AddBuff(buff)
|
||||||
buff.frameInterval = floor(buff.interval * BattleLogic.GameFrameRate)
|
buff.frameInterval = floor(buff.interval * BattleLogic.GameFrameRate)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BuffManager:HasBuff(type, checkFunc)
|
function BuffManager:HasBuff(target, type, checkFunc)
|
||||||
local v
|
local v, buff
|
||||||
for i=1, self.buffList:Count() do
|
for i=1, self.buffList:Count() do
|
||||||
v = self.buffList.vList[i]
|
v = self.buffList.vList[i]
|
||||||
if v.size > 0 then
|
if v.size > 0 then
|
||||||
if v.buffer[1].type == type and (not checkFunc or (checkFunc and checkFunc(v.buffer[1]))) then
|
buff = v.buffer[1]
|
||||||
|
if buff.target == target and buff.type == type and (not checkFunc or (checkFunc and checkFunc(buff))) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -89,25 +105,23 @@ function BuffManager:HasBuff(type, checkFunc)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function BuffManager:ClearBuff(func)
|
function BuffManager:ClearBuff(target, func)
|
||||||
|
local list, buff, idx
|
||||||
for i = 1, self.buffList.size do
|
for i = 1, self.buffList.size do
|
||||||
local k = self.buffList.kList[i]
|
list = self.buffList.vList[i]
|
||||||
local v = self.buffList.vList[i]
|
if list.size > 0 then
|
||||||
if v.size > 0 then
|
idx = 1
|
||||||
local removeCount = 0
|
while idx <= list.size do
|
||||||
local idx = 1
|
buff = list.buffer[idx]
|
||||||
while idx <= v.size do
|
if buff.target == target and (not func or (func and func(buff))) then
|
||||||
if func(v.buffer[idx]) then
|
buff:OnEnd()
|
||||||
putBuff:Put(v.buffer[idx])
|
buff.target.Event:DispatchEvent(BattleEventName.BuffEnd, buff)
|
||||||
v:Remove(idx)
|
putBuff(buff)
|
||||||
removeCount = removeCount + 1
|
list:Remove(idx)
|
||||||
else
|
else
|
||||||
idx = idx + 1
|
idx = idx + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if removeCount > 0 then
|
|
||||||
self.owner.Event:DispatchEvent(BattleEventName.BuffCountChange, k, v.size)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -122,42 +136,34 @@ end
|
||||||
function BuffManager:Update()
|
function BuffManager:Update()
|
||||||
for i=1, self.buffQueue.size do
|
for i=1, self.buffQueue.size do
|
||||||
local buff = self.buffQueue:Dequeue()
|
local buff = self.buffQueue:Dequeue()
|
||||||
if not buff.caster then
|
|
||||||
--logErrorTrace("buff's caster can't be nil!")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local buffList
|
local buffList
|
||||||
if not self.buffList.kvList[buff.id] then
|
if not self.buffList.kvList[buff.id] then
|
||||||
buffList = BattleList.New()
|
buffList = buffListPool:Get()
|
||||||
self.buffList:Add(buff.id, buffList)
|
self.buffList:Add(buff.id, buffList)
|
||||||
else
|
else
|
||||||
buffList = self.buffList.kvList[buff.id]
|
buffList = self.buffList.kvList[buff.id]
|
||||||
end
|
end
|
||||||
if buff.cover and buffList.size > 0 then
|
if buff.cover and buffList.size > 0 then
|
||||||
if buffList.buffer[1]:OnCover(buff) then --判定该效果能否被覆盖
|
if buffList.buffer[1]:OnCover(buff) then --判定该效果能否被覆盖
|
||||||
buffList.buffer[1]:OnEnd(self.owner)
|
buffList.buffer[1]:OnEnd()
|
||||||
self.owner.Event:DispatchEvent(BattleEventName.BuffEnd, buffList.buffer[1])
|
buff.target.Event:DispatchEvent(BattleEventName.BuffEnd, buffList.buffer[1])
|
||||||
buffList.buffer[1] = buff
|
buffList.buffer[1] = buff
|
||||||
buff.target = self.owner
|
|
||||||
buff:OnStart()
|
buff:OnStart()
|
||||||
self.owner.Event:DispatchEvent(BattleEventName.BuffStart, buff)
|
buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
|
||||||
self.owner.Event:DispatchEvent(BattleEventName.BuffCover, buff)
|
buff.target.Event:DispatchEvent(BattleEventName.BuffCover, buff)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if buff.maxCount == 0 or buffList.size < buff.maxCount then --限制相同效果的数量,为0则不限制
|
if buff.maxCount == 0 or buffList.size < buff.maxCount then --限制相同效果的数量,为0则不限制
|
||||||
buffList:Add(buff)
|
buffList:Add(buff)
|
||||||
buff.target = self.owner
|
|
||||||
buff:OnStart()
|
buff:OnStart()
|
||||||
self.owner.Event:DispatchEvent(BattleEventName.BuffStart, buff)
|
buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
|
||||||
self.owner.Event:DispatchEvent(BattleEventName.BuffCountChange, buff.id, buffList.size)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local v
|
||||||
for i = 1, self.buffList.size do
|
for i = 1, self.buffList.size do
|
||||||
local k = self.buffList.kList[i]
|
v = self.buffList.vList[i]
|
||||||
local v = self.buffList.vList[i]
|
|
||||||
if v.size > 0 then
|
if v.size > 0 then
|
||||||
local removeCount = 0
|
|
||||||
local idx = 1
|
local idx = 1
|
||||||
local buff
|
local buff
|
||||||
while idx <= v.size do
|
while idx <= v.size do
|
||||||
|
@ -193,16 +199,12 @@ function BuffManager:Update()
|
||||||
if buff.disperse then
|
if buff.disperse then
|
||||||
buff:OnEnd()
|
buff:OnEnd()
|
||||||
buff.target.Event:DispatchEvent(BattleEventName.BuffEnd, buff)
|
buff.target.Event:DispatchEvent(BattleEventName.BuffEnd, buff)
|
||||||
putBuff(v.buffer[idx])
|
putBuff(buff)
|
||||||
v:Remove(idx)
|
v:Remove(idx)
|
||||||
removeCount = removeCount + 1
|
|
||||||
else
|
else
|
||||||
idx = idx + 1
|
idx = idx + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if removeCount > 0 then
|
|
||||||
self.owner.Event:DispatchEvent(BattleEventName.BuffCountChange, k, v.size)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
local floor = math.floor
|
local floor = math.floor
|
||||||
|
local min = math.min
|
||||||
|
local max = math.max
|
||||||
--local RoleDataName = RoleDataName
|
--local RoleDataName = RoleDataName
|
||||||
--local BattleLogic = BattleLogic
|
--local BattleLogic = BattleLogic
|
||||||
--local BattleUtil = BattleUtil
|
--local BattleUtil = BattleUtil
|
||||||
|
@ -119,7 +121,7 @@ local effectList = {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
--[b]%改变[c]下次重击技能CD[a]秒
|
--[b]%改变[c]下次重击技能CD[a]秒
|
||||||
--a[float],b[float]
|
--a[float],b[float],c[改变类型]
|
||||||
[8] = function(caster, target, args, interval)
|
[8] = function(caster, target, args, interval)
|
||||||
local f1 = args[1]
|
local f1 = args[1]
|
||||||
local f2 = args[2] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
local f2 = args[2] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||||||
|
@ -131,13 +133,13 @@ local effectList = {
|
||||||
target.skill.sp = target.skill.spPass
|
target.skill.sp = target.skill.spPass
|
||||||
else
|
else
|
||||||
if ct == 1 then --加算
|
if ct == 1 then --加算
|
||||||
target.skill.sp = target.skill.sp - floor(f1 * BattleLogic.GameFrameRate)
|
target.skill.sp = max(target.skill.sp - floor(f1 * BattleLogic.GameFrameRate), 0)
|
||||||
elseif ct == 2 then --乘加算(百分比属性加算)
|
elseif ct == 2 then --乘加算(百分比属性加算)
|
||||||
target.skill.sp = floor(target.skill.sp * (1 - f1))
|
target.skill.sp = max(target.skill.sp - floor(target.skill.spPass * f1),0)
|
||||||
elseif ct == 3 then --减算
|
elseif ct == 3 then --减算
|
||||||
target.skill.sp = target.skill.sp + floor(f1 * BattleLogic.GameFrameRate)
|
target.skill.sp = min(target.skill.sp + floor(f1 * BattleLogic.GameFrameRate), target.skill.spPass)
|
||||||
elseif ct == 4 then --乘减算(百分比属性减算)
|
elseif ct == 4 then --乘减算(百分比属性减算)
|
||||||
target.skill.sp = floor(target.skill.sp * (1 + f1))
|
target.skill.sp = min(target.skill.sp + floor(target.skill.spPass * f1), target.skill.spPass)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -198,8 +200,8 @@ local effectList = {
|
||||||
target:AddBuff(Buff.Create(caster, BuffName.DOT, f2, 1, 0, dt, f1))
|
target:AddBuff(Buff.Create(caster, BuffName.DOT, f2, 1, 0, dt, f1))
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
--造成[c],每秒造成[d]的[e]的伤害,持续[f]秒
|
--造成[a],每秒造成[b]的[c]的伤害,持续[d]秒
|
||||||
--c[持续伤害状态].d[float],e[伤害类型],f[int]
|
--a[持续伤害状态].b[float],c[伤害类型],d[int]
|
||||||
[13] = function(caster, target, args, interval)
|
[13] = function(caster, target, args, interval)
|
||||||
local d1 = args[1]
|
local d1 = args[1]
|
||||||
local f1 = args[2]
|
local f1 = args[2]
|
||||||
|
@ -223,7 +225,7 @@ local effectList = {
|
||||||
end
|
end
|
||||||
BattleLogic.WaitForTrigger(interval, function ()
|
BattleLogic.WaitForTrigger(interval, function ()
|
||||||
local layer
|
local layer
|
||||||
if target.BuffMgr:HasBuff(BuffName.Brand, function (buff)
|
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Brand, function (buff)
|
||||||
local b = buff.flag == rid
|
local b = buff.flag == rid
|
||||||
if b then
|
if b then
|
||||||
layer = buff.layer
|
layer = buff.layer
|
||||||
|
@ -354,7 +356,7 @@ local effectList = {
|
||||||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
|
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
|
||||||
end
|
end
|
||||||
BattleLogic.WaitForTrigger(interval, function ()
|
BattleLogic.WaitForTrigger(interval, function ()
|
||||||
if target.BuffMgr:HasBuff(BuffName.Control, function (buff) return i1 == 0 or buff.ctrlType == i1 end) then
|
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Control, function (buff) return i1 == 0 or buff.ctrlType == i1 end) then
|
||||||
f1 = f1 + f2
|
f1 = f1 + f2
|
||||||
end
|
end
|
||||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||||
|
@ -371,7 +373,7 @@ local effectList = {
|
||||||
local f3 = args[6]
|
local f3 = args[6]
|
||||||
BattleLogic.WaitForTrigger(interval, function ()
|
BattleLogic.WaitForTrigger(interval, function ()
|
||||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||||
if target.BuffMgr:HasBuff(BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
|
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
|
||||||
BattleUtil.RandomAction(f2, function ()
|
BattleUtil.RandomAction(f2, function ()
|
||||||
target:AddBuff(Buff.Create(caster, BuffName.Control, f3, ct))
|
target:AddBuff(Buff.Create(caster, BuffName.Control, f3, ct))
|
||||||
end)
|
end)
|
||||||
|
@ -386,7 +388,7 @@ local effectList = {
|
||||||
local dot = args[3]
|
local dot = args[3]
|
||||||
local f2 = args[4]
|
local f2 = args[4]
|
||||||
BattleLogic.WaitForTrigger(interval, function ()
|
BattleLogic.WaitForTrigger(interval, function ()
|
||||||
if target.BuffMgr:HasBuff(BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
|
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
|
||||||
f1 = f1 + f2
|
f1 = f1 + f2
|
||||||
end
|
end
|
||||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||||
|
@ -404,7 +406,7 @@ local effectList = {
|
||||||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
|
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
|
||||||
end
|
end
|
||||||
BattleLogic.WaitForTrigger(interval, function ()
|
BattleLogic.WaitForTrigger(interval, function ()
|
||||||
if target.BuffMgr:HasBuff(BuffName.HOT, function (buff) return true end) then
|
if BattleLogic.BuffMgr:HasBuff(target, BuffName.HOT, function (buff) return true end) then
|
||||||
f1 = f1 + f2
|
f1 = f1 + f2
|
||||||
end
|
end
|
||||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||||
|
@ -430,7 +432,7 @@ local effectList = {
|
||||||
|
|
||||||
BattleLogic.WaitForTrigger(interval, function ()
|
BattleLogic.WaitForTrigger(interval, function ()
|
||||||
local func = function(damage)
|
local func = function(damage)
|
||||||
if target.BuffMgr:HasBuff(BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
|
if BattleLogic.BuffMgr:HasBuff(target, 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
|
return damage
|
||||||
|
@ -479,7 +481,7 @@ local effectList = {
|
||||||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
|
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
|
||||||
end
|
end
|
||||||
BattleLogic.WaitForTrigger(interval, function ()
|
BattleLogic.WaitForTrigger(interval, function ()
|
||||||
if target.BuffMgr:HasBuff(BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
|
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
|
||||||
f1 = f1 + f2
|
f1 = f1 + f2
|
||||||
end
|
end
|
||||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||||
|
@ -524,7 +526,7 @@ local effectList = {
|
||||||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
|
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
|
||||||
end
|
end
|
||||||
BattleLogic.WaitForTrigger(interval, function ()
|
BattleLogic.WaitForTrigger(interval, function ()
|
||||||
if target.BuffMgr:HasBuff(BuffName.Control, function (buff) return ct == 0 or buff.ctrlType == ct end) then
|
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Control, function (buff) return ct == 0 or buff.ctrlType == ct end) then
|
||||||
BattleUtil.CalDamage(caster, target, dt, f1, f2)
|
BattleUtil.CalDamage(caster, target, dt, f1, f2)
|
||||||
else
|
else
|
||||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||||
|
@ -543,6 +545,18 @@ local effectList = {
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
|
--[b]%改变[d]重击技能CD[a]秒 ,持续[c]秒 (0代表清除所有)
|
||||||
|
--a[float],b[float],c[改变类型]
|
||||||
|
[32] = function(caster, target, args, interval)
|
||||||
|
local f1 = args[1] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||||||
|
local ib1 = args[2]
|
||||||
|
local f2 = args[3]
|
||||||
|
BattleLogic.WaitForTrigger(interval, function ()
|
||||||
|
BattleUtil.RandomAction(f1, function ()
|
||||||
|
target:AddBuff(Buff.Create(caster, BuffName.Immune, f2, ib1))
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
return effectList
|
return effectList
|
|
@ -200,12 +200,6 @@ function Skill:ResetCD()
|
||||||
BattleLogic.SetAggro(self.owner, 0)
|
BattleLogic.SetAggro(self.owner, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function takeEffect(type, caster, target, args, interval)
|
|
||||||
effect[type](caster, target, args, interval)
|
|
||||||
if BattleLogic.IsOpenBattleRecord then
|
|
||||||
BattleLogic.RecordEffect(caster, target, type, args, interval)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function Skill:Cast()
|
function Skill:Cast()
|
||||||
for i=1, self.effectList.size do
|
for i=1, self.effectList.size do
|
||||||
local effectGroup = self.effectList.buffer[i]
|
local effectGroup = self.effectList.buffer[i]
|
||||||
|
@ -227,7 +221,10 @@ function Skill:Cast()
|
||||||
for j=1, #arr do
|
for j=1, #arr do
|
||||||
for k=1, #effectGroup[3] do
|
for k=1, #effectGroup[3] do
|
||||||
local v = effectGroup[3][k]
|
local v = effectGroup[3][k]
|
||||||
takeEffect(v[1], self.owner, arr[j], v[2], duration)
|
effect[v[1]](self.owner, arr[j], v[2], duration)
|
||||||
|
--if BattleLogic.IsOpenBattleRecord then
|
||||||
|
-- BattleLogic.RecordEffect(v[1], self.owner, arr[j], v[2], duration)
|
||||||
|
--end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif chooseId == 20000 then --敌方aoe
|
elseif chooseId == 20000 then --敌方aoe
|
||||||
|
@ -235,14 +232,20 @@ function Skill:Cast()
|
||||||
for j=1, #arr do
|
for j=1, #arr do
|
||||||
for k=1, #effectGroup[3] do
|
for k=1, #effectGroup[3] do
|
||||||
local v = effectGroup[3][k]
|
local v = effectGroup[3][k]
|
||||||
takeEffect(v[1], self.owner, arr[j], v[2], duration)
|
effect[v[1]](self.owner, arr[j], v[2], duration)
|
||||||
|
--if BattleLogic.IsOpenBattleRecord then
|
||||||
|
-- BattleLogic.RecordEffect(v[1], self.owner, arr[j], v[2], duration)
|
||||||
|
--end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif nn == 1 or nn == 3 then
|
elseif nn == 1 or nn == 3 then
|
||||||
for j=1, #arr do
|
for j=1, #arr do
|
||||||
for k=1, #effectGroup[3] do
|
for k=1, #effectGroup[3] do
|
||||||
local v = effectGroup[3][k]
|
local v = effectGroup[3][k]
|
||||||
takeEffect(v[1], self.owner, arr[j], v[2], duration)
|
effect[v[1]](self.owner, arr[j], v[2], duration)
|
||||||
|
--if BattleLogic.IsOpenBattleRecord then
|
||||||
|
-- BattleLogic.RecordEffect(v[1], self.owner, arr[j], v[2], duration)
|
||||||
|
--end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -262,7 +265,10 @@ function Skill:Cast()
|
||||||
r = arr[i]
|
r = arr[i]
|
||||||
for k=1, #effectGroup[3] do
|
for k=1, #effectGroup[3] do
|
||||||
local v = effectGroup[3][k]
|
local v = effectGroup[3][k]
|
||||||
takeEffect(v[1], self.owner, r, v[2], cd)
|
effect[v[1]](self.owner, r, v[2], cd)
|
||||||
|
--if BattleLogic.IsOpenBattleRecord then
|
||||||
|
-- BattleLogic.RecordEffect(v[1], self.owner, r, v[2], cd)
|
||||||
|
--end
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -275,7 +281,10 @@ function Skill:Cast()
|
||||||
self.choosedList:Add(r)
|
self.choosedList:Add(r)
|
||||||
for k=1, #effectGroup[3] do
|
for k=1, #effectGroup[3] do
|
||||||
local v = effectGroup[3][k]
|
local v = effectGroup[3][k]
|
||||||
takeEffect(v[1], self.owner, r, v[2], cd)
|
effect[v[1]](self.owner, r, v[2], cd)
|
||||||
|
--if BattleLogic.IsOpenBattleRecord then
|
||||||
|
-- BattleLogic.RecordEffect(v[1], self.owner, r, v[2], cd)
|
||||||
|
--end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,6 +21,7 @@ local enemySkillUsable
|
||||||
BattleLogic.IsEnd = false
|
BattleLogic.IsEnd = false
|
||||||
BattleLogic.Result = -1
|
BattleLogic.Result = -1
|
||||||
BattleLogic.Event = BattleEvent.New()
|
BattleLogic.Event = BattleEvent.New()
|
||||||
|
BattleLogic.BuffMgr = BuffManager.New()
|
||||||
|
|
||||||
local playerTeamDummyRole = {camp = 0, Event = BattleLogic.Event, isTeam = true}
|
local playerTeamDummyRole = {camp = 0, Event = BattleLogic.Event, isTeam = true}
|
||||||
local enemyTeamDummyRole = {camp = 0, Event = BattleLogic.Event, isTeam = true}
|
local enemyTeamDummyRole = {camp = 0, Event = BattleLogic.Event, isTeam = true}
|
||||||
|
@ -88,6 +89,7 @@ function BattleLogic.Init(data, optionData)
|
||||||
enemySkillUsable = true
|
enemySkillUsable = true
|
||||||
|
|
||||||
BattleLogic.Event:ClearEvent()
|
BattleLogic.Event:ClearEvent()
|
||||||
|
BattleLogic.BuffMgr:Init()
|
||||||
BattleLogic.IsEnd = false
|
BattleLogic.IsEnd = false
|
||||||
BattleLogic.Result = -1
|
BattleLogic.Result = -1
|
||||||
end
|
end
|
||||||
|
@ -383,6 +385,8 @@ function BattleLogic.Update()
|
||||||
enemyMP = 0
|
enemyMP = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
BattleLogic.BuffMgr:Update()
|
||||||
|
|
||||||
bMyAllDead = true
|
bMyAllDead = true
|
||||||
bEnemyAllDead = true
|
bEnemyAllDead = true
|
||||||
for i=1, objList.size do
|
for i=1, objList.size do
|
||||||
|
|
|
@ -9,6 +9,14 @@ function DOT:SetData(...)
|
||||||
self.damagePro, --1 物理 2 魔法
|
self.damagePro, --1 物理 2 魔法
|
||||||
self.damageFactor = ... --伤害系数
|
self.damageFactor = ... --伤害系数
|
||||||
self.isDeBuff = true
|
self.isDeBuff = true
|
||||||
|
|
||||||
|
--if self.damageType == 2 then
|
||||||
|
-- self.cover = true
|
||||||
|
-- self.layer = 1
|
||||||
|
--else
|
||||||
|
-- self.cover = false
|
||||||
|
-- self.layer = nil
|
||||||
|
--end
|
||||||
end
|
end
|
||||||
|
|
||||||
--初始化后调用一次
|
--初始化后调用一次
|
||||||
|
@ -31,6 +39,10 @@ end
|
||||||
--只有当cover字段为true时触发,返回true则被新效果覆盖
|
--只有当cover字段为true时触发,返回true则被新效果覆盖
|
||||||
function DOT:OnCover(newBuff)
|
function DOT:OnCover(newBuff)
|
||||||
--log("DOT:OnCover")
|
--log("DOT:OnCover")
|
||||||
|
--if self.damageType == 2 then
|
||||||
|
-- newBuff.layer = self.layer + 1
|
||||||
|
-- newBuff.damageFactor =
|
||||||
|
--end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,12 @@ function BattleUtil.ApplyDamage(atkRole, defRole, damage, bCrit)
|
||||||
|
|
||||||
if defRole:GetRoleData(RoleDataName.Hp) <= 0 then
|
if defRole:GetRoleData(RoleDataName.Hp) <= 0 then
|
||||||
defRole.isDead = true
|
defRole.isDead = true
|
||||||
|
BattleLogic.BuffMgr:ClearBuff(defRole)
|
||||||
defRole.Event:DispatchEvent(BattleEventName.RoleDead)
|
defRole.Event:DispatchEvent(BattleEventName.RoleDead)
|
||||||
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole)
|
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole)
|
||||||
|
if defRole.camp == 1 then
|
||||||
|
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, BattleLogic.GetAggro(0), 0.3)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return finalDmg
|
return finalDmg
|
||||||
|
|
|
@ -17,7 +17,7 @@ function RoleLogic.New()
|
||||||
shield=BattleList.New(),
|
shield=BattleList.New(),
|
||||||
exCalDmgList=BattleList.New(),
|
exCalDmgList=BattleList.New(),
|
||||||
buffFilter=BattleList.New(),
|
buffFilter=BattleList.New(),
|
||||||
BuffMgr=BuffManager.New(),Event=BattleEvent:New(),passiveList=0,isDead=false,Auto=false,IsDebug=false,enable=false}
|
Event=BattleEvent:New(),passiveList=0,isDead=false,Auto=false,IsDebug=false,enable=false}
|
||||||
setmetatable(instance, RoleLogic)
|
setmetatable(instance, RoleLogic)
|
||||||
return instance
|
return instance
|
||||||
end
|
end
|
||||||
|
@ -36,7 +36,6 @@ function RoleLogic:Init(uid, data)
|
||||||
self.exCalDmgList:Clear() --额外计算伤害列表
|
self.exCalDmgList:Clear() --额外计算伤害列表
|
||||||
self.buffFilter:Clear() --buff屏蔽列表
|
self.buffFilter:Clear() --buff屏蔽列表
|
||||||
|
|
||||||
self.BuffMgr:Init(self)
|
|
||||||
self.Event:ClearEvent()
|
self.Event:ClearEvent()
|
||||||
|
|
||||||
self.passiveList = {}
|
self.passiveList = {}
|
||||||
|
@ -71,12 +70,15 @@ function RoleLogic:GetRoleData(property)
|
||||||
end
|
end
|
||||||
|
|
||||||
function RoleLogic:AddBuff(buff)
|
function RoleLogic:AddBuff(buff)
|
||||||
|
if self.isDead then
|
||||||
|
return
|
||||||
|
end
|
||||||
for i=1, self.buffFilter.size do
|
for i=1, self.buffFilter.size do
|
||||||
if self.buffFilter.buffer[i](buff) then
|
if self.buffFilter.buffer[i](buff) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.BuffMgr:AddBuff(buff)
|
BattleLogic.BuffMgr:AddBuff(self, buff)
|
||||||
end
|
end
|
||||||
|
|
||||||
function RoleLogic:Dispose()
|
function RoleLogic:Dispose()
|
||||||
|
@ -93,7 +95,6 @@ function RoleLogic:Dispose()
|
||||||
end
|
end
|
||||||
|
|
||||||
function RoleLogic:Update()
|
function RoleLogic:Update()
|
||||||
self.BuffMgr:Update()
|
|
||||||
if not self.enable then
|
if not self.enable then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue