You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

68 lines
1.2 KiB

  1. module.exports = {
  2. type: 'bloodBarrier',
  3. cdMax: 7,
  4. manaCost: 0,
  5. range: 9,
  6. speed: 150,
  7. damage: 1,
  8. row: 3,
  9. col: 0,
  10. needLos: true,
  11. autoTargetFollower: true,
  12. targetFriendly: true,
  13. noTargetSelf: true,
  14. cast: function (action) {
  15. const { target } = action;
  16. this.sendBump(target);
  17. this.queueCallback(this.explode.bind(this, action), 1, null, target);
  18. return true;
  19. },
  20. explode: function (action) {
  21. const { obj } = this;
  22. const { target } = action;
  23. if ((obj.destroyed) || (target.destroyed))
  24. return;
  25. let amount = (obj.stats.values.hpMax / 100) * this.drainPercentage;
  26. obj.stats.takeDamage({
  27. damage: { amount },
  28. threatMult: 0,
  29. source: obj,
  30. target: obj,
  31. spellName: 'bloodBarrier'
  32. });
  33. amount = amount * this.shieldMultiplier;
  34. const heal = { amount };
  35. target.stats.getHp(heal, obj);
  36. //Only reset the first spell's cooldown if it's an auto attack and not a spell
  37. const firstSpell = target.spellbook.spells[0];
  38. const resetFirstSpell = (
  39. firstSpell &&
  40. firstSpell.isAttack &&
  41. firstSpell.auto
  42. );
  43. if (resetFirstSpell)
  44. target.spellbook.spells[0].cd = 0;
  45. target.effects.addEffect({
  46. type: 'frenzy',
  47. ttl: this.frenzyDuration,
  48. newCd: target.player ? 2 : 0
  49. });
  50. }
  51. };