/// <summary> /// Spawns a random quests /// </summary> /// <param name="avoidTheseQuests">Quests to be avoided</param> /// <returns>Random quest</returns> public static ActiveQuest SpawnRandomQuest(IEnumerable <string> avoidTheseQuests) { List <string> questsToAvoid = avoidTheseQuests.ToList(); string randomQuestName = Quest.AllQuests.Keys.Where(key => key != Quest.HiddenQuestKey && !questsToAvoid.Contains(key)).ToList().GetRandom(); return(ActiveQuest.Create(randomQuestName)); }
/// <summary> /// Makes progress on a quest /// </summary> /// <param name="quest">Quest</param> /// <param name="additionalProgress">Progress added</param> public void ProgressQuest(ActiveQuest quest, int additionalProgress) { quest.Progress += additionalProgress; if (quest.Progress >= quest.Quest.MaximumProgress) { _gameSettings.Quests.LoseQuest(quest); AddPoints(quest.Quest.PointReward); _gameSettings.Statistics.QuestsCompleted++; } }
public static void CheckForNewQuests(IGameSettings settings) { int newQuestCount = (DateTime.Today - settings.Quests.LastQuestReceivedWhen.Date).Days; int slots = Quest.MaximumNumberOfQuests - settings.Quests.ActiveQuests.Count(); if (newQuestCount > slots) { newQuestCount = slots; } for (int i = 0; i < newQuestCount; i++) { ActiveQuest newQuest = Quest.SpawnRandomQuest(settings.Quests.ActiveQuests.Select(q => q.QuestID)); settings.Quests.AddQuest(newQuest); } settings.Quests.LastQuestReceivedWhen = DateTime.Now; }
/// <summary> /// Loses a quest /// </summary> /// <param name="quest">Quest</param> public void LoseQuest(ActiveQuest quest) { _gameSettings.Quests.LoseQuest(quest); }
/// <summary> /// Adds a quest /// </summary> /// <param name="quest">Quest</param> public void AddQuest(ActiveQuest quest) { _gameSettings.Quests.AddQuest(quest); }