smol refactor effects:addEffect
This commit is contained in:
parent
4f7dc9ab14
commit
b75dca12cb
@ -32,25 +32,6 @@ function behavior:addEffect(effect, stacks, intensity)
|
||||
task1(function() end)
|
||||
end
|
||||
if not birthStatement then return end
|
||||
-- проверяем на наличие того же эффекта
|
||||
if self.effectsProperties[effect] then
|
||||
-- добавляем в конец очереди эффектов
|
||||
for i, ef in ipairs(self.effectsPriority) do
|
||||
if ef == effect then
|
||||
table.remove(self.effectsProperties, i)
|
||||
self.effectsProperties[#self.effectsProperties + 1] = ef
|
||||
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
|
||||
@ -64,8 +45,17 @@ function behavior:addEffect(effect, stacks, intensity)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self.effectsPriority[#self.effectsPriority + 1] = effect
|
||||
-- проверяем на наличие такого эффекта
|
||||
if self.effectsProperties[effect] then
|
||||
for i, ef in ipairs(self.effectsPriority) do
|
||||
if ef == effect then
|
||||
table.remove(self.effectsProperties, i)
|
||||
self.effectsProperties[#self.effectsProperties + 1] = ef
|
||||
end
|
||||
end
|
||||
else
|
||||
self.effectsPriority[#self.effectsPriority + 1] = effect
|
||||
end
|
||||
self.effectsProperties[effect] = {
|
||||
stacks = stacks,
|
||||
intensity = intensity
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user