tremor.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. local Tremor = extend(Ability)
  2. Tremor.damages = {30, 60, 90}
  3. Tremor.spiritRatio = 1.5
  4. Tremor.runeDamage = 0
  5. Tremor.runeStun = 0
  6. function Tremor:activate()
  7. self.unit.animation:on('event', function(event)
  8. if event.data.name == 'tremor' then
  9. self:fire()
  10. end
  11. end)
  12. if self.unit:upgradeLevel('staggeringentry') > 0 and love.math.random() < .5 then self:fire() end
  13. end
  14. function Tremor:use()
  15. self.unit.animation:set('tremor')
  16. self.unit.casting = true
  17. self.timer = 12
  18. end
  19. function Tremor:fire()
  20. local level = self.unit:upgradeLevel('tremor')
  21. local damages = self.damages
  22. local damage = self.runeDamage + damages[level] + self.spiritRatio * self.unit.spirit
  23. local stun = self.runeStun + 1 * level
  24. local width = 180 + (60 * self.unit:upgradeLevel('fissure'))
  25. self:createSpell({damage = damage, width = width, stun = stun, spikeCount = math.round(width / 60)})
  26. ctx.sound:play(data.media.sounds.thuju.tremor, function(sound) sound:setVolume(.5) end)
  27. end
  28. function Tremor:bonuses()
  29. local bonuses = {}
  30. local spirit = Unit.getStat('thuju', 'spirit')
  31. if spirit > 0 then
  32. table.insert(bonuses, {'Spirit', math.round(spirit * self.spiritRatio), 'damage'})
  33. end
  34. if self.runeDamage > 0 then
  35. table.insert(bonuses, {'Runes', math.round(self.runeDamage), 'damage'})
  36. end
  37. if self.runeStun > 0 then
  38. table.insert(bonuses, {'Runes', math.round(self.runeStun * 10) / 10 .. 's', 'stun duration'})
  39. end
  40. return bonuses
  41. end
  42. return Tremor