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.
 
 
 

65 lines
984 B

  1. module.exports = {
  2. type: 'harvestLife',
  3. cdMax: 5,
  4. manaCost: 0,
  5. range: 1,
  6. damage: 1,
  7. col: 4,
  8. row: 1,
  9. init: function () {
  10. if (this.range > 1)
  11. this.needLos = true;
  12. },
  13. cast: function (action) {
  14. let target = action.target;
  15. let row = this.row;
  16. let col = this.col;
  17. this.sendAnimation({
  18. id: target.id,
  19. components: [{
  20. type: 'attackAnimation',
  21. new: true,
  22. row: row,
  23. col: col
  24. }]
  25. });
  26. this.sendBump(target);
  27. this.queueCallback(this.explode.bind(this, target), 100);
  28. return true;
  29. },
  30. explode: function (target) {
  31. let obj = this.obj;
  32. if ((obj.destroyed) || (target.destroyed))
  33. return;
  34. let damage = this.getDamage(target);
  35. target.stats.takeDamage({
  36. damage,
  37. threatMult: this.threatMult,
  38. source: obj,
  39. target,
  40. spellName: 'harvestLife'
  41. });
  42. let healAmount = damage.amount * (this.healPercent / 100);
  43. obj.stats.getHp({
  44. heal: {
  45. amount: healAmount
  46. },
  47. source: obj,
  48. target: obj
  49. });
  50. }
  51. };