Exemplo n.º 1
0
        /// <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));
        }
Exemplo n.º 2
0
 /// <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++;
     }
 }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Loses a quest
 /// </summary>
 /// <param name="quest">Quest</param>
 public void LoseQuest(ActiveQuest quest)
 {
     _gameSettings.Quests.LoseQuest(quest);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Adds a quest
 /// </summary>
 /// <param name="quest">Quest</param>
 public void AddQuest(ActiveQuest quest)
 {
     _gameSettings.Quests.AddQuest(quest);
 }