burst.lua 663 B

1234567891011121314151617181920212223242526272829
  1. local burst = lib.object.create():include(lib.ability)
  2. burst.cooldown = 3
  3. burst.cost = 1
  4. burst.range = 150
  5. burst.damage = 2
  6. function burst:canCast(owner)
  7. return util.isa(owner, app.minions.bruju.object) and not self:isOnCooldown() and self:canPayJuju()
  8. end
  9. function burst:cast(owner, x, y)
  10. self:payJuju()
  11. app.context:addObject(app.spells.burst, {
  12. position = util.copy(owner.position),
  13. radius = self.range
  14. })
  15. util.each(lib.entity.inRange(owner.position.x, owner.position.y, self.range, 'enemy'), function(enemy)
  16. enemy:hurt(self.damage, owner)
  17. end)
  18. owner:hurt(owner.health, owner)
  19. self.lastCast = lib.tick.index
  20. end
  21. return burst