選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

58 行
1.2 KiB

  1. module.exports = {
  2. generators: {
  3. catchChance: function (item, blueprint) {
  4. return random.expNorm(0, 60);
  5. },
  6. catchSpeed: function (item, blueprint) {
  7. return random.expNorm(0, 150);
  8. },
  9. fishRarity: function (item, blueprint) {
  10. return random.expNorm(0, 100);
  11. },
  12. fishWeight: function (item, blueprint) {
  13. return random.expNorm(0, 75);
  14. },
  15. fishItems: function (item, blueprint) {
  16. return random.expNorm(0, 50);
  17. }
  18. },
  19. generate: function (item, blueprint, result) {
  20. let statCount = blueprint.statCount || (item.quality + 1);
  21. let stats = Object.keys(this.generators);
  22. if (!item.stats)
  23. item.stats = {};
  24. for (let i = 0; i < statCount; i++) {
  25. let stat = stats[~~(Math.random() * stats.length)];
  26. let value = Math.ceil(this.generators[stat].call(this, item, blueprint));
  27. if (result) {
  28. result.addStatMsgs.push({
  29. stat: stat,
  30. value: value
  31. });
  32. }
  33. if (!item.stats[stat])
  34. item.stats[stat] = 0;
  35. item.stats[stat] += value;
  36. if (blueprint.statCount) {
  37. if (!item.enchantedStats)
  38. item.enchantedStats = {};
  39. if (item.enchantedStats[stat])
  40. item.enchantedStats[stat] += value;
  41. else
  42. item.enchantedStats[stat] = value;
  43. }
  44. }
  45. }
  46. };