fix effects birth
This commit is contained in:
parent
5bc51c976e
commit
efe98e8210
@ -25,27 +25,35 @@ end
|
|||||||
--- проверяет, можно ли наложить эффект и при наложении его применяет
|
--- проверяет, можно ли наложить эффект и при наложении его применяет
|
||||||
--- @param effect EffectTag
|
--- @param effect EffectTag
|
||||||
--- @param stacks integer
|
--- @param stacks integer
|
||||||
|
--- @param intensity integer
|
||||||
function behavior:addEffect(effect, stacks, intensity)
|
function behavior:addEffect(effect, stacks, intensity)
|
||||||
local task1, birthStatement = book[effect]:beforeBirth(self.owner, intensity)
|
local task1, birthStatement = book[effect]:beforeBirth(self.owner, intensity)
|
||||||
if task1 then
|
if task1 then
|
||||||
task1(function() end)
|
task1(function() end)
|
||||||
end
|
end
|
||||||
if not birthStatement then return end
|
if not birthStatement then return end
|
||||||
-- проверяем эффект на возможности суммирования (aka противоречия)
|
-- проверяем на наличие того же эффекта
|
||||||
for i, ef in ipairs(self.effectsPriority) do
|
if self.effectsProperties[effect] then
|
||||||
if ef == effect then
|
-- добавляем в конец очереди эффектов
|
||||||
self.effectsProperties[ef] = {
|
for i, ef in ipairs(self.effectsPriority) do
|
||||||
stacks = stacks + self.effectsProperties[ef].stacks,
|
if ef == effect then
|
||||||
intensity = intensity
|
table.remove(self.effectsProperties, i)
|
||||||
}
|
self.effectsProperties[#self.effectsProperties + 1] = ef
|
||||||
local task2 = book[effect]:afterBirth(self.owner, intensity)
|
|
||||||
if task2 then
|
|
||||||
task2(function() end)
|
|
||||||
end
|
end
|
||||||
return
|
|
||||||
end
|
end
|
||||||
|
self.effectsProperties[effect] = {
|
||||||
|
stacks = stacks,
|
||||||
|
intensity = intensity
|
||||||
|
}
|
||||||
|
local task2 = book[effect]:afterBirth(self.owner, intensity)
|
||||||
|
if task2 then
|
||||||
|
task2(function() end)
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
--- проверка на сумму, и её применение
|
-- проверка на сумму, и её применение
|
||||||
|
for i, ef in ipairs(self.effectsPriority) do
|
||||||
if efb.sums[effect] then
|
if efb.sums[effect] then
|
||||||
if efb.sums[effect][ef] then
|
if efb.sums[effect][ef] then
|
||||||
if not efb.sums[effect][ef](self.owner, effect, ef) then return end
|
if not efb.sums[effect][ef](self.owner, effect, ef) then return end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user