rocketboots.lua 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. local RocketBoots = extend(app.logic.spell)
  2. RocketBoots.code = 'rocketboots'
  3. RocketBoots.maxDistance = 410
  4. RocketBoots.duration = 1
  5. RocketBoots.radius = 100
  6. function RocketBoots:activate(mx, my)
  7. self.timer = self.duration
  8. self:mirrorOwner()
  9. self.owner.z = 1
  10. self.owner.haste = -1000
  11. self.zVel = 750
  12. self.zAcc = -1500
  13. self.empowered = ctx.buffs:get(self.owner, 'overexertion')
  14. ctx.buffs:remove(self.owner, 'overexertion')
  15. local distance = math.min(self.maxDistance, math.distance(self.owner.x, self.owner.y, mx, my))
  16. local tx, ty = self.x + math.dx(distance, self.angle), self.y + math.dy(distance, self.angle)
  17. self.distance = math.distance(self.x, self.y, self:resolveCircle(tx, ty, self.owner.radius))
  18. self.speed = self.distance / self.duration
  19. end
  20. function RocketBoots:update()
  21. self:moveOwner(self.speed * tickRate)
  22. self.owner.z = self.owner.z + self.zVel * tickRate
  23. self.zVel = self.zVel + self.zAcc * tickRate
  24. self:rot(function()
  25. self.owner.z = 0
  26. self.owner.haste = self.owner.haste + 1000
  27. self.x, self.y = self.owner.x, self.owner.y
  28. table.each(self:enemiesInRadius(), function(p)
  29. ctx.buffs:add(p, self.empowered and 'rocketbootsstun' or 'rocketbootsslow')
  30. end)
  31. end)
  32. end
  33. return RocketBoots