void generateStartingAction() { int next_action = rnd1.Next(0, 3); if (next_action == 0) { this.subActions.Add(new Nothing()); } else { if (next_action == 1) { NPC npc = new NPC(); this.subActions.Add(new GoTo(npc)); this.subActions.Add(new Listen(npc)); if (SimpleQuest.GetSubquestGeneration()) { subQuest sq = new subQuest(); sq.quest.InitializeStartingStrategies(); sq.quest.InitializeObjects(); subActions.Add(sq); } this.subActions.Add(new Listen(npc)); } else { if (next_action == 2) { Item i = new Item(); this.subActions.Add(new GoTo(i)); this.subActions.Add(new Get(i)); this.subActions.Add(new Read(i)); } else { if (obj == null) { Item obj = new Item(); } NPC npc = new NPC(); this.subActions.Add(new Get(obj)); if (SimpleQuest.GetSubquestGeneration()) { subQuest sq = new subQuest(); sq.quest.InitializeStartingStrategies(); sq.quest.InitializeObjects(); subActions.Add(sq); } this.subActions.Add(new Give(obj)); this.subActions.Add(new Listen(npc)); } } } }
static void Main(string[] args) { try { SimpleQuest.Init(new Random(122412)); SimpleQuest.SetSubquestGeneration(true); WealthQuest q = new WealthQuest(); q.changeAmountOfStartingActions(4); q.InitializeStartingStrategies(); q.InitializeObjects(); q.DisplayQuest(); q.PrintAllObjects(); } catch (Exception e) { Console.WriteLine("{0}", e.GetBaseException()); } }
void generateStartingAction() { int current_action = rnd1.Next(0, 4); if (current_action == 0) { subActions.Add(new Nothing()); } else { if (current_action == 1) { subActions.Add(new Steal(obj)); } else { if (current_action == 2) { subActions.Add(new GoTo(obj)); subActions.Add(new Gather(obj)); } else { subActions.Add(new GoTo(obj)); subActions.Add(new Get(obj)); NPC npc = new NPC(); subActions.Add(new GoTo(npc)); if (SimpleQuest.GetSubquestGeneration()) { subQuest sq = new subQuest(); sq.quest.InitializeStartingStrategies(); sq.quest.InitializeObjects(); subActions.Add(sq); } subActions.Add(new Exchange(obj, npc)); } } } }
public subQuest() { this.name = "subQuest"; int action = rnd1.Next(0, Enum.GetNames(typeof(questType)).Length); if (action == 0) { quest = new KnowledgeQuest(); } if (action == 1) { quest = new ComfortQuest(); } if (action == 2) { quest = new ReputationQuest(); } if (action == 3) { quest = new SerenityQuest(); } if (action == 4) { quest = new ProtectionQuest(); } if (action == 5) { quest = new ConquestQuest(); } if (action == 6) { quest = new WealthQuest(); } if (action == 7) { quest = new EquipmentQuest(); } }