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.
 
 
 

89 line
1.6 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. if (!result.events)
  35. result.events = {};
  36. for (var e in this.events) {
  37. result.events[e] = this.events[e];
  38. }
  39. return result;
  40. },
  41. events: {
  42. afterKillMob: function(item, mob) {
  43. var effect = item.effects.find(e => (e.factionId == 'gaekatla'));
  44. var roll = Math.random() * 100;
  45. if (roll >= this.chance)
  46. return;
  47. //Spawn a mob
  48. var mob = mob.instance.spawners.spawn({
  49. amountLeft: 1,
  50. blueprint: {
  51. x: mob.x,
  52. y: mob.y,
  53. cell: 34,
  54. sheetName: 'mobs',
  55. name: 'Squiggle'
  56. }
  57. });
  58. mobBuilder.build(mob, {
  59. level: 5,
  60. faction: this.aggro.faction,
  61. walkDistance: 2,
  62. regular: {
  63. drops: 0,
  64. hpMult: 1,
  65. dmgMult: 1
  66. },
  67. }, false, 'regular');
  68. }
  69. }
  70. },
  71. rewards: {
  72. }
  73. };
  74. });