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.
 
 
 

36 lines
870 B

  1. define([
  2. 'items/config/types',
  3. 'items/config/armorMaterials'
  4. ], function(
  5. configTypes,
  6. armorMaterials
  7. ) {
  8. return {
  9. generate: function(item, blueprint) {
  10. var type = blueprint.type || _.randomKey(configTypes[item.slot]);
  11. var typeBlueprint = configTypes[item.slot][type];
  12. if (!typeBlueprint)
  13. return;
  14. item.type = type;
  15. item.sprite = typeBlueprint.sprite;
  16. if (typeBlueprint.spritesheet)
  17. item.spritesheet = typeBlueprint.spritesheet;
  18. if (typeBlueprint.spellName)
  19. blueprint.spellName = typeBlueprint.spellName;
  20. if (typeBlueprint.range)
  21. item.range = typeBlueprint.range;
  22. if ((typeBlueprint.material) && (blueprint.statMult.armor))
  23. blueprint.statMult.armor *= armorMaterials[typeBlueprint.material].statMult.armor;
  24. if (item.slot == 'tool') {
  25. blueprint.noStats = true;
  26. blueprint.noName = true;
  27. }
  28. }
  29. }
  30. });