CreateSampleItems.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. using UnityEngine;
  2. using UnityEditor;
  3. public class CreateSampleItems
  4. {
  5. [MenuItem("RPG/Create Sample Items")]
  6. public static void CreateItems()
  7. {
  8. // Create weapon items
  9. CreateSimpleSword();
  10. CreateSimpleBow();
  11. CreateIronSword();
  12. // Create armor items
  13. CreateLeatherArmor();
  14. CreateIronChainmail();
  15. // Create miscellaneous items
  16. CreateHealthPotion();
  17. CreateManaPotion();
  18. CreateHempRope();
  19. AssetDatabase.SaveAssets();
  20. AssetDatabase.Refresh();
  21. }
  22. private static void CreateSimpleSword()
  23. {
  24. var sword = ScriptableObject.CreateInstance<WeaponItem>();
  25. sword.itemName = "Simple Sword";
  26. sword.description = "A basic sword perfect for beginners. Light and easy to handle.";
  27. sword.itemType = ItemType.Weapon;
  28. sword.rarity = ItemRarity.Common;
  29. sword.goldCost = 10;
  30. sword.minDamage = 1;
  31. sword.maxDamage = 6;
  32. sword.range = 5; // Melee range
  33. sword.weaponModifier = 0;
  34. sword.attackSpeed = 1.0f;
  35. sword.weaponType = WeaponType.Sword;
  36. sword.searchTags = new string[] { "sword", "melee", "blade", "basic", "one-handed" };
  37. AssetDatabase.CreateAsset(sword, "Assets/Resources/Items/Weapons/SimpleSword.asset");
  38. }
  39. private static void CreateSimpleBow()
  40. {
  41. var bow = ScriptableObject.CreateInstance<WeaponItem>();
  42. bow.itemName = "Simple Bow";
  43. bow.description = "A basic wooden bow with decent range. Perfect for hunting small game.";
  44. bow.itemType = ItemType.Weapon;
  45. bow.rarity = ItemRarity.Common;
  46. bow.goldCost = 15;
  47. bow.minDamage = 1;
  48. bow.maxDamage = 4;
  49. bow.range = 150;
  50. bow.weaponModifier = 0;
  51. bow.attackSpeed = 0.8f;
  52. bow.weaponType = WeaponType.Bow;
  53. bow.searchTags = new string[] { "bow", "ranged", "arrow", "hunting", "wood" };
  54. AssetDatabase.CreateAsset(bow, "Assets/Resources/Items/Weapons/SimpleBow.asset");
  55. }
  56. private static void CreateIronSword()
  57. {
  58. var sword = ScriptableObject.CreateInstance<WeaponItem>();
  59. sword.itemName = "Iron Sword";
  60. sword.description = "A well-crafted iron sword. Durable and sharp, favored by town guards.";
  61. sword.itemType = ItemType.Weapon;
  62. sword.rarity = ItemRarity.Uncommon;
  63. sword.goldCost = 25;
  64. sword.minDamage = 2;
  65. sword.maxDamage = 8;
  66. sword.range = 5;
  67. sword.weaponModifier = 1;
  68. sword.attackSpeed = 1.0f;
  69. sword.weaponType = WeaponType.Sword;
  70. sword.searchTags = new string[] { "sword", "melee", "blade", "iron", "guard", "military" };
  71. AssetDatabase.CreateAsset(sword, "Assets/Resources/Items/Weapons/IronSword.asset");
  72. }
  73. private static void CreateLeatherArmor()
  74. {
  75. var armor = ScriptableObject.CreateInstance<ArmorItem>();
  76. armor.itemName = "Leather Armor";
  77. armor.description = "Simple leather protection that doesn't restrict movement.";
  78. armor.itemType = ItemType.Armor;
  79. armor.rarity = ItemRarity.Common;
  80. armor.goldCost = 12;
  81. armor.armorClass = 1;
  82. armor.armorType = ArmorType.Light;
  83. armor.armorSlot = ArmorSlot.Chest;
  84. armor.dexterityModifier = 0; // No penalty for light armor
  85. armor.searchTags = new string[] { "leather", "armor", "chest", "light", "flexible" };
  86. AssetDatabase.CreateAsset(armor, "Assets/Resources/Items/Armor/LeatherArmor.asset");
  87. }
  88. private static void CreateIronChainmail()
  89. {
  90. var armor = ScriptableObject.CreateInstance<ArmorItem>();
  91. armor.itemName = "Iron Chainmail";
  92. armor.description = "Interlocking iron rings provide solid protection.";
  93. armor.itemType = ItemType.Armor;
  94. armor.rarity = ItemRarity.Uncommon;
  95. armor.goldCost = 30;
  96. armor.armorClass = 2;
  97. armor.armorType = ArmorType.Medium;
  98. armor.armorSlot = ArmorSlot.Chest;
  99. armor.dexterityModifier = -1; // Medium armor restricts movement slightly
  100. armor.searchTags = new string[] { "chainmail", "armor", "chest", "medium", "iron", "metal" };
  101. AssetDatabase.CreateAsset(armor, "Assets/Resources/Items/Armor/IronChainmail.asset");
  102. }
  103. private static void CreateHealthPotion()
  104. {
  105. var potion = ScriptableObject.CreateInstance<MiscellaneousItem>();
  106. potion.itemName = "Health Potion";
  107. potion.description = "A red liquid that restores vitality when consumed.";
  108. potion.itemType = ItemType.Consumable;
  109. potion.rarity = ItemRarity.Common;
  110. potion.goldCost = 3;
  111. potion.isConsumable = true;
  112. potion.isStackable = true;
  113. potion.maxStackSize = 10;
  114. // Heals 1d6+1 (2-7 health)
  115. potion.healthDiceCount = 1;
  116. potion.healthDiceType = 6;
  117. potion.healthBonus = 1;
  118. potion.searchTags = new string[] { "potion", "health", "healing", "consumable", "red" };
  119. AssetDatabase.CreateAsset(potion, "Assets/Resources/Items/Miscellaneous/HealthPotion.asset");
  120. }
  121. private static void CreateManaPotion()
  122. {
  123. var potion = ScriptableObject.CreateInstance<MiscellaneousItem>();
  124. potion.itemName = "Mana Potion";
  125. potion.description = "A blue liquid that restores magical energy.";
  126. potion.itemType = ItemType.Consumable;
  127. potion.rarity = ItemRarity.Common;
  128. potion.goldCost = 4;
  129. potion.isConsumable = true;
  130. potion.isStackable = true;
  131. potion.maxStackSize = 10;
  132. // Restores 1d4 (1-4 mana)
  133. potion.manaDiceCount = 1;
  134. potion.manaDiceType = 4;
  135. potion.manaBonus = 0;
  136. potion.searchTags = new string[] { "potion", "mana", "magic", "consumable", "blue" };
  137. AssetDatabase.CreateAsset(potion, "Assets/Resources/Items/Miscellaneous/ManaPotion.asset");
  138. }
  139. private static void CreateHempRope()
  140. {
  141. var rope = ScriptableObject.CreateInstance<MiscellaneousItem>();
  142. rope.itemName = "Hemp Rope";
  143. rope.description = "50 feet of sturdy rope. Essential for any adventurer.";
  144. rope.itemType = ItemType.Tool;
  145. rope.rarity = ItemRarity.Common;
  146. rope.silverCost = 8;
  147. rope.isConsumable = false;
  148. rope.isStackable = false;
  149. rope.searchTags = new string[] { "rope", "hemp", "utility", "tool", "climbing" };
  150. AssetDatabase.CreateAsset(rope, "Assets/Resources/Items/Miscellaneous/HempRope.asset");
  151. }
  152. }