Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

102 linhas
1.9 KiB

  1. define([
  2. 'world/spawners',
  3. 'world/mobBuilder',
  4. 'combat/combat'
  5. ], function (
  6. spawners,
  7. mobBuilder,
  8. combat
  9. ) {
  10. return {
  11. id: 'akarei',
  12. name: 'The Akarei',
  13. description: `The last descendents of the ancient Akarei.`,
  14. uniqueStat: {
  15. damage: 1,
  16. chance: {
  17. min: 20,
  18. max: 45
  19. },
  20. generate: function (item) {
  21. var chance = this.chance;
  22. var chanceRoll = ~~(random.norm(chance.min, chance.max) * 10) / 10;
  23. var result = null;
  24. if (item.effects)
  25. result = item.effects.find(e => (e.factionId == 'akarei'));
  26. if (!result) {
  27. if (!item.effects)
  28. item.effects = [];
  29. result = {
  30. factionId: 'akarei',
  31. properties: {
  32. chance: chanceRoll,
  33. },
  34. text: chanceRoll + '% chance on crit to cast a lightning bolt',
  35. events: {}
  36. };
  37. item.effects.push(result);
  38. }
  39. if (!result.events)
  40. result.events = {};
  41. for (var e in this.events) {
  42. result.events[e] = this.events[e];
  43. }
  44. return result;
  45. },
  46. events: {
  47. beforeDealDamage: function (item, damage, target) {
  48. if (!damage.crit)
  49. return;
  50. var effect = item.effects.find(e => (e.factionId == 'akarei'));
  51. var roll = Math.random() * 100;
  52. if (roll >= effect.properties.chance)
  53. return;
  54. var cbExplode = function (target) {
  55. if ((this.destroyed) || (target.destroyed))
  56. return;
  57. var damage = combat.getDamage({
  58. source: this,
  59. target: target,
  60. damage: item.level * 5,
  61. element: 'arcane',
  62. noCrit: true
  63. });
  64. target.stats.takeDamage(damage, 1, this);
  65. };
  66. this.instance.syncer.queue('onGetObject', {
  67. id: this.id,
  68. components: [{
  69. type: 'lightningEffect',
  70. toX: target.x,
  71. toY: target.y
  72. }]
  73. });
  74. this.spellbook.registerCallback(this.id, cbExplode.bind(this, target), 1);
  75. }
  76. }
  77. },
  78. rewards: {
  79. }
  80. };
  81. });