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.
 
 
 

47 lines
1021 B

  1. define([
  2. './stats'
  3. ], function (
  4. generatorStats
  5. ) {
  6. return {
  7. minSlotPerfection: 0.1,
  8. maxSlotPerfection: 1,
  9. minLevelMult: 0.3,
  10. maxLevelMult: 1,
  11. generate: function (item, blueprint) {
  12. if (!blueprint.attrRequire)
  13. return;
  14. if (!item.requires)
  15. item.requires = [];
  16. var tempItem = {
  17. quality: 0,
  18. level: item.level,
  19. stats: {}
  20. };
  21. var perfection = ~~(11 * (this.minSlotPerfection + (Math.random() * (this.maxSlotPerfection - this.minSlotPerfection))));
  22. generatorStats.generate(tempItem, {
  23. forceStats: [blueprint.attrRequire],
  24. perfection: perfection
  25. });
  26. var statValue = tempItem.stats[Object.keys(tempItem.stats)[0]];
  27. statValue += ~~(item.level * (this.minLevelMult + ~~(Math.random() * (this.maxLevelMult - this.minLevelMult))));
  28. statValue = Math.ceil(((item.level - 1) / 20) * statValue);
  29. if (statValue <= 0) {
  30. item.requires = null;
  31. return;
  32. }
  33. item.requires.push({
  34. stat: blueprint.attrRequire,
  35. value: statValue
  36. });
  37. }
  38. };
  39. });