siphon.lua 621 B

12345678910111213141516171819202122232425
  1. local Siphon = extend(Ability)
  2. Siphon.runeLifesteal = 0
  3. function Siphon:postattack(target, amount)
  4. if amount then
  5. local lifesteal = self.runeLifesteal + (.04 + amount * (.04 * self.unit:upgradeLevel('siphon')))
  6. if self.unit:upgradeLevel('equilibrium') > 0 and self.unit.health < self.unit.maxHealth * .4 then
  7. lifesteal = lifesteal * 2
  8. end
  9. self.unit:heal(lifesteal)
  10. end
  11. end
  12. function Siphon:bonuses()
  13. local bonuses = {}
  14. if self.runeLifesteal > 0 then
  15. table.insert(bonuses, {'Runes', math.round(self.runeLifesteal * 100) .. '%', 'lifesteal'})
  16. end
  17. return bonuses
  18. end
  19. return Siphon