Exemplo n.º 1
0
    public void UpdateQuest(Quest quest, bool completed = false)
    {
        if (completed)
        {
            CompleteQuest();
            return;
        }

        if (quest.IsPlotQuest)
        {
            PlotQuest plotQuest = (PlotQuest)quest;

            questTitle.text = LocalizationManager.GetString("town_quest_name_" + plotQuest.Id);
            questGoal.text  = plotQuest.Goal.QuestData.GetDataString(plotQuest.Goal.Type);

            if (plotQuest.CanRetreat == false)
            {
                retreatButton.gameObject.SetActive(false);
            }
        }
        else
        {
            questTitle.text = LocalizationManager.GetString("town_quest_name_" +
                                                            quest.Type + "+" + quest.Length.ToString() + "+" + quest.Dungeon + "+" + quest.Goal.Id);
            questGoal.text = quest.Goal.QuestData.GetDataString(quest.Goal.Type);
        }
    }
Exemplo n.º 2
0
    public PlotQuest Copy()
    {
        var newQuest = new PlotQuest();

        newQuest.Id             = Id;
        newQuest.PlotDependency = PlotDependency;
        newQuest.DungeonLevel   = DungeonLevel;
        newQuest.PlotTrinket    = PlotTrinket;
        newQuest.IsPlotQuest    = true;
        newQuest.Type           = Type;
        newQuest.Dungeon        = Dungeon;
        newQuest.Difficulty     = Difficulty;
        newQuest.Length         = Length;
        newQuest.RaidMap        = RaidMap;
        newQuest.Goal           = Goal;

        newQuest.IsProgression               = IsProgression;
        newQuest.HasStatueContents           = HasStatueContents;
        newQuest.CompletionDungeonXp         = CompletionDungeonXp;
        newQuest.CanRetreat                  = CanRetreat;
        newQuest.AlwaysRetreatFromRaid       = AlwaysRetreatFromRaid;
        newQuest.RetreatKillCount            = RetreatKillCount;
        newQuest.IsSurpriseEnabled           = IsSurpriseEnabled;
        newQuest.IsScoutingEnabled           = IsScoutingEnabled;
        newQuest.IsStressClearedOnCompletion = IsStressClearedOnCompletion;
        newQuest.RosterBuffOnFailureMinimumPartyResolveLevel = RosterBuffOnFailureMinimumPartyResolveLevel;
        newQuest.RosterBuffsOnFailure       = RosterBuffsOnFailure;
        newQuest.SuggestedTrinkets          = SuggestedTrinkets;
        newQuest.UpgradeTagsRemovedOnIgnore = UpgradeTagsRemovedOnIgnore;

        newQuest.Reward                 = new CompletionReward();
        newQuest.Reward.ResolveXP       = Reward.ResolveXP;
        newQuest.Reward.ItemDefinitions = new List <ItemDefinition>(Reward.ItemDefinitions);
        return(newQuest);
    }
Exemplo n.º 3
0
    public void SetSelectedQuest(Quest quest)
    {
        if (quest.IsPlotQuest)
        {
            PlotQuest plotQuest = (PlotQuest)quest;

            questTitle.text       = LocalizationManager.GetString("town_quest_name_" + plotQuest.Id);
            questDescription.text = LocalizationManager.GetString("town_quest_description_" + plotQuest.Id);
            questLength.text      = plotQuest.Length.ToString();
            campfireAmount.text   = "x" + (quest.Length - 1).ToString();
            questLength.text      = LocalizationManager.GetString("town_quest_length_" + plotQuest.Length.ToString());
            questDifficulty.text  = LocalizationManager.GetString("town_quest_difficulty_" + plotQuest.Difficulty.ToString());
            questGoals.text       = LocalizationManager.GetString("town_quest_goals") + "\n";
            questGoals.text      += plotQuest.Goal.QuestData.GetDataString(plotQuest.Goal.Type);
            questRewardPanel.UpdateRewardSlots(quest);
        }
        else
        {
            questTitle.text = LocalizationManager.GetString("town_quest_name_" + quest.Type +
                                                            "+" + quest.Length.ToString() + "+" + quest.Dungeon + "+" + quest.Goal.Id);
            questDescription.text = LocalizationManager.GetString("town_quest_description_" +
                                                                  quest.Type + "+" + quest.Length.ToString() + "+" + quest.Dungeon + "+" + quest.Goal.Id);
            questLength.text     = quest.Length.ToString();
            campfireAmount.text  = "x" + (quest.Length - 1).ToString();
            questLength.text     = LocalizationManager.GetString("town_quest_length_" + quest.Length.ToString());
            questDifficulty.text = LocalizationManager.GetString("town_quest_difficulty_" + quest.Difficulty.ToString());
            questGoals.text      = LocalizationManager.GetString("town_quest_goals") + "\n";
            questGoals.text     += quest.Goal.QuestData.GetDataString(quest.Goal.Type);
            questRewardPanel.UpdateRewardSlots(quest);
        }
    }
