Merge branch 'xma/dev' of http://60.1.1.230/gaoxin/JL_Client into xma/dev

dev_chengFeng
gaoxin 2021-03-26 15:03:32 +08:00
commit feb1e97089
5 changed files with 376 additions and 345 deletions

View File

@ -8,13 +8,14 @@ local itemPool = BattleObjectPool.New(function ()
return { func = 0, obj = 0, once = false }
end)
function BattleEvent.New()
local instance = {}
local instance = {isTrigger=true}
setmetatable(instance, BattleEvent)
instance.m_listeners = {}
return instance
end
function BattleEvent:AddEvent(sEventName, fListener, pObj, bOnce)
function BattleEvent:AddEvent(sEventName, fListener, pObj, bOnce,_role)
if not self.m_listeners[sEventName] then
self.m_listeners[sEventName] = listPool:Get()
end
@ -22,9 +23,15 @@ function BattleEvent:AddEvent(sEventName, fListener, pObj, bOnce)
item.func = fListener
item.obj = pObj
item.once = bOnce
item.role = _role
self.m_listeners[sEventName]:Add(item)
end
function BattleEvent:SetIsTrigger(_trigger)
self.isTrigger=_trigger
end
function BattleEvent:RemoveEvent(sEventName, fListener, pObj)
if not self.m_listeners[sEventName] then
return
@ -41,20 +48,26 @@ function BattleEvent:RemoveEvent(sEventName, fListener, pObj)
end
function BattleEvent:DispatchEvent(sEventName, ...)
if not self.isTrigger then
return
end
if not self.m_listeners[sEventName] then
return
end
local v
for i=1, self.m_listeners[sEventName].size do
v = self.m_listeners[sEventName].buffer[i]
if not v.obj then
v.func(...)
else
v.func(v.obj, ...)
end
if v.once then
self:RemoveEvent(sEventName, v)
if v.role==nil or not v.role.isExile then
if not v.obj then
v.func(...)
else
v.func(v.obj, ...)
end
if v.once then
self:RemoveEvent(sEventName, v)
end
end
end
end
function BattleEvent:ClearEvent()

View File

@ -333,6 +333,7 @@ function BuffManager:PassUpdate()
and buff.roundDuration > 0 -- 不是无限存在的buff
and buff.caster.type~=BattleUnitType.Monster --灵兽的buff在这里处理
and buff.type~=BuffName.NoDead
and not buff.target.isExile --放逐单位buff不会更新
then
-- 当前轮释放的buff不结算
if buff.startRound ~= BattleLogic.GetCurRound() then
@ -361,6 +362,7 @@ function BuffManager:PassUpdateNoDead()
and buff.roundDuration > 0 -- 不是无限存在的buff
and buff.caster.type~=BattleUnitType.Monster --灵兽的buff在这里处理
and buff.type==BuffName.NoDead --不灭在这里处理
and not buff.target.isExile --放逐单位buff不会更新
then
-- 当前轮释放的buff不结算
buff.roundPass = buff.roundPass + 1
@ -382,11 +384,17 @@ function BuffManager:PassMonsterUpdate()
if buffList.size > 0 then
for index = 1, buffList.size do
local buff = buffList.buffer[index]
if not buff.disperse -- 没过期
--and buff.caster.camp == curCamp -- 释放者是当前轮到的人
--and buff.caster.position == curPos
and buff.roundDuration > 0 -- 不是无限存在的buff
and buff.caster.type==BattleUnitType.Monster --灵兽的buff在这里处理
if (not buff.disperse -- 没过期
and buff.roundDuration > 0 -- 不是无限存在的buff
and buff.caster.type==BattleUnitType.Monster --灵兽的buff在这里处理
and not buff.target.isExile) --放逐单位buff不会更新
or (not buff.disperse -- 没过期
and buff.roundDuration > 0 -- 不是无限存在的buff
and buff.caster.type==BattleUnitType.Monster --灵兽的buff在这里处理
and buff.target.isExile
and buff.type==BuffName.Exile)
-- and buff.type~=BuffName.Exile --buff名称不是放逐
then
-- 当前轮释放的buff不结算
if buff.startRound ~= BattleLogic.GetCurRound() then
@ -412,7 +420,9 @@ function BuffManager:TurnUpdate(sort)
if not buff.disperse -- 没有过期
and buff.sort == sort -- 当前buff刷新等级
and buff.target.camp == curCamp -- 当前阵营
and not buff.target.isExile --放逐单位buff不会更新
and buff.target.position == curPos then -- 当前位置
--触发buff
if buff.roundInterval >= 0 then
if buff.roundInterval == 0 or buff.roundPass % buff.roundInterval == 0 then

View File

@ -40,6 +40,10 @@ end
--效果结束时调用一次
function Control:OnEnd()
--如果还有同类型的控制效果,就返回
if BattleLogic.BuffMgr:HasBuff(self.target, BuffName.Control, function (buff) return buff~=self and buff.ctrlType == self.ctrlType end) then
return
end
if self.ctrlType == 1 then --眩晕
self.target.ctrl_dizzy = false
elseif self.ctrlType == 2 then --沉默

View File

@ -16,6 +16,7 @@ function Exile:OnStart()
if self.caster.exileTargets then
table.insert(self.caster.exileTargets,self.target)
end
-- self.target.Event:SetIsTrigger(false)
end
--间隔N帧触发返回true时表示继续触发返回false立刻触发OnEnd
@ -25,9 +26,9 @@ end
--效果结束时调用一次
function Exile:OnEnd()
LogError("放逐结束")
self.target.isExile = false
self.target.passiveList=self.ownPassiveList
self.ownPassiveList=nil
--self.target.Event:SetIsTrigger(true)
end
--只有当cover字段为true时触发返回true则被新效果覆盖