//check to see boss status, killed or not killed public bool IsBossKilled() { bool result = false; if (currentQuest.GetType() == typeof(BossQuest)) { BossQuest temp = (BossQuest)currentQuest; result = temp.IsBossKilled(); } return(result); }
//change boss status for boss quest public void UpdateBossStatus() { if (currentQuest.GetType() == typeof(BossQuest)) { BossQuest temp = (BossQuest)currentQuest; temp.SetBossKilled(); UpdateQuestStatus(); if (currentQuest.getQuestStatus() == "completed") { finalScore += currentQuest.Score; } } }
//check to see that is player arrive at quest destination or not public bool IsArrive(int key) { bool arrived = false; if (currentQuest.GetType() == typeof(MapQuest)) { MapQuest temp = (MapQuest)currentQuest; arrived = temp.IsInDestination(key); } else if (currentQuest.GetType() == typeof(BossQuest)) { BossQuest temp = (BossQuest)currentQuest; arrived = temp.IsInDestination(key); } return(arrived); }
public void Initial() { /*FindingQuest temp = new FindingQuest(0, "Help Friend", "Go and rescue your friend", "incomplete", 100, 33); * temp.addItemQuest(new ItemQuest(1, "box", false, Spawn.one)); * temp.addItemQuest(new ItemQuest(2, "box", false, Spawn.one)); * temp.addItemQuest(new ItemQuest(3, "box", false, Spawn.one)); * temp.addItemQuest(new ItemQuest(4, "box", false, Spawn.one)); * temp.addMap(new int[]{5,11}); * temp.randomItems(); * temp.AddConversationMap(2, false); * questList.Add(0, temp); * * questList.Add(1, new MapQuest(1, "Find the way out", "Find the main door of the building", "incomplete", 30, 0, 33)); * * Quest temp2 = new Quest(2, "Contact authority", "Find the way to contact authority for help", "incomplete", 100); * temp2.AddConversationMap(5, false); * questList.Add(2, temp2); * * BossQuest temp3 = new BossQuest(3, "Fight the boss", "Go to the boss room and beat him", "incomplete", 200, 30, false); * temp3.AddConversationMap(30, false); * questList.Add(3, temp3);*/ //A00 - prologue MapQuest temp = new MapQuest(0, "Find the way out", "Avoid detection and escape from this place", "incomplete", 100, 0, 2); temp.AddConversationMap(1, false); temp.AddConversationMap(3, false); temp.AddConversationMap(4, false); temp.AddConversationMap(5, false); temp.AddConversationMap(10, false); questList.Add(0, temp); temp = new MapQuest(1, "A girl is the victim", "help a girl without alert ", "incomplete", 100, 4, 4); temp.AddConversationMap(3, false); questList.Add(1, temp); //A01 temp = new MapQuest(2, "Help your friends", "Investigate the cell room and help your friend", "incomplete", 200, 3, 21); temp.AddConversationMap(22, false); questList.Add(2, temp); //A02 temp = new MapQuest(3, "Find the useful information", "Go to the document room and find the useful information for escape", "incomplete", 100, 3, 12); temp.AddConversationMap(13, false); questList.Add(3, temp); //B01 temp = new MapQuest(4, "Contact Authority for help", "Sneak to the control room and find a way to contact authority", "incomplete", 300, 0, 10); temp.AddConversationMap(11, false); questList.Add(4, temp); //B02_1 temp = new MapQuest(5, "Find Amata", "Go to the destination point to see Amata", "incomplete", 100, 21, 17); temp.AddConversationMap(18, false); questList.Add(5, temp); //B02_2 temp = new MapQuest(6, "Searching for Amata", "Locate and find Amata", "incomplete", 100, 17, 13); temp.AddConversationMap(13, false); questList.Add(6, temp); //B03 FindingQuest temp2 = new FindingQuest(7, "Sabotage trafficker shipment", "Find the item for destroy the trafficker shipment", "incomplete", 400, 22); temp2.addItemQuest(new ItemQuest(1, "wood", false, Spawn.one)); temp2.addItemQuest(new ItemQuest(2, "wood", false, Spawn.one)); temp2.addItemQuest(new ItemQuest(3, "paper", false, Spawn.one)); temp2.addItemQuest(new ItemQuest(4, "paper", false, Spawn.one)); temp2.addItemQuest(new ItemQuest(5, "match", false, Spawn.one)); temp2.addMap(new int[] { 5, 7, 9, 20, 24 }); temp2.randomItems(); temp2.AddConversationMap(23, false); questList.Add(7, temp2); //C01 temp = new MapQuest(8, "Find the exit door", "Find the exit door to escape from this place", "incomplete", 200, 0, 35); temp.AddConversationMap(38, false); questList.Add(8, temp); //C02 BossQuest temp3 = new BossQuest(9, "Fight the boss", "Go to the boss room and beat him", "incomplete", 500, 30, false); temp3.AddConversationMap(30, false); questList.Add(9, temp3); //C03 temp = new MapQuest(10, "Find hiding place", "Find the room for hiding until authority arrived", "incomplete", 200, 10, 26); temp.AddConversationMap(27, false); questList.Add(10, temp); //A01sub1 }
public Quest createRandomQuest(List <GameObject> players, GameManager GM, bool allowAND = true, QuestTypes[] usedQuests = null) { //return new ORQuest(new FollowQuest(players, GM), new SurviveQuest(players, GM)); playerCount = players.Count; counter++; if (counter == 1) { return(new ANDQuest(new RacingQuest(players, GM), new JumpQuest(players, GM))); } if (counter == 2) { return(new ORQuest(new FollowQuest(players, GM), new KillQuest(players, GM))); } if (counter == 3) { return(new ANDQuest(new BossQuest(players, GM), new NOTQuest(new SurviveQuest(players, GM)))); } if (counter == 4) { return(new CompoundQuest(new CollectQuest(players, GM), new KillQuest(players, GM), new BossQuest(players, GM))); } if (counter == 5) { return(new ANDQuest(new LocationQuest(players, GM), new GuardQuest(players, GM))); } if (counter == 6) { return(new ANDQuest(new RacingQuest(players, GM), new NOTQuest(new JumpQuest(players, GM)))); } if (counter == 7) { return(new ORQuest(new BossQuest(players, GM), new NOTQuest(new KillQuest(players, GM)))); } if (counter == 8) { return(new CompoundQuest(new CollectQuest(players, GM), new KillQuest(players, GM), new SurviveQuest(players, GM))); } //return new RacingQuest(players, GM); //return new SurviveQuest(players, GM); //return new GuardQuest(players, GM); //return new FollowQuest(players, GM); //return new BossQuest(players, GM); if (allowAND) { // questindex = 0; //return new CompoundQuest(players, GM); //return new ANDQuest(players, GM); //return new NOTQuest( new KillQuest(players, GM) ); } if (questindex == 0) { questindex++; return(new GuardQuest(players, GM)); } else if (questindex == 1) { questindex++; return(new CollectQuest(players, GM)); } else if (questindex == 2) { questindex++; return(new SurviveQuest(players, GM)); } float rand = (float)new sysRand().NextDouble(); bool choseANDORQuest = true; if (rand < 0.2f) { choseANDORQuest = false; //low chance of atomic quest (20%) } if (allowAND && choseANDORQuest) //the quest should be AND/OR/Compound //Debug.Log("creating random AND/OR/Compound quest"); { int randType = new sysRand().Next(0, 3); if (randType == 0) { return(new ANDQuest(players, GM)); } else if (randType == 1) { return(new ORQuest(players, GM)); } else if (randType == 2) { return(new CompoundQuest(players, GM)); } else { Debug.Log("overflow in chosing AND/OR/CompoundQuest"); } } else //can be anything other than (AND/OR/Compound) //Debug.Log("creating random atomic quest"); { QuestTypes[] availableTypes = findAvailableTypes(usedQuests);//available quests other than AND/OR/NOT/Compound string typesS = ""; foreach (QuestTypes qt in availableTypes) { typesS += "" + qt + ", "; } //Debug.Log("available types: " + typesS); //int randIndex = Random.Range(0, availableTypes.Length); int randIndex = new sysRand().Next(0, availableTypes.Length); QuestTypes currQuestType = availableTypes[randIndex]; Quest chosenQuest = generateQuestByType(players, GM, currQuestType); //rand = Random.Range(0f, 1f); rand = (float)new sysRand().NextDouble(); //Debug.Log("rand: "+rand); if (rand < 0.2f) //make a not quest { chosenQuest = new NOTQuest(chosenQuest); } return(chosenQuest); } //if execution reaches this point then we wern't able to create the quest Debug.Log("quest creation by table failed, returning to default behaviur"); Quest createdQuest = null; //createdQuest = new LocationQuest(players, GM); //createdQuest = new CollectQuest(players, GM); //createdQuest = new KillQuest(players, GM); createdQuest = new BossQuest(players, GM); /* * int randomInt = Random.Range(0, 5); * * switch (randomInt) { * case 0: * createdQuest = new LocationQuest(players,GM); * break; * case 1: * createdQuest = new KillQuest(players, GM); * break; * case 2: * createdQuest = new SurviveQuest(players, GM); * break; * case 3: * createdQuest = new CondQuest(players, GM); * break; * case 4: * createdQuest = new ANDQuest(players, GM); * break; * case 5: * createdQuest = new ORQuest(players, GM); * break; * * } */ if (createdQuest == null) { Debug.Log("couldn't create quest, returning null quest"); } return(createdQuest); }