SampleItemCreator.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using UnityEngine;
  2. public class SampleItemCreator : MonoBehaviour
  3. {
  4. [Header("Create Sample Items")]
  5. [SerializeField] private bool createSampleItems = false;
  6. void Start()
  7. {
  8. if (createSampleItems)
  9. {
  10. CreateSampleWeapons();
  11. CreateSampleArmor();
  12. CreateSampleMiscItems();
  13. }
  14. }
  15. [ContextMenu("Create Sample Weapons")]
  16. void CreateSampleWeapons()
  17. {
  18. // Simple Sword
  19. var simpleSword = ScriptableObject.CreateInstance<WeaponItem>();
  20. simpleSword.itemName = "Simple Sword";
  21. simpleSword.description = "A basic sword for beginners.";
  22. simpleSword.minDamage = 1;
  23. simpleSword.maxDamage = 6;
  24. simpleSword.range = 2;
  25. simpleSword.weaponModifier = 0;
  26. simpleSword.attackSpeed = 1.0f;
  27. simpleSword.weaponType = WeaponType.Sword;
  28. simpleSword.weaponClassName = "SimpleSword";
  29. simpleSword.goldCost = 10;
  30. simpleSword.searchTags = new string[] { "sword", "melee", "blade", "basic" };
  31. // Simple Bow
  32. var simpleBow = ScriptableObject.CreateInstance<WeaponItem>();
  33. simpleBow.itemName = "Simple Bow";
  34. simpleBow.description = "A basic bow for shooting arrows.";
  35. simpleBow.minDamage = 1;
  36. simpleBow.maxDamage = 6;
  37. simpleBow.range = 100;
  38. simpleBow.weaponModifier = 0;
  39. simpleBow.attackSpeed = 2.0f;
  40. simpleBow.weaponType = WeaponType.Bow;
  41. simpleBow.weaponClassName = "SimpleBow";
  42. simpleBow.goldCost = 15;
  43. simpleBow.searchTags = new string[] { "bow", "ranged", "arrow", "basic" };
  44. // Iron Sword (upgraded)
  45. var ironSword = ScriptableObject.CreateInstance<WeaponItem>();
  46. ironSword.itemName = "Iron Sword";
  47. ironSword.description = "A well-crafted iron sword with better balance.";
  48. ironSword.minDamage = 2;
  49. ironSword.maxDamage = 8;
  50. ironSword.range = 2;
  51. ironSword.weaponModifier = 1;
  52. ironSword.attackSpeed = 1.0f;
  53. ironSword.weaponType = WeaponType.Sword;
  54. ironSword.weaponClassName = "SimpleSword"; // Still uses SimpleSword for now
  55. ironSword.rarity = ItemRarity.Uncommon;
  56. ironSword.goldCost = 25;
  57. ironSword.searchTags = new string[] { "sword", "melee", "blade", "iron", "metal" };
  58. // Composite Bow (upgraded)
  59. var compositeBow = ScriptableObject.CreateInstance<WeaponItem>();
  60. compositeBow.itemName = "Composite Bow";
  61. compositeBow.description = "A bow made of multiple materials for increased power.";
  62. compositeBow.minDamage = 2;
  63. compositeBow.maxDamage = 8;
  64. compositeBow.range = 120;
  65. compositeBow.weaponModifier = 1;
  66. compositeBow.attackSpeed = 1.8f;
  67. compositeBow.weaponType = WeaponType.Bow;
  68. compositeBow.weaponClassName = "SimpleBow"; // Still uses SimpleBow for now
  69. compositeBow.rarity = ItemRarity.Uncommon;
  70. compositeBow.goldCost = 35;
  71. compositeBow.searchTags = new string[] { "bow", "ranged", "arrow", "composite" };
  72. Debug.Log("Sample weapons created (in memory only - save as assets to persist)");
  73. }
  74. [ContextMenu("Create Sample Armor")]
  75. void CreateSampleArmor()
  76. {
  77. // Leather Helmet
  78. var leatherHelmet = ScriptableObject.CreateInstance<ArmorItem>();
  79. leatherHelmet.itemName = "Leather Helmet";
  80. leatherHelmet.description = "Basic head protection made of leather.";
  81. leatherHelmet.armorClass = 1;
  82. leatherHelmet.armorType = ArmorType.Light;
  83. leatherHelmet.armorSlot = ArmorSlot.Head;
  84. leatherHelmet.goldCost = 5;
  85. leatherHelmet.searchTags = new string[] { "helmet", "head", "leather", "light" };
  86. // Leather Vest
  87. var leatherVest = ScriptableObject.CreateInstance<ArmorItem>();
  88. leatherVest.itemName = "Leather Vest";
  89. leatherVest.description = "A simple leather vest providing basic protection.";
  90. leatherVest.armorClass = 2;
  91. leatherVest.dexterityModifier = 1;
  92. leatherVest.armorType = ArmorType.Light;
  93. leatherVest.armorSlot = ArmorSlot.Chest;
  94. leatherVest.goldCost = 12;
  95. leatherVest.searchTags = new string[] { "vest", "chest", "leather", "light" };
  96. // Iron Chainmail
  97. var ironChainmail = ScriptableObject.CreateInstance<ArmorItem>();
  98. ironChainmail.itemName = "Iron Chainmail";
  99. ironChainmail.description = "Chainmail made of iron rings, offering good protection.";
  100. ironChainmail.armorClass = 4;
  101. ironChainmail.dexterityModifier = -1;
  102. ironChainmail.armorType = ArmorType.Medium;
  103. ironChainmail.armorSlot = ArmorSlot.Chest;
  104. ironChainmail.rarity = ItemRarity.Uncommon;
  105. ironChainmail.goldCost = 30;
  106. ironChainmail.searchTags = new string[] { "chainmail", "chest", "iron", "medium", "mail" };
  107. Debug.Log("Sample armor created (in memory only - save as assets to persist)");
  108. }
  109. [ContextMenu("Create Sample Misc Items")]
  110. void CreateSampleMiscItems()
  111. {
  112. // Health Potion
  113. var healthPotion = ScriptableObject.CreateInstance<MiscellaneousItem>();
  114. healthPotion.itemName = "Health Potion";
  115. healthPotion.description = "Restores 15 health points when consumed.";
  116. healthPotion.isConsumable = true;
  117. healthPotion.isStackable = true;
  118. healthPotion.maxStackSize = 10;
  119. healthPotion.healthDiceType = 6;
  120. healthPotion.healthDiceCount = 1;
  121. healthPotion.healthBonus = 1;
  122. healthPotion.goldCost = 4;
  123. healthPotion.searchTags = new string[] { "potion", "health", "healing", "consumable" };
  124. // Rope
  125. var rope = ScriptableObject.CreateInstance<MiscellaneousItem>();
  126. rope.itemName = "Hemp Rope";
  127. rope.description = "50 feet of sturdy hemp rope.";
  128. rope.isConsumable = false;
  129. rope.isStackable = true;
  130. rope.maxStackSize = 5;
  131. rope.silverCost = 8;
  132. rope.searchTags = new string[] { "rope", "hemp", "utility", "tool" };
  133. Debug.Log("Sample miscellaneous items created (in memory only - save as assets to persist)");
  134. }
  135. }