QuestCreatorHelper.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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. }
  20. private static void CreateCombatQuests()
  21. {
  22. EnsureFolderExists("Assets/Resources/Quests/Combat");
  23. // Easy Combat Quest
  24. var banditCamp = ScriptableObject.CreateInstance<Quest>();
  25. banditCamp.questTitle = "Clear the Bandit Camp";
  26. 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.";
  27. banditCamp.questType = QuestType.Combat;
  28. banditCamp.difficulty = QuestDifficulty.Easy;
  29. banditCamp.timeLimitDays = 5;
  30. banditCamp.targetAreaName = "Darkwood Forest";
  31. banditCamp.targetMapPosition = new Vector2Int(45, 60);
  32. banditCamp.goldReward = 75;
  33. banditCamp.renownReward = 10;
  34. banditCamp.renownPenalty = 5;
  35. banditCamp.questTags = new string[] { "combat", "bandits", "forest", "easy" };
  36. banditCamp.goals.Add(new QuestGoal
  37. {
  38. description = "Defeat 3 Bandits",
  39. goalType = QuestGoalType.KillEnemies,
  40. targetName = "Bandit",
  41. targetCount = 3
  42. });
  43. banditCamp.goals.Add(new QuestGoal
  44. {
  45. description = "Defeat the Bandit Leader",
  46. goalType = QuestGoalType.DefeatBoss,
  47. targetName = "Bandit Chief",
  48. targetCount = 1
  49. });
  50. AssetDatabase.CreateAsset(banditCamp, "Assets/Resources/Quests/Combat/ClearBanditCamp.asset");
  51. // Hard Combat Quest
  52. var orcRaid = ScriptableObject.CreateInstance<Quest>();
  53. orcRaid.questTitle = "Orc Warband Threat";
  54. 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.";
  55. orcRaid.questType = QuestType.Combat;
  56. orcRaid.difficulty = QuestDifficulty.Hard;
  57. orcRaid.timeLimitDays = 3;
  58. orcRaid.timeLimitHours = 12;
  59. orcRaid.targetAreaName = "Ironback Mountains";
  60. orcRaid.targetMapPosition = new Vector2Int(80, 30);
  61. orcRaid.goldReward = 200;
  62. orcRaid.renownReward = 25;
  63. orcRaid.renownPenalty = 15;
  64. orcRaid.minimumRenown = 15;
  65. orcRaid.questTags = new string[] { "combat", "orcs", "mountains", "hard" };
  66. orcRaid.goals.Add(new QuestGoal
  67. {
  68. description = "Defeat 8 Orc Warriors",
  69. goalType = QuestGoalType.KillEnemies,
  70. targetName = "Orc Warrior",
  71. targetCount = 8
  72. });
  73. orcRaid.goals.Add(new QuestGoal
  74. {
  75. description = "Defeat the Orc Warchief",
  76. goalType = QuestGoalType.DefeatBoss,
  77. targetName = "Orc Warchief",
  78. targetCount = 1
  79. });
  80. AssetDatabase.CreateAsset(orcRaid, "Assets/Resources/Quests/Combat/OrcWarbandThreat.asset");
  81. }
  82. private static void CreateRescueQuests()
  83. {
  84. EnsureFolderExists("Assets/Resources/Quests/Rescue");
  85. // Missing Merchant
  86. var missingMerchant = ScriptableObject.CreateInstance<Quest>();
  87. missingMerchant.questTitle = "Missing Merchant";
  88. 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.";
  89. missingMerchant.questType = QuestType.Rescue;
  90. missingMerchant.difficulty = QuestDifficulty.Normal;
  91. missingMerchant.timeLimitDays = 7;
  92. missingMerchant.targetAreaName = "Whispering Hills";
  93. missingMerchant.targetMapPosition = new Vector2Int(65, 45);
  94. missingMerchant.goldReward = 120;
  95. missingMerchant.renownReward = 15;
  96. missingMerchant.renownPenalty = 10;
  97. missingMerchant.questTags = new string[] { "rescue", "merchant", "hills", "normal" };
  98. missingMerchant.goals.Add(new QuestGoal
  99. {
  100. description = "Find Merchant Harold",
  101. goalType = QuestGoalType.RescuePerson,
  102. targetName = "Harold",
  103. targetCount = 1
  104. });
  105. missingMerchant.goals.Add(new QuestGoal
  106. {
  107. description = "Escort Harold to safety",
  108. goalType = QuestGoalType.ReachLocation,
  109. targetName = "Safe Location",
  110. targetCount = 1
  111. });
  112. AssetDatabase.CreateAsset(missingMerchant, "Assets/Resources/Quests/Rescue/MissingMerchant.asset");
  113. // Kidnapped Noble
  114. var kidnappedNoble = ScriptableObject.CreateInstance<Quest>();
  115. kidnappedNoble.questTitle = "The Baron's Daughter";
  116. 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.";
  117. kidnappedNoble.questType = QuestType.Rescue;
  118. kidnappedNoble.difficulty = QuestDifficulty.Hard;
  119. kidnappedNoble.timeLimitDays = 2;
  120. kidnappedNoble.targetAreaName = "Cursed Ruins";
  121. kidnappedNoble.targetMapPosition = new Vector2Int(25, 75);
  122. kidnappedNoble.goldReward = 300;
  123. kidnappedNoble.renownReward = 30;
  124. kidnappedNoble.renownPenalty = 20;
  125. kidnappedNoble.minimumRenown = 20;
  126. kidnappedNoble.questTags = new string[] { "rescue", "noble", "cultists", "urgent" };
  127. kidnappedNoble.goals.Add(new QuestGoal
  128. {
  129. description = "Infiltrate the cultist stronghold",
  130. goalType = QuestGoalType.ReachLocation,
  131. targetName = "Cultist Hideout",
  132. targetCount = 1
  133. });
  134. kidnappedNoble.goals.Add(new QuestGoal
  135. {
  136. description = "Defeat the Cult Leader",
  137. goalType = QuestGoalType.DefeatBoss,
  138. targetName = "Cult Leader",
  139. targetCount = 1
  140. });
  141. kidnappedNoble.goals.Add(new QuestGoal
  142. {
  143. description = "Rescue Lady Elara",
  144. goalType = QuestGoalType.RescuePerson,
  145. targetName = "Lady Elara",
  146. targetCount = 1
  147. });
  148. AssetDatabase.CreateAsset(kidnappedNoble, "Assets/Resources/Quests/Rescue/BaronsDaughter.asset");
  149. }
  150. private static void CreateRetrievalQuests()
  151. {
  152. EnsureFolderExists("Assets/Resources/Quests/Retrieval");
  153. // Stolen Goods
  154. var stolenGoods = ScriptableObject.CreateInstance<Quest>();
  155. stolenGoods.questTitle = "Recover the Stolen Shipment";
  156. 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.";
  157. stolenGoods.questType = QuestType.Retrieval;
  158. stolenGoods.difficulty = QuestDifficulty.Normal;
  159. stolenGoods.timeLimitDays = 4;
  160. stolenGoods.targetAreaName = "Smuggler's Cove";
  161. stolenGoods.targetMapPosition = new Vector2Int(90, 20);
  162. stolenGoods.goldReward = 150;
  163. stolenGoods.renownReward = 12;
  164. stolenGoods.renownPenalty = 8;
  165. stolenGoods.questTags = new string[] { "retrieval", "thieves", "shipment", "normal" };
  166. stolenGoods.goals.Add(new QuestGoal
  167. {
  168. description = "Recover the stolen goods",
  169. goalType = QuestGoalType.CollectItems,
  170. targetName = "Stolen Shipment",
  171. targetCount = 3
  172. });
  173. stolenGoods.goals.Add(new QuestGoal
  174. {
  175. description = "Defeat the Thief Leader (Optional)",
  176. goalType = QuestGoalType.DefeatBoss,
  177. targetName = "Thief Captain",
  178. targetCount = 1,
  179. isOptional = true
  180. });
  181. AssetDatabase.CreateAsset(stolenGoods, "Assets/Resources/Quests/Retrieval/StolenShipment.asset");
  182. // Ancient Artifact
  183. var ancientArtifact = ScriptableObject.CreateInstance<Quest>();
  184. ancientArtifact.questTitle = "The Lost Grimoire";
  185. 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.";
  186. ancientArtifact.questType = QuestType.Retrieval;
  187. ancientArtifact.difficulty = QuestDifficulty.Legendary;
  188. ancientArtifact.timeLimitDays = 10;
  189. ancientArtifact.targetAreaName = "Ancient Ruins";
  190. ancientArtifact.targetMapPosition = new Vector2Int(15, 85);
  191. ancientArtifact.goldReward = 500;
  192. ancientArtifact.renownReward = 50;
  193. ancientArtifact.renownPenalty = 25;
  194. ancientArtifact.minimumRenown = 40;
  195. ancientArtifact.itemRewards = new List<string> { "Magical Staff", "Enchanted Robes" };
  196. ancientArtifact.questTags = new string[] { "retrieval", "artifact", "ruins", "legendary" };
  197. ancientArtifact.goals.Add(new QuestGoal
  198. {
  199. description = "Navigate the ancient ruins",
  200. goalType = QuestGoalType.ReachLocation,
  201. targetName = "Inner Sanctum",
  202. targetCount = 1
  203. });
  204. ancientArtifact.goals.Add(new QuestGoal
  205. {
  206. description = "Defeat the Guardian Construct",
  207. goalType = QuestGoalType.DefeatBoss,
  208. targetName = "Stone Guardian",
  209. targetCount = 1
  210. });
  211. ancientArtifact.goals.Add(new QuestGoal
  212. {
  213. description = "Retrieve the Lost Grimoire",
  214. goalType = QuestGoalType.CollectItems,
  215. targetName = "Ancient Grimoire",
  216. targetCount = 1
  217. });
  218. AssetDatabase.CreateAsset(ancientArtifact, "Assets/Resources/Quests/Retrieval/LostGrimoire.asset");
  219. }
  220. private static void CreateExplorationQuests()
  221. {
  222. EnsureFolderExists("Assets/Resources/Quests/Exploration");
  223. // Map the Region
  224. var mapRegion = ScriptableObject.CreateInstance<Quest>();
  225. mapRegion.questTitle = "Survey the Northern Territories";
  226. mapRegion.questDescription = "The northern territories remain largely unmapped. Explore the region and report back with your findings to help future expeditions.";
  227. mapRegion.questType = QuestType.Exploration;
  228. mapRegion.difficulty = QuestDifficulty.Easy;
  229. mapRegion.timeLimitDays = 14;
  230. mapRegion.targetAreaName = "Northern Wilderness";
  231. mapRegion.targetMapPosition = new Vector2Int(50, 90);
  232. mapRegion.goldReward = 80;
  233. mapRegion.renownReward = 8;
  234. mapRegion.renownPenalty = 3;
  235. mapRegion.questTags = new string[] { "exploration", "survey", "wilderness", "easy" };
  236. mapRegion.goals.Add(new QuestGoal
  237. {
  238. description = "Explore 5 different locations",
  239. goalType = QuestGoalType.ReachLocation,
  240. targetName = "Exploration Point",
  241. targetCount = 5
  242. });
  243. mapRegion.goals.Add(new QuestGoal
  244. {
  245. description = "Survive for 7 days in the wilderness",
  246. goalType = QuestGoalType.SurviveTime,
  247. targetName = "Wilderness",
  248. targetCount = 7
  249. });
  250. AssetDatabase.CreateAsset(mapRegion, "Assets/Resources/Quests/Exploration/SurveyNorthern.asset");
  251. }
  252. private static void EnsureFolderExists(string path)
  253. {
  254. string[] folders = path.Split('/');
  255. string currentPath = "";
  256. for (int i = 0; i < folders.Length; i++)
  257. {
  258. if (i == 0)
  259. {
  260. currentPath = folders[i];
  261. continue;
  262. }
  263. string parentPath = currentPath;
  264. currentPath += "/" + folders[i];
  265. if (!AssetDatabase.IsValidFolder(currentPath))
  266. {
  267. AssetDatabase.CreateFolder(parentPath, folders[i]);
  268. }
  269. }
  270. }
  271. #endif
  272. }