Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

64 строки
1.0 KiB

  1. module.exports = {
  2. type: 'cocoon',
  3. cdMax: 7,
  4. manaCost: 0,
  5. range: 9,
  6. speed: 200,
  7. damage: 0,
  8. needLos: true,
  9. ttl: 75,
  10. cast: function (action) {
  11. let obj = this.obj;
  12. let target = action.target;
  13. let ttl = Math.sqrt(Math.pow(target.x - obj.x, 2) + Math.pow(target.y - obj.y, 2)) * this.speed;
  14. this.sendAnimation({
  15. caster: this.obj.id,
  16. components: [{
  17. idSource: this.obj.id,
  18. idTarget: target.id,
  19. type: 'projectile',
  20. ttl: ttl,
  21. particles: this.particles
  22. }, {
  23. type: 'attackAnimation',
  24. layer: 'projectiles',
  25. loop: -1,
  26. row: this.row,
  27. col: this.col
  28. }]
  29. });
  30. this.sendBump(target);
  31. this.queueCallback(this.explode.bind(this, target), ttl);
  32. return true;
  33. },
  34. explode: function (target) {
  35. if (this.obj.destroyed)
  36. return;
  37. target.effects.addEffect({
  38. type: 'cocoon',
  39. ttl: this.ttl,
  40. source: this.obj
  41. });
  42. this.obj.instance.syncer.queue('onGetDamage', {
  43. id: target.id,
  44. event: true,
  45. text: 'cocooned'
  46. }, -1);
  47. target.aggro.tryEngage(this.obj, this.damage, this.threatMult);
  48. }
  49. };