Exemple #1
0
        public override UpdateResult Update()
        {
            if (_dataProvider.InAdventureScreen)
            {
                var dungeonInfo = _dataProvider.GetDungeonInfo();
                if (dungeonInfo != null)
                {
                    for (var i = 0; i < dungeonInfo.Length; i++)
                    {
                        if (dungeonInfo[i]?.RunActive ?? false)
                        {
                            if ((_prevCards[i] == null || !dungeonInfo[i].DbfIds.SequenceEqual(_prevCards[i])) &&
                                (_prevLootChoice[i] != dungeonInfo[i].PlayerChosenLoot ||
                                 _prevTreasureChoice[i] != dungeonInfo[i].PlayerChosenTreasure))
                            {
                                _prevCards[i]          = dungeonInfo[i].DbfIds.ToList();
                                _prevLootChoice[i]     = dungeonInfo[i].PlayerChosenLoot;
                                _prevTreasureChoice[i] = dungeonInfo[i].PlayerChosenTreasure;
                                DungeonRunDeckUpdated?.Invoke(new DungeonRunDeckUpdatedEventArgs(BuildDeck(dungeonInfo[i])));
                            }
                        }
                        else
                        {
                            _prevCards[i] = null;
                        }
                    }

                    if (_prevLootChoice.All(x => x > 0))
                    {
                        return(UpdateResult.Break);
                    }
                }
                else
                {
                    _prevCards = new List <int>[] { null, null }
                };
            }
            else if (_dataProvider.InAiMatch && !string.IsNullOrEmpty(_dataProvider.OpponentHeroId))
            {
                if (Cards.All.TryGetValue(_dataProvider.OpponentHeroId, out var card))
                {
                    if (DungeonRun.IsDungeonBoss(card))
                    {
                        var newRun = _initialOpponents.Contains(_dataProvider.OpponentHeroId);
                        var deck   = newRun ? DungeonRun.GetDefaultDeck(_dataProvider.LocalPlayerClass, card.Set) : null;
                        DungeonRunMatchStarted?.Invoke(new DungeonRunMatchStartedEventArgs(newRun, deck));
                        return(UpdateResult.Break);
                    }
                }
            }

            return(UpdateResult.Continue);
        }
Exemple #2
0
        private static Deck CreateDungeonDeck(string playerClass)
        {
            Log.Info($"Creating new {playerClass} dungeon run deck");
            var deck = DungeonRun.GetDefaultDeck(playerClass);

            if (deck == null)
            {
                Log.Info($"Could not find default deck for {playerClass}");
                return(null);
            }
            DeckList.Instance.Decks.Add(deck);
            DeckList.Save();
            Core.MainWindow.DeckPickerList.UpdateDecks();
            Core.MainWindow.SelectDeck(deck, true);
            return(deck);
        }
Exemple #3
0
        private static Deck CreateDungeonDeck(string playerClass, CardSet set)
        {
            var shrine = Core.Game.Player.Board.FirstOrDefault(x => x.HasTag(GameTag.SHRINE))?.CardId;

            Log.Info($"Creating new {playerClass} dungeon run deck (CardSet={set}, Shrine={shrine})");
            var deck = DungeonRun.GetDefaultDeck(playerClass, set, shrine);

            if (deck == null)
            {
                Log.Info($"Could not find default deck for {playerClass} in card set {set} with Shrine={shrine}");
                return(null);
            }
            DeckList.Instance.Decks.Add(deck);
            DeckList.Save();
            Core.MainWindow.DeckPickerList.UpdateDecks();
            Core.MainWindow.SelectDeck(deck, true);
            return(deck);
        }
        private static Deck CreateDungeonDeck(string playerClass, CardSet set, bool isPVPDR, List <int> selectedDeck = null, Card loadout = null)
        {
            var shrine = Core.Game.Player.Board.FirstOrDefault(x => x.HasTag(GameTag.SHRINE))?.CardId;

            Log.Info($"Creating new {playerClass} dungeon run deck (CardSet={set}, Shrine={shrine}, SelectedDeck={selectedDeck != null})");
            var deck = selectedDeck == null
                                ? DungeonRun.GetDefaultDeck(playerClass, set, shrine)
                                : DungeonRun.GetDeckFromDbfIds(playerClass, set, isPVPDR, selectedDeck);

            if (deck == null)
            {
                Log.Info($"Could not find default deck for {playerClass} in card set {set} with Shrine={shrine}");
                return(null);
            }
            if (loadout != null && selectedDeck != null && !selectedDeck.Contains(loadout.DbfIf))
            {
                deck.Cards.Add(loadout);
            }
            DeckList.Instance.Decks.Add(deck);
            DeckList.Save();
            Core.MainWindow.DeckPickerList.UpdateDecks();
            Core.MainWindow.SelectDeck(deck, true);
            return(deck);
        }