ghostarmor.lua 673 B

123456789101112131415161718192021222324
  1. local GhostArmor = extend(Buff)
  2. GhostArmor.tags = {'dodge'}
  3. GhostArmor.runeChance = 0
  4. function GhostArmor:prehurt(amount, source, kind)
  5. local hasBastion = self.unit:upgradeLevel('temperedbastion') > 0
  6. local chance = (hasBastion and ctx.player.dead) and 1 or (self.runeChance + .05 + .05 * self.unit:upgradeLevel('ghostarmor'))
  7. if kind and table.has(kind, 'attack') and love.math.random() < chance then
  8. return 0
  9. end
  10. return amount
  11. end
  12. function GhostArmor:bonuses()
  13. local bonuses = {}
  14. if self.runeChance > 0 then
  15. table.insert(bonuses, {'Runes', math.round(self.runeChance * 100) .. '%', 'dodge chance'})
  16. end
  17. return bonuses
  18. end
  19. return GhostArmor