voidmetal.lua 644 B

12345678910111213141516171819202122232425
  1. local VoidMetal = extend(Buff)
  2. VoidMetal.tags = {}
  3. VoidMetal.runeChance = 0
  4. function VoidMetal:shouldApplyBuff(code)
  5. local level = self.unit:upgradeLevel('voidmetal')
  6. local hasBastion = self.unit:upgradeLevel('temperedbastion') > 0
  7. local chance = (hasBastion and ctx.player.dead) and 1 or self.runeChance + .4
  8. if self.unit.buffs:isCrowdControl(code) then
  9. return love.math.random() > chance
  10. end
  11. return true
  12. end
  13. function VoidMetal:bonuses()
  14. local bonuses = {}
  15. if self.runeChance > 0 then
  16. table.insert(bonuses, {'Runes', math.round(self.runeChance * 100) .. '%', 'chance'})
  17. end
  18. return bonuses
  19. end
  20. return VoidMetal