buff.lua 759 B

123456789101112131415161718192021222324252627282930313233
  1. Buff = class()
  2. Buff.activate = f.empty
  3. Buff.deactivate = f.empty
  4. Buff.update = f.empty
  5. function Buff:rot()
  6. if self.timer then
  7. local rate = ls.tickrate
  8. if self.unit then
  9. if self.unit.buffs:isCrowdControl(self.code) then
  10. local immunity = self.unit.buffs:ccImmunity()
  11. if immunity == 1 then self.timer = 0
  12. else rate = rate / (1 - immunity) end
  13. end
  14. self.timer = self.timer - rate
  15. if self.timer <= 0 then
  16. self.unit.buffs:remove(self)
  17. end
  18. elseif self.player then
  19. self.timer = self.timer - rate
  20. if self.timer <= 0 then
  21. self.player.buffs:remove(self)
  22. end
  23. end
  24. end
  25. end
  26. function Buff:getUnitDirection()
  27. return (self.unit.animation.flipped and -1 or 1)
  28. end