public static QuestInstance GenerateQuestInstance(IQuestSource questSource, int questDuration = 1) { QuestInstance quest = new QuestInstance(questSource); quest.DurationInDays = questDuration; quest.DifficultyLevel = questSource.QuestDifficulty; quest.QuestType = EnumUtility.GetRandomEnumValue <QuestTypes>(); return(quest); }
public static QuestInstance GenerateQuest(int difficulty, QuestMakeupType makeup) { string questName = NameDatabase.GetQuestName(); QuestInstance quest = new QuestInstance(questName, difficulty, QuestMakeup.GetMakeup(makeup)); quest.Duration.OriginalValue = UnityEngine.Random.Range(TimeUtilities.GetSecondsInDays(0.1f), TimeUtilities.GetSecondsInDays(0.4f)); quest.TravelTime.OriginalValue = UnityEngine.Random.Range(TimeUtilities.GetSecondsInDays(0.2f), TimeUtilities.GetSecondsInDays(0.4f)); quest.ExpireTime = UnityEngine.Random.Range(TimeUtilities.MIN_QUEST_EXPIRE_TIME, TimeUtilities.MAX_QUEST_EXPIRE_TIME); return(quest); }
public static QuestInstance GenerateQuestInstance(QuestSourceTypes forcedType) { int questDuration = m_QuestDurationChoser.GetRandomValue(); int itemRewardChance; IQuestReward additionalReward = null; IQuestSource qSource; switch (forcedType) { default: case QuestSourceTypes.FACTION: qSource = ReputationManager.GetRandomFaction(); QuestSourceFaction factionSource = qSource as QuestSourceFaction; itemRewardChance = 25; if (Random.Range(0, daysSinceHeroRecruit) == 0) { additionalReward = new QuestRewardHero(factionSource); daysSinceHeroRecruit = Random.Range(10, 20); } else if (Random.Range(0, daysSinceFactionRecruit) == 0) { additionalReward = new QuestRewardFaction(factionSource.AverageHeroLevel + Random.Range(3, 6)); daysSinceFactionRecruit = Random.Range(25, 35); } daysSinceHeroRecruit--; daysSinceFactionRecruit--; break; case QuestSourceTypes.PERSON: qSource = ReputationGenerator.GenerateReputationInstance(new QuestSourcePerson(EnumUtility.GetRandomEnumValue <ReputationBiases>())); itemRewardChance = 5; break; case QuestSourceTypes.RUMOR: qSource = ReputationGenerator.GenerateReputationInstance(new QuestSourceRumor()); itemRewardChance = 15; break; } QuestInstance quest = GenerateQuestInstance(qSource, questDuration); quest.AdditionalReward = additionalReward; quest.PartySize = m_PartySizeChoser.GetRandomValue(); if (Random.Range(0, itemRewardChance) == 0) { GameItem itemReward = GameItemGenerator.GenerateItem(GameItemTypes.UNKNOWN, GetItemRarityForDifficulty(quest.DifficultyLevel)); quest.HandlerItemReward = new QuestRewardItem(itemReward); } return(quest); }
public static void GenerateStartingQuests() { Requests.Clear(); int requestCount = Random.Range(4, 6); for (int i = 0; i < requestCount; i++) { QuestInstance newQuest = QuestGenerator.GenerateQuestInstance(); Requests.Add(newQuest); } }