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.
 
 
 

43 lines
724 B

  1. module.exports = {
  2. type: 'chainLightning',
  3. cdMax: 5,
  4. manaCost: 0,
  5. range: 9,
  6. needLos: true,
  7. damage: 1,
  8. cast: function (action) {
  9. let target = action.target;
  10. this.sendBump(target);
  11. this.obj.instance.syncer.queue('onGetObject', {
  12. id: this.obj.id,
  13. components: [{
  14. type: 'lightningEffect',
  15. toX: target.x,
  16. toY: target.y
  17. }]
  18. }, -1);
  19. this.queueCallback(this.explode.bind(this, target), 1);
  20. return true;
  21. },
  22. explode: function (target) {
  23. if ((this.obj.destroyed) || (target.destroyed))
  24. return;
  25. let damage = this.getDamage(target);
  26. target.stats.takeDamage({
  27. damage,
  28. threatMult: this.threatMult,
  29. source: this.obj,
  30. target,
  31. spellName: 'chainLightning'
  32. });
  33. }
  34. };