Exemplo n.º 4
0
 public void UpdateInfo(PlotQuest plotQuest)
 {
     goalType = LogGoalType.Plot;
     goalInfo = plotQuest.Id;
     if (DarkestDungeonManager.Campaign.CompletedPlot.Contains(plotQuest.Id))
     {
         checkIcon.enabled = true;
     }
     else
     {
         checkIcon.enabled = false;
     }
     goalText.text = LocalizationManager.GetString("str_caretaker_goal_" + plotQuest.Id);
 }
Exemplo n.º 5
0
    public static T Create <T>(BinaryReader br) where T : class, IBinarySaveData
    {
        var saveDataType  = typeof(T);
        T   newBinaryData = null;

        if (typeof(Quest).IsAssignableFrom(saveDataType))
        {
            string plotGenId = br.ReadString();
            if (plotGenId == "tutorial")
            {
                newBinaryData = new PlotQuest(plotGenId, new PlotTrinketReward {
                    Amount = 0, Rarity = "very_common"
                }) as T;
            }
            else if (plotGenId != "")
            {
                newBinaryData = DarkestDungeonManager.Data.QuestDatabase.PlotQuests.Find(plQuest => plQuest.Id == plotGenId).Copy() as T;
            }
            else
            {
                newBinaryData = new Quest() as T;
            }
        }
        else if (typeof(Prop).IsAssignableFrom(saveDataType))
        {
            AreaType propType = (AreaType)br.ReadInt32();

            switch (propType)
            {
            case AreaType.Door:
                newBinaryData = new Door() as T;
                break;

            case AreaType.Curio:
                bool   isQuestCurio = br.ReadBoolean();
                string curioName    = br.ReadString();

                if (isQuestCurio)
                {
                    newBinaryData = new Curio {
                        IsQuestCurio = true, StringId = curioName
                    }
                }
                as T;
                else
                {
                    newBinaryData = DarkestDungeonManager.Data.Curios[curioName] as T;
                }
                break;
Exemplo n.º 6
0
    public void PopulateStartingDungeonInfo(bool isNewGamePlus)
    {
        Quest = new PlotQuest()
        {
            IsPlotQuest  = true,
            Id           = "tutorial",
            Difficulty   = 1,
            Type         = "tutorial_room",
            Dungeon      = "weald",
            DungeonLevel = 1,
            Goal         = DarkestDungeonManager.Data.QuestDatabase.QuestGoals["tutorial_final_room"],
            Length       = 1,
            PlotTrinket  = new PlotTrinketReward()
            {
                Amount = 0, Rarity = "very_common"
            },
            Reward = new CompletionReward()
            {
                ResolveXP       = 2,
                ItemDefinitions = new List <ItemDefinition>()
                {
                    new ItemDefinition("gold", "", 5000),
                }
            },

            CanRetreat          = false,
            CompletionDungeonXp = false,
        };

        Dungeon = new Dungeon("weald", 9, 1, "room1_1");
        Dungeon.Rooms["room1_1"] = new DungeonRoom("room1_1", 1, 1, Knowledge.Completed, AreaType.Entrance, 1, "effigy_0");
        Dungeon.Rooms["room2_1"] = new DungeonRoom("room2_1", 8, 1, Knowledge.Hidden, AreaType.BattleTresure, 1, "effigy_1");
        Dungeon.Rooms["room2_1"].SetNamedEncounter("weald", "tutorial_2", 0, 1);
        Dungeon.Rooms["room2_1"].SetCurio("bandits_trapped_chest");

        Hallway hallway = Dungeon.Hallways["hallroom2_1_room1_1"] = new Hallway("hallroom2_1_room1_1", Dungeon.Rooms["room1_1"], Dungeon.Rooms["room2_1"], Direction.Right, Direction.Left);

        hallway.Halls = new List <HallSector>()
        {
            new HallSector("0", 7, 1, hallway, new Door(hallway.Id, hallway.RoomA.Id, Direction.Left)),
            new HallSector("1", 6, 1, hallway, Knowledge.Hidden, AreaType.Curio, "7", isNewGamePlus ? "open_grave" : "travellers_tent_tutorial"),
            new HallSector("2", 5, 1, hallway, Knowledge.Hidden, AreaType.Empty, "8"),
            new HallSector("3", 4, 1, hallway, Knowledge.Hidden, AreaType.Battle, "2", "weald", "tutorial_1", 1, 0),
            new HallSector("4", 3, 1, hallway, Knowledge.Hidden, AreaType.Empty, "1"),
            new HallSector("5", 2, 1, hallway, new Door(hallway.Id, hallway.RoomB.Id, Direction.Right)),
        };
    }
Exemplo n.º 7
0
    public void ProceedToItems()
    {
        if (RaidSceneManager.Raid.Quest.IsPlotQuest)
        {
            PlotQuest plotQuest = (PlotQuest)RaidSceneManager.Raid.Quest;
            goalLabel.text = LocalizationManager.GetString("town_quest_name_" + plotQuest.Id);
        }
        else
        {
            goalLabel.text = LocalizationManager.GetString("town_quest_name_"
                                                           + RaidSceneManager.Raid.Quest.Type + "+" + RaidSceneManager.Raid.Quest.Length.ToString()
                                                           + "+" + RaidSceneManager.Raid.Quest.Dungeon + "+" + RaidSceneManager.Raid.Quest.Goal.Id);
        }

        if (DarkestDungeonManager.RaidManager.Status == RaidStatus.Success)
        {
            resultLabel.text   = LocalizationManager.GetString("raid_results_quest_result_was_completed");
            resultFrame.sprite = completedFrame;
        }
        else if (DarkestDungeonManager.RaidManager.Status == RaidStatus.Abandon)
        {
            resultLabel.text   = LocalizationManager.GetString("raid_results_quest_result_was_not_completed_escape");
            resultFrame.sprite = escapeFrame;
        }
        else if (DarkestDungeonManager.RaidManager.Status == RaidStatus.Defeat)
        {
            resultLabel.text   = LocalizationManager.GetString("raid_results_quest_result_was_not_completed_defeat");
            resultFrame.sprite = defeatFrame;
        }

        itemWindow.gameObject.SetActive(true);
        heroWindow.gameObject.SetActive(false);
        itemWindow.PrepareRewards();
        State = ResultWindowState.Items;

        nextButtonLabel.text = LocalizationManager.GetString("raid_results_progression_heroes");
    }
    public void AddExperience(int expAmount)
    {
        if (MasteryLevel == maxLevel)
        {
            return;
        }

        CurrentXP += expAmount;

        while (CurrentXP >= NextLevelXP)
        {
            PlotQuest masteryQuest = DarkestDungeonManager.Data.QuestDatabase.PlotQuests.Find(item =>
                                                                                              item.Dungeon == DungeonName && item.DungeonLevel == MasteryLevel);
            if (masteryQuest != null)
            {
                if (!DarkestDungeonManager.Campaign.CompletedPlot.Contains(masteryQuest.Id))
                {
                    CurrentXP = NextLevelXP;
                    break;
                }
            }

            if (MasteryLevel < maxLevel)
            {
                MasteryLevel++;
                CurrentXP   = CurrentXP - NextLevelXP;
                NextLevelXP = NextLevelXP = DarkestDungeonManager.Data.CampaignGeneration.
                                            DungeonXpLevelThreshold[Mathf.Clamp(MasteryLevel + 1, 0, maxLevel)];
            }
            else
            {
                NextLevelXP = NextLevelXP = DarkestDungeonManager.Data.CampaignGeneration.DungeonXpLevelThreshold[maxLevel];
                CurrentXP   = NextLevelXP;
                break;
            }
        }
    }
Exemplo n.º 9
0
    public void AddExperience(int expAmount)
    {
        if (MasteryLevel == MaxLevel)
        {
            return;
        }

        CurrentXP += expAmount;

        while (CurrentXP >= NextLevelXP)
        {
            PlotQuest masteryQuest = DarkestDungeonManager.Data.QuestDatabase.PlotQuests.Find(item =>
                                                                                              item.Dungeon == DungeonName && item.DungeonLevel == MasteryLevel);
            if (masteryQuest != null)
            {
                if (!DarkestDungeonManager.Campaign.CompletedPlot.Contains(masteryQuest.Id))
                {
                    CurrentXP = NextLevelXP;
                    break;
                }
            }

            if (MasteryLevel < MaxLevel)
            {
                MasteryLevel++;
                CurrentXP -= NextLevelXP;
                UpdateNextLevelXP();
            }
            else
            {
                UpdateNextLevelXP();
                CurrentXP = NextLevelXP;
                break;
            }
        }
    }
Exemplo n.º 10
0
 public void UpdateInfo(PlotQuest plotQuest)
 {
     checkIcon.enabled = DarkestDungeonManager.Campaign.CompletedPlot.Contains(plotQuest.Id);
     goalText.text     = LocalizationManager.GetString("str_caretaker_goal_" + plotQuest.Id);
 }