bloodlust.lua 717 B

123456789101112131415161718192021222324252627282930313233
  1. local Bloodlust = {}
  2. ----------------
  3. -- Meta
  4. ----------------
  5. Bloodlust.name = 'Bloodlust'
  6. Bloodlust.code = 'bloodlust'
  7. Bloodlust.text = 'It is Bloodlust. My wife for hire.'
  8. Bloodlust.type = 'passive'
  9. ----------------
  10. -- Behavior
  11. ----------------
  12. function Bloodlust:activate(owner)
  13. ctx.event:on(app.net.events.dead, function(data)
  14. if data.kill == owner.id and data.id ~= owner.id then
  15. ctx.buffs:add(owner, 'bloodlust')
  16. end
  17. end, self)
  18. end
  19. function Bloodlust:deactivate(owner)
  20. ctx.event:remove(app.net.events.dead, self)
  21. end
  22. function Bloodlust:value(owner)
  23. local buff = ctx.buffs:get(owner, 'bloodlust')
  24. if buff then return buff.timer / buff.duration end
  25. return 0
  26. end
  27. return Bloodlust