public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams)
        {
            int intInRange = cardEffectState.GetIntInRange();

            CharacterState.AddStatusEffectParams addStatusEffectParams = default(CharacterState.AddStatusEffectParams);
            addStatusEffectParams.sourceRelicState = cardEffectParams.sourceRelic;
            addStatusEffectParams.sourceCardState  = cardEffectParams.playedCard;
            addStatusEffectParams.cardManager      = cardEffectParams.cardManager;
            addStatusEffectParams.sourceIsHero     = false;
            CharacterState.AddStatusEffectParams addStatusEffectParams2 = addStatusEffectParams;

            StatusEffectData.DisplayCategory buffOrDebuff = StatusEffectData.DisplayCategory.Negative;
            if (cardEffectState.GetParamBool())
            {
                buffOrDebuff = StatusEffectData.DisplayCategory.Positive;
            }

            foreach (CharacterState character in cardEffectParams.targets)
            {
                List <CharacterState.StatusEffectStack> statusEffectStacks;
                character.GetStatusEffects(out statusEffectStacks);

                foreach (var status in statusEffectStacks)
                {
                    if (status.State.GetDisplayCategory() == buffOrDebuff)
                    {
                        character.AddStatusEffect(status.State.GetStatusId(), 0, addStatusEffectParams2);
                    }
                }
            }
            yield break;
        }
Exemple #2
0
        public override IEnumerator ApplyEffect(
            CardEffectState cardEffectState,
            CardEffectParams cardEffectParams)
        {
            if (cardEffectState.SaveManager.PreviewMode)
            {
                yield break;
            }

            int       paramInt = cardEffectState.GetParamInt();
            string    wardType = cardEffectState.GetParamStr();
            WardState wardState;

            switch (wardType)
            {
            case "WardStateShifter":
                wardState       = new WardStateShifter();
                wardState.power = paramInt;
                break;

            case "WardStatePower":
                wardState       = new WardStatePower();
                wardState.power = paramInt;
                break;

            case "WardStatePyrebound":
                wardState       = new WardStatePyrebound();
                wardState.power = paramInt;
                break;

            case "WardStatePyreHarvest":
                wardState       = new WardStatePyreHarvest();
                wardState.power = paramInt;
                break;

            case "WardStateRandomDamage":
                wardState       = new WardStateRandomDamage();
                wardState.power = paramInt;
                break;

            default:
                yield break;
            }

            int roomIndex = cardEffectParams.selectedRoom;

            if (cardEffectState.GetParamBool())
            {
                WardManager.AddWardLater(wardState, roomIndex);
                yield break;
            }

            WardManager.AddWard(wardState, roomIndex);
            yield break;
        }
        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;
        }
Exemple #4
0
        public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams)
        {
            CharacterState.AddStatusEffectParams addStatusEffectParams = default(CharacterState.AddStatusEffectParams);
            addStatusEffectParams.sourceRelicState = cardEffectParams.sourceRelic;
            addStatusEffectParams.sourceCardState  = cardEffectParams.playedCard;
            addStatusEffectParams.cardManager      = cardEffectParams.cardManager;
            addStatusEffectParams.sourceIsHero     = (cardEffectState.GetSourceTeamType() == Team.Type.Heroes);
            CharacterState.AddStatusEffectParams addStatusEffectParams2 = addStatusEffectParams;

            foreach (CharacterState character in cardEffectParams.targets)
            {
                List <CharacterState.StatusEffectStack> statusEffectStacks;
                character.GetStatusEffects(out statusEffectStacks);


                // True flips buffs into debuffs, false flips debuffs into buffs
                foreach (var status in statusEffectStacks)
                {
                    if (cardEffectState.GetParamBool())
                    {
                        if (StatusFlips.ContainsKey(status.State.GetStatusId()))
                        {
                            int count = status.Count;
                            character.RemoveStatusEffect(status.State.GetStatusId(), false, count);

                            string debuff = StatusFlips.GetValueSafe(status.State.GetStatusId());
                            Trainworks.Trainworks.Log(BepInEx.Logging.LogLevel.All, "Flipping " + status.State.GetStatusId() + " to " + debuff + " - " + count);
                            character.AddStatusEffect(debuff, count);
                        }
                    }
                    else
                    {
                        if (StatusFlips.ContainsValue(status.State.GetStatusId()))
                        {
                            int count = status.Count;
                            character.RemoveStatusEffect(status.State.GetStatusId(), false, count);

                            string buff = StatusFlips.FirstOrDefault(x => x.Value == status.State.GetStatusId()).Key;
                            Trainworks.Trainworks.Log(BepInEx.Logging.LogLevel.All, "Flipping " + status.State.GetStatusId() + " to " + buff + " - " + count);
                            character.AddStatusEffect(buff, count);
                        }
                    }
                }
            }
            yield break;
        }
        public override IEnumerator ApplyEffect(
            CardEffectState cardEffectState,
            CardEffectParams cardEffectParams)
        {
            if (cardEffectParams.targetCards.Count > 0)
            {
                cardsToScry = cardEffectState.GetParamInt();
                if (cardEffectState.GetParamBool())
                {
                    int empowerMultiplier = cardEffectState.GetParamInt();
                    if (empowerMultiplier == 0)
                    {
                        empowerMultiplier = 1;
                    }

                    cardsToScry = cardEffectParams.playerManager.GetEnergy() * empowerMultiplier;
                }

                // Fire the trigger!
                MonsterManager monsterManager;
                ProviderManager.TryGetProvider <MonsterManager>(out monsterManager);

                List <CharacterState> units = new List <CharacterState>();
                monsterManager.AddCharactersInTowerToList(units);

                CustomTriggerManager.QueueAndRunTrigger(OnDivine.OnDivineCharTrigger, units.ToArray(), true, true, null, 1);

                CardManager cardManager;
                ProviderManager.TryGetProvider <CardManager>(out cardManager);
                foreach (var card in cardManager.GetHand())
                {
                    CustomTriggerManager.FireCardTriggers(OnDivine.OnDivineCardTrigger, card, -1, true, null, 1, null);
                }

                foreach (var relic in ProviderManager.SaveManager.GetCollectedRelics())
                {
                    foreach (var effect in relic.GetEffectsOfType <RelicEffectEmberOnDivine>())
                    {
                        if (effect == null)
                        {
                            continue;
                        }
                        effect.OnDivine();
                    }
                }

                // Check for the relic!
                if (cardEffectParams.saveManager.GetRelicCount("SeersBoostDivine") > 0)
                {
                    foreach (var card in cardManager.GetAllCards())
                    {
                        if (card.GetSpawnCharacterData() != null)
                        {
                            foreach (var subtype in card.GetSpawnCharacterData().GetSubtypes())
                            {
                                if (subtype.Key == "ChronoSubtype_Seer")
                                {
                                    cardsToScry++;
                                }
                            }
                        }
                    }
                }

                yield return((object)this.HandleChooseCard(cardEffectState, cardEffectParams));
            }
        }