zombieboost.lua 923 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. local ZombieBoost = {}
  2. ----------------
  3. -- Meta
  4. ----------------
  5. ZombieBoost.name = 'ZombieBoost'
  6. ZombieBoost.code = 'zombieboost'
  7. ZombieBoost.text = 'BRAINS!'
  8. ZombieBoost.hide = false
  9. ----------------
  10. -- Data
  11. ----------------
  12. ZombieBoost.haste = 1.5
  13. ZombieBoost.duration = 4
  14. function ZombieBoost:activate()
  15. self.amount = self.owner.class.speed * self.haste
  16. self.decrease = (self.amount / self.duration) * tickRate
  17. self.owner.haste = self.owner.haste + self.amount
  18. self.timer = self.duration
  19. end
  20. function ZombieBoost:update()
  21. self.amount = self.amount - self.decrease
  22. self.owner.haste = self.owner.haste - self.decrease
  23. self.timer = timer.rot(self.timer, function()
  24. self.owner.haste = self.owner.haste - self.amount
  25. ctx.buffs:remove(self.owner, 'zombieboost')
  26. end)
  27. end
  28. function ZombieBoost:stack()
  29. self.owner.haste = self.owner.haste - self.amount
  30. self:activate()
  31. end
  32. return ZombieBoost