public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams)
        {
            owner            = cardEffectParams.targets[0];
            reflectDebuffs   = cardEffectState.GetParamBool();
            flatIncrease     = cardEffectState.GetParamInt();
            multiplyIncrease = cardEffectState.GetParamMultiplier();
            targeting        = cardEffectState.GetAdditionalParamInt();
            cardEffectState.SetShouldOverrideTriggerUI(true);

            instance = this;

            yield break;
        }
Beispiel #2
0
        public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams)
        {
            int energy = cardEffectParams.playerManager.GetEnergy();

            foreach (var target in cardEffectParams.targets)
            {
                NotifyHealthEffectTriggered(cardEffectParams.saveManager, cardEffectParams.popupNotificationManager, GetActivatedDescription(cardEffectState), target.GetCharacterUI());

                target.BuffDamage(cardEffectState.GetParamInt() * energy);
                yield return(target.BuffMaxHP(cardEffectState.GetAdditionalParamInt() * energy, false));
            }

            yield break;
        }
        public virtual IEnumerator HandleChooseCard(
            CardEffectState cardEffectState,
            CardEffectParams cardEffectParams)
        {
            // Generate the Scryed Cards
            // Param Int -> Cards to scry, Additional Param Int -> cards to choose
            List <CardState> drawPile         = cardEffectParams.cardManager.GetDrawPile();
            List <CardState> scryedCards      = new List <CardState>();
            CardState        priorityUnitDraw = DivinePriorityUnit(drawPile);

            // Adjust Divine for priority draw
            if (priorityUnitDraw != null)
            {
                scryedCards.Add(priorityUnitDraw);
            }

            // Draw Piles are dumb?
            drawPile.Reverse();

            // Draw normally
            int drawSize = scryedCards.Count;

            for (int i = 0; i < Math.Min(cardsToScry - drawSize, drawPile.Count); i++)
            {
                if (drawPile[i] != priorityUnitDraw)
                {
                    scryedCards.Add(drawPile[i]);
                }
            }

            // Draw Piles are dumb? Yep
            drawPile.Reverse();

            // Hardcoded Divine interaction to always divine a card with ID "ChosenOne"
            foreach (var card in drawPile)
            {
                if (card.GetID() == "ChosenOne")
                {
                    if (!scryedCards.Contains(card))
                    {
                        scryedCards.Add(card);
                    }
                }
            }
            foreach (var card in cardEffectParams.cardManager.GetDiscardPile())
            {
                if (card.GetID() == "ChosenOne")
                {
                    if (!scryedCards.Contains(card))
                    {
                        scryedCards.Add(card);
                    }
                }
            }

            cardEffectParams.screenManager.SetScreenActive(ScreenName.Deck, true, screen =>
            {
                DeckScreen deckScreen = screen as DeckScreen;
                deckScreen.Setup(new DeckScreen.Params()
                {
                    mode               = DeckScreen.Mode.CardSelection,
                    showCancel         = true,
                    targetMode         = TargetMode.Deck,
                    titleKey           = cardEffectState.GetParentCardState().GetTitleKey(),
                    instructionsKey    = DescriptionKey,
                    numCardsSelectable = cardEffectState.GetAdditionalParamInt(),
                });

                // Reset the card List to the scryed cards
                AccessTools.Field(typeof(DeckScreen), "cardStates").SetValue(screen, scryedCards);
                AccessTools.Method(typeof(DeckScreen), "ApplyStateToCachedCards").Invoke(screen, new object[] { scryedCards, cardEffectParams.cardManager.GetCardStatistics(), cardEffectParams.cardManager.GetMonsterManager(), cardEffectParams.cardManager.GetHeroManager(), null });

                AddDelegate(cardEffectState, cardEffectParams, deckScreen);
            });

            yield break;
        }
Beispiel #4
0
        public override IEnumerator HandleChooseCard(
            CardEffectState cardEffectState,
            CardEffectParams cardEffectParams)
        {
            List <CardState> toProcessCards = new List <CardState>();

            toProcessCards.AddRange(cardEffectParams.cardManager.GetDrawPile());

            List <CardState> scryedCards = new List <CardState>();

            int num        = 0;
            int intInRange = cardsToScry;

            for (int i = 0; i < toProcessCards.Count; i++)
            {
                if (num >= intInRange)
                {
                    break;
                }
                scryedCards.Add(toProcessCards[i]);
            }
            List <CardState> drawPile = cardEffectParams.cardManager.GetDrawPile();

            drawPile.AddRange(cardEffectParams.cardManager.GetDiscardPile());

            foreach (var card in drawPile)
            {
                if (card.GetID() == "ChosenOne")
                {
                    if (!scryedCards.Contains(card))
                    {
                        scryedCards.Add(card);
                    }
                }
            }

            // Generate the Scryed Cards
            // Param Int -> Cards to scry, Additional Param Int -> cards to choose

            cardEffectParams.screenManager.SetScreenActive(ScreenName.Deck, true, screen =>
            {
                DeckScreen deckScreen = screen as DeckScreen;
                deckScreen.Setup(new DeckScreen.Params()
                {
                    mode               = DeckScreen.Mode.CardSelection,
                    showCancel         = true,
                    targetMode         = TargetMode.Deck,
                    titleKey           = cardEffectState.GetParentCardState().GetTitleKey(),
                    instructionsKey    = GetTooltipBaseKey(),
                    numCardsSelectable = cardEffectState.GetAdditionalParamInt(),
                });

                // Reset the card List to the scryed cards
                AccessTools.Field(typeof(DeckScreen), "cardStates").SetValue(screen, scryedCards);
                AccessTools.Method(typeof(DeckScreen), "ApplyStateToCachedCards").Invoke(screen, new object[] { scryedCards, cardEffectParams.cardManager.GetCardStatistics(), cardEffectParams.cardManager.GetMonsterManager(), cardEffectParams.cardManager.GetHeroManager(), null });

                AddDelegate(cardEffectState, cardEffectParams, deckScreen);
            });

            yield break;
        }