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.
 
 
 

109 rivejä
2.1 KiB

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