burst.lua 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. local Burst = extend(Ability)
  2. Burst.runeDamage = 0
  3. Burst.runeRange = 0
  4. Burst.damages = {20, 40, 70, 110, 160}
  5. Burst.spiritRatio = 1
  6. Burst.ranges = {[0] = 60, 80, 110, 150}
  7. function Burst:die()
  8. local damages = self.damages
  9. local burst = self.unit:upgradeLevel('burst')
  10. local eruption = self.unit:upgradeLevel('eruption')
  11. local sanctuary = self.unit:upgradeLevel('sanctuary')
  12. local damage = self.runeDamage + damages[burst] + self.spiritRatio * self.unit.spirit
  13. local range = self.runeRange + self.ranges[eruption]
  14. local heal = sanctuary > 0 and damage * .5 or 0
  15. self:createSpell({
  16. damage = damage,
  17. range = range,
  18. heal = heal,
  19. maxHealth = .5
  20. })
  21. end
  22. function Burst:bonuses()
  23. local bonuses = {}
  24. local spirit = Unit.getStat('bruju', 'spirit')
  25. local eruption = data.unit.bruju.upgrades.eruption.level
  26. if eruption > 0 then
  27. table.insert(bonuses, {'Eruption', self.ranges[eruption] - self.ranges[0], 'range'})
  28. end
  29. if spirit > 0 then
  30. table.insert(bonuses, {'Spirit', math.round(spirit * self.spiritRatio), 'damage'})
  31. end
  32. if self.runeDamage > 0 then
  33. table.insert(bonuses, {'Runes', math.round(self.runeDamage), 'damage'})
  34. end
  35. if self.runeRange > 0 then
  36. table.insert(bonuses, {'Runes', math.round(self.runeRange), 'range'})
  37. end
  38. return bonuses
  39. end
  40. return Burst