예제 #1
0
    private static LootEntry GetLootEntry(string tableId, RaidInfo raid)
    {
        LootTable lootTable = LootDatabase.LootTables[tableId.ToUpper()].
                              Find(table => ((table.Difficulty == raid.Quest.Difficulty) || (table.Difficulty == 0)) &&
                                   ((table.Dungeon == raid.Dungeon.Name) || (table.Dungeon == "")));

        LootEntry lootEntry = RandomSolver.ChooseBySingleRandom(lootTable.Entries);

        return(lootEntry.Type != LootType.Table ? lootEntry : GetLootEntry(((LootEntryTable)lootEntry).TableId, raid));
    }
예제 #2
0
    public void ExecuteProgress()
    {
        foreach (var eventEntry in EventModifiers.EventData)
        {
            switch (eventEntry.Type)
            {
            case TownEventDataType.IdleBuff:
                for (int i = 0; i < Heroes.Count; i++)
                {
                    if (Heroes[i].Status == HeroStatus.Available)
                    {
                        Heroes[i].AddBuff(new BuffInfo(DarkestDungeonManager.Data.Buffs[eventEntry.StringData],
                                                       BuffDurationType.IdleTownVisit, BuffSourceType.Estate));
                    }
                }
                break;

            case TownEventDataType.IdleResolve:
                for (int i = 0; i < Heroes.Count; i++)
                {
                    if (Heroes[i].Class == eventEntry.StringData)
                    {
                        for (int j = 0; j < eventEntry.NumberData; j++)
                        {
                            Heroes[i].Resolve.AddExperience(Heroes[i].Resolve.NextLevelXP - Heroes[i].Resolve.CurrentXP);
                        }

                        Heroes[i].UpdateResolve();
                    }
                }
                break;

            case TownEventDataType.InActivityBuff:
                for (int i = 0; i < Heroes.Count; i++)
                {
                    if (Heroes[i].Status == HeroStatus.Abbey || Heroes[i].Status == HeroStatus.Tavern)
                    {
                        for (int j = 0; j < eventEntry.NumberData; j++)
                        {
                            Heroes[i].AddBuff(new BuffInfo(DarkestDungeonManager.Data.Buffs[eventEntry.StringData],
                                                           BuffDurationType.IdleTownVisit, BuffSourceType.Estate));
                        }
                    }
                }
                break;

            default:
                break;
            }
        }

        TriggeredEvent  = null;
        GuaranteedEvent = null;
        EventModifiers.Reset();
        Estate.ExecuteProgress();

        var possibleEvents = DarkestDungeonManager.Data.EventDatabase.Events.FindAll(townEvent => townEvent.IsPossible);

        if (possibleEvents.Count > 0 && EventsOption.Frequency.Count > 3 && RandomSolver.CheckSuccess(EventsOption.Frequency[3]))
        {
            TriggeredEvent = RandomSolver.ChooseBySingleRandom(possibleEvents);
            for (int i = 0; i < DarkestDungeonManager.Data.EventDatabase.Events.Count; i++)
            {
                DarkestDungeonManager.Data.EventDatabase.Events[i].EventTriggered(false);
            }

            TriggeredEvent.EventTriggered(true);
            EventModifiers.IncludeEvent(TriggeredEvent);

            if (TriggeredEvent.Id == "plot_quest_town_invasion_0")
            {
                DarkestSoundManager.PlayOneShot("event:/town/town_event_display_bandit_incursion");
            }
            else if (TriggeredEvent.Tone == TownEventTone.Bad)
            {
                DarkestSoundManager.PlayOneShot("event:/town/town_event_display_bad");
            }
            else if (TriggeredEvent.Tone == TownEventTone.Good)
            {
                DarkestSoundManager.PlayOneShot("event:/town/town_event_display_good");
            }
            else
            {
                DarkestSoundManager.PlayOneShot("event:/town/town_event_display_neutral");
            }
        }

        GenerateQuests();
        SearchMissingHeroes();
    }