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.
 
 
 

61 lines
1.2 KiB

  1. module.exports = {
  2. id: 'anglers',
  3. name: 'The Anglers',
  4. description: 'Masters of the arts of Angling, Lurecrafting and Baiting.',
  5. uniqueStat: {
  6. chance: {
  7. min: 2,
  8. max: 7
  9. },
  10. generate: function (item) {
  11. let chance = this.chance;
  12. let chanceRoll = ~~(random.expNorm(chance.min, chance.max));
  13. let result = null;
  14. if (item.effects)
  15. result = item.effects.find(e => (e.factionId === 'anglers'));
  16. if (!result) {
  17. if (!item.effects)
  18. item.effects = [];
  19. result = {
  20. factionId: 'anglers',
  21. chance: chanceRoll,
  22. text: chanceRoll + '% chance to multi-catch',
  23. events: {}
  24. };
  25. item.effects.push(result);
  26. }
  27. if (!result.events)
  28. result.events = {};
  29. for (let e in this.events)
  30. result.events[e] = this.events[e];
  31. return result;
  32. },
  33. events: {
  34. beforeGatherResource: function (item, gatherResult, source) {
  35. let effect = item.effects.find(e => (e.factionId === 'anglers'));
  36. let roll = Math.random() * 100;
  37. if (roll >= effect.chance)
  38. return;
  39. let pick = gatherResult.items[~~(Math.random() * gatherResult.items.length)];
  40. gatherResult.items.push(extend(true, {}, pick));
  41. }
  42. }
  43. },
  44. rewards: {
  45. }
  46. };