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.
 
 
 

106 lines
2.0 KiB

  1. let spawners = require('../../world/spawners');
  2. let mobBuilder = require('../../world/mobBuilder');
  3. module.exports = {
  4. id: 'gaekatla',
  5. name: 'Gaekatla',
  6. description: 'Gaekatla; the goddess of nature.',
  7. uniqueStat: {
  8. chance: {
  9. min: 5,
  10. max: 20
  11. },
  12. generate: function (item) {
  13. let chance = this.chance;
  14. let chanceRoll = ~~(random.norm(chance.min, chance.max) * 10) / 10;
  15. let result = null;
  16. if (item.effects)
  17. result = item.effects.find(e => (e.factionId === 'gaekatla'));
  18. if (!result) {
  19. if (!item.effects)
  20. item.effects = [];
  21. result = {
  22. factionId: 'gaekatla',
  23. chance: chanceRoll,
  24. text: chanceRoll + '% chance on kill to summon a critter to assist you in battle',
  25. events: {}
  26. };
  27. item.effects.push(result);
  28. }
  29. //This is a hack for items that were never generated properly
  30. else if (!result.chance) {
  31. result.chance = chanceRoll;
  32. result.text = chanceRoll + '% chance on kill to summon a critter to assist you in battle';
  33. }
  34. if (!result.events)
  35. result.events = {};
  36. for (let e in this.events)
  37. result.events[e] = this.events[e];
  38. return result;
  39. },
  40. events: {
  41. afterKillMob: function (item, mob) {
  42. let effect = item.effects.find(e => (e.factionId === 'gaekatla'));
  43. let roll = Math.random() * 100;
  44. if (roll >= effect.chance)
  45. return;
  46. //Spawn a mob
  47. let mob = mob.instance.spawners.spawn({
  48. amountLeft: 1,
  49. blueprint: {
  50. x: mob.x,
  51. y: mob.y,
  52. cell: 34,
  53. sheetName: 'mobs',
  54. name: 'Squiggle',
  55. properties: {
  56. cpnFollower: {
  57. lifetime: 100
  58. }
  59. },
  60. extraProperties: {
  61. follower: {
  62. master: this
  63. }
  64. }
  65. }
  66. });
  67. mobBuilder.build(mob, {
  68. level: item.level,
  69. faction: this.aggro.faction,
  70. walkDistance: 2,
  71. regular: {
  72. drops: 0,
  73. hpMult: 1,
  74. dmgMult: 1
  75. },
  76. spells: [{
  77. type: 'melee',
  78. damage: 1,
  79. statMult: 0.1
  80. }]
  81. }, false, 'regular');
  82. mob.follower.bindEvents();
  83. }
  84. }
  85. },
  86. rewards: {
  87. }
  88. };