QuestCreatorHelper.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. using UnityEngine;
  2. using UnityEditor;
  3. using System.Collections.Generic;
  4. /// <summary>
  5. /// Editor tool for creating sample quests - follows same pattern as CreateSampleItems
  6. /// </summary>
  7. public class QuestCreatorHelper
  8. {
  9. #if UNITY_EDITOR
  10. [MenuItem("RPG/Create Sample Quests")]
  11. public static void CreateSampleQuests()
  12. {
  13. CreateCombatQuests();
  14. CreateRescueQuests();
  15. CreateRetrievalQuests();
  16. CreateExplorationQuests();
  17. AssetDatabase.SaveAssets();
  18. AssetDatabase.Refresh();
  19. Debug.Log("✅ Sample quests created in Resources/Quests folder!");
  20. }
  21. private static void CreateCombatQuests()
  22. {
  23. EnsureFolderExists("Assets/Resources/Quests/Combat");
  24. // Easy Combat Quest
  25. var banditCamp = ScriptableObject.CreateInstance<Quest>();
  26. banditCamp.questTitle = "Clear the Bandit Camp";
  27. banditCamp.questDescription = "Bandits have been attacking merchants on the main road. Their camp has been spotted in the nearby forest. Clear them out and make the roads safe for trade.";
  28. banditCamp.questType = QuestType.Combat;
  29. banditCamp.difficulty = QuestDifficulty.Easy;
  30. banditCamp.timeLimitDays = 5;
  31. banditCamp.targetAreaName = "Darkwood Forest";
  32. banditCamp.targetMapPosition = new Vector2Int(45, 60);
  33. banditCamp.goldReward = 75;
  34. banditCamp.renownReward = 10;
  35. banditCamp.renownPenalty = 5;
  36. banditCamp.questTags = new string[] { "combat", "bandits", "forest", "easy" };
  37. banditCamp.goals.Add(new QuestGoal
  38. {
  39. description = "Defeat 3 Bandits",
  40. goalType = QuestGoalType.KillEnemies,
  41. targetName = "Bandit",
  42. targetCount = 3
  43. });
  44. banditCamp.goals.Add(new QuestGoal
  45. {
  46. description = "Defeat the Bandit Leader",
  47. goalType = QuestGoalType.DefeatBoss,
  48. targetName = "Bandit Chief",
  49. targetCount = 1
  50. });
  51. AssetDatabase.CreateAsset(banditCamp, "Assets/Resources/Quests/Combat/ClearBanditCamp.asset");
  52. // Hard Combat Quest
  53. var orcRaid = ScriptableObject.CreateInstance<Quest>();
  54. orcRaid.questTitle = "Orc Warband Threat";
  55. orcRaid.questDescription = "A large orc warband has been spotted moving toward the village. They must be stopped before they reach the settlement and cause havoc.";
  56. orcRaid.questType = QuestType.Combat;
  57. orcRaid.difficulty = QuestDifficulty.Hard;
  58. orcRaid.timeLimitDays = 3;
  59. orcRaid.timeLimitHours = 12;
  60. orcRaid.targetAreaName = "Ironback Mountains";
  61. orcRaid.targetMapPosition = new Vector2Int(80, 30);
  62. orcRaid.goldReward = 200;
  63. orcRaid.renownReward = 25;
  64. orcRaid.renownPenalty = 15;
  65. orcRaid.minimumRenown = 15;
  66. orcRaid.questTags = new string[] { "combat", "orcs", "mountains", "hard" };
  67. orcRaid.goals.Add(new QuestGoal
  68. {
  69. description = "Defeat 8 Orc Warriors",
  70. goalType = QuestGoalType.KillEnemies,
  71. targetName = "Orc Warrior",
  72. targetCount = 8
  73. });
  74. orcRaid.goals.Add(new QuestGoal
  75. {
  76. description = "Defeat the Orc Warchief",
  77. goalType = QuestGoalType.DefeatBoss,
  78. targetName = "Orc Warchief",
  79. targetCount = 1
  80. });
  81. AssetDatabase.CreateAsset(orcRaid, "Assets/Resources/Quests/Combat/OrcWarbandThreat.asset");
  82. }
  83. private static void CreateRescueQuests()
  84. {
  85. EnsureFolderExists("Assets/Resources/Quests/Rescue");
  86. // Missing Merchant
  87. var missingMerchant = ScriptableObject.CreateInstance<Quest>();
  88. missingMerchant.questTitle = "Missing Merchant";
  89. missingMerchant.questDescription = "Merchant Harold departed for the next town three days ago but never arrived. His family fears the worst. Find him and bring him home safely.";
  90. missingMerchant.questType = QuestType.Rescue;
  91. missingMerchant.difficulty = QuestDifficulty.Normal;
  92. missingMerchant.timeLimitDays = 7;
  93. missingMerchant.targetAreaName = "Whispering Hills";
  94. missingMerchant.targetMapPosition = new Vector2Int(65, 45);
  95. missingMerchant.goldReward = 120;
  96. missingMerchant.renownReward = 15;
  97. missingMerchant.renownPenalty = 10;
  98. missingMerchant.questTags = new string[] { "rescue", "merchant", "hills", "normal" };
  99. missingMerchant.goals.Add(new QuestGoal
  100. {
  101. description = "Find Merchant Harold",
  102. goalType = QuestGoalType.RescuePerson,
  103. targetName = "Harold",
  104. targetCount = 1
  105. });
  106. missingMerchant.goals.Add(new QuestGoal
  107. {
  108. description = "Escort Harold to safety",
  109. goalType = QuestGoalType.ReachLocation,
  110. targetName = "Safe Location",
  111. targetCount = 1
  112. });
  113. AssetDatabase.CreateAsset(missingMerchant, "Assets/Resources/Quests/Rescue/MissingMerchant.asset");
  114. // Kidnapped Noble
  115. var kidnappedNoble = ScriptableObject.CreateInstance<Quest>();
  116. kidnappedNoble.questTitle = "The Baron's Daughter";
  117. kidnappedNoble.questDescription = "Lady Elara, the Baron's daughter, has been kidnapped by cultists. Time is running short - rescue her before the dark ritual begins at midnight.";
  118. kidnappedNoble.questType = QuestType.Rescue;
  119. kidnappedNoble.difficulty = QuestDifficulty.Hard;
  120. kidnappedNoble.timeLimitDays = 2;
  121. kidnappedNoble.targetAreaName = "Cursed Ruins";
  122. kidnappedNoble.targetMapPosition = new Vector2Int(25, 75);
  123. kidnappedNoble.goldReward = 300;
  124. kidnappedNoble.renownReward = 30;
  125. kidnappedNoble.renownPenalty = 20;
  126. kidnappedNoble.minimumRenown = 20;
  127. kidnappedNoble.questTags = new string[] { "rescue", "noble", "cultists", "urgent" };
  128. kidnappedNoble.goals.Add(new QuestGoal
  129. {
  130. description = "Infiltrate the cultist stronghold",
  131. goalType = QuestGoalType.ReachLocation,
  132. targetName = "Cultist Hideout",
  133. targetCount = 1
  134. });
  135. kidnappedNoble.goals.Add(new QuestGoal
  136. {
  137. description = "Defeat the Cult Leader",
  138. goalType = QuestGoalType.DefeatBoss,
  139. targetName = "Cult Leader",
  140. targetCount = 1
  141. });
  142. kidnappedNoble.goals.Add(new QuestGoal
  143. {
  144. description = "Rescue Lady Elara",
  145. goalType = QuestGoalType.RescuePerson,
  146. targetName = "Lady Elara",
  147. targetCount = 1
  148. });
  149. AssetDatabase.CreateAsset(kidnappedNoble, "Assets/Resources/Quests/Rescue/BaronsDaughter.asset");
  150. }
  151. private static void CreateRetrievalQuests()
  152. {
  153. EnsureFolderExists("Assets/Resources/Quests/Retrieval");
  154. // Stolen Goods
  155. var stolenGoods = ScriptableObject.CreateInstance<Quest>();
  156. stolenGoods.questTitle = "Recover the Stolen Shipment";
  157. stolenGoods.questDescription = "Thieves made off with a valuable shipment of goods bound for the capital. Track them down and recover the stolen merchandise before they can sell it off.";
  158. stolenGoods.questType = QuestType.Retrieval;
  159. stolenGoods.difficulty = QuestDifficulty.Normal;
  160. stolenGoods.timeLimitDays = 4;
  161. stolenGoods.targetAreaName = "Smuggler's Cove";
  162. stolenGoods.targetMapPosition = new Vector2Int(90, 20);
  163. stolenGoods.goldReward = 150;
  164. stolenGoods.renownReward = 12;
  165. stolenGoods.renownPenalty = 8;
  166. stolenGoods.questTags = new string[] { "retrieval", "thieves", "shipment", "normal" };
  167. stolenGoods.goals.Add(new QuestGoal
  168. {
  169. description = "Recover the stolen goods",
  170. goalType = QuestGoalType.CollectItems,
  171. targetName = "Stolen Shipment",
  172. targetCount = 3
  173. });
  174. stolenGoods.goals.Add(new QuestGoal
  175. {
  176. description = "Defeat the Thief Leader (Optional)",
  177. goalType = QuestGoalType.DefeatBoss,
  178. targetName = "Thief Captain",
  179. targetCount = 1,
  180. isOptional = true
  181. });
  182. AssetDatabase.CreateAsset(stolenGoods, "Assets/Resources/Quests/Retrieval/StolenShipment.asset");
  183. // Ancient Artifact
  184. var ancientArtifact = ScriptableObject.CreateInstance<Quest>();
  185. ancientArtifact.questTitle = "The Lost Grimoire";
  186. ancientArtifact.questDescription = "An ancient grimoire containing powerful spells has been lost in the depths of the old ruins. Retrieve it before it falls into the wrong hands.";
  187. ancientArtifact.questType = QuestType.Retrieval;
  188. ancientArtifact.difficulty = QuestDifficulty.Legendary;
  189. ancientArtifact.timeLimitDays = 10;
  190. ancientArtifact.targetAreaName = "Ancient Ruins";
  191. ancientArtifact.targetMapPosition = new Vector2Int(15, 85);
  192. ancientArtifact.goldReward = 500;
  193. ancientArtifact.renownReward = 50;
  194. ancientArtifact.renownPenalty = 25;
  195. ancientArtifact.minimumRenown = 40;
  196. ancientArtifact.itemRewards = new List<string> { "Magical Staff", "Enchanted Robes" };
  197. ancientArtifact.questTags = new string[] { "retrieval", "artifact", "ruins", "legendary" };
  198. ancientArtifact.goals.Add(new QuestGoal
  199. {
  200. description = "Navigate the ancient ruins",
  201. goalType = QuestGoalType.ReachLocation,
  202. targetName = "Inner Sanctum",
  203. targetCount = 1
  204. });
  205. ancientArtifact.goals.Add(new QuestGoal
  206. {
  207. description = "Defeat the Guardian Construct",
  208. goalType = QuestGoalType.DefeatBoss,
  209. targetName = "Stone Guardian",
  210. targetCount = 1
  211. });
  212. ancientArtifact.goals.Add(new QuestGoal
  213. {
  214. description = "Retrieve the Lost Grimoire",
  215. goalType = QuestGoalType.CollectItems,
  216. targetName = "Ancient Grimoire",
  217. targetCount = 1
  218. });
  219. AssetDatabase.CreateAsset(ancientArtifact, "Assets/Resources/Quests/Retrieval/LostGrimoire.asset");
  220. }
  221. private static void CreateExplorationQuests()
  222. {
  223. EnsureFolderExists("Assets/Resources/Quests/Exploration");
  224. // Map the Region
  225. var mapRegion = ScriptableObject.CreateInstance<Quest>();
  226. mapRegion.questTitle = "Survey the Northern Territories";
  227. mapRegion.questDescription = "The northern territories remain largely unmapped. Explore the region and report back with your findings to help future expeditions.";
  228. mapRegion.questType = QuestType.Exploration;
  229. mapRegion.difficulty = QuestDifficulty.Easy;
  230. mapRegion.timeLimitDays = 14;
  231. mapRegion.targetAreaName = "Northern Wilderness";
  232. mapRegion.targetMapPosition = new Vector2Int(50, 90);
  233. mapRegion.goldReward = 80;
  234. mapRegion.renownReward = 8;
  235. mapRegion.renownPenalty = 3;
  236. mapRegion.questTags = new string[] { "exploration", "survey", "wilderness", "easy" };
  237. mapRegion.goals.Add(new QuestGoal
  238. {
  239. description = "Explore 5 different locations",
  240. goalType = QuestGoalType.ReachLocation,
  241. targetName = "Exploration Point",
  242. targetCount = 5
  243. });
  244. mapRegion.goals.Add(new QuestGoal
  245. {
  246. description = "Survive for 7 days in the wilderness",
  247. goalType = QuestGoalType.SurviveTime,
  248. targetName = "Wilderness",
  249. targetCount = 7
  250. });
  251. AssetDatabase.CreateAsset(mapRegion, "Assets/Resources/Quests/Exploration/SurveyNorthern.asset");
  252. }
  253. private static void EnsureFolderExists(string path)
  254. {
  255. string[] folders = path.Split('/');
  256. string currentPath = "";
  257. for (int i = 0; i < folders.Length; i++)
  258. {
  259. if (i == 0)
  260. {
  261. currentPath = folders[i];
  262. continue;
  263. }
  264. string parentPath = currentPath;
  265. currentPath += "/" + folders[i];
  266. if (!AssetDatabase.IsValidFolder(currentPath))
  267. {
  268. AssetDatabase.CreateFolder(parentPath, folders[i]);
  269. }
  270. }
  271. }
  272. #endif
  273. }