Пример #1
0
        public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams)
        {
            foreach (CharacterState target in cardEffectParams.targets)
            {
                if (!OnGainEmber.energyData.TryGetValue(target, out int addEnergy))
                {
                    addEnergy = 1;
                }

                CardUpgradeState upgradeState = new CardUpgradeState();
                upgradeState.Setup(cardEffectState.GetParamCardUpgradeData());

                // Tweak the CardUpgradeState's stats
                Traverse.Create(upgradeState).Field("attackDamage").SetValue(upgradeState.GetAttackDamage() * addEnergy);
                Traverse.Create(upgradeState).Field("additionalHP").SetValue(upgradeState.GetAdditionalHP() * addEnergy);

                if (cardEffectParams.playedCard != null)
                {
                    foreach (CardTraitState traitState in cardEffectParams.playedCard.GetTraitStates())
                    {
                        traitState.OnApplyingCardUpgradeToUnit(cardEffectParams.playedCard, target, upgradeState, cardEffectParams.cardManager);
                    }
                }
                int    attackDamage = upgradeState.GetAttackDamage();
                int    additionalHP = upgradeState.GetAdditionalHP();
                string text         = ((attackDamage != 0) ? GetAttackNotificationText(upgradeState) : null);
                string text2        = ((additionalHP != 0) ? GetHPNotificationText(upgradeState) : null);
                string text3        = string.Empty;
                if (text != null && text2 != null)
                {
                    text3 = string.Format("TextFormat_SpacedItems".Localize(), text, text2);
                }
                else if (text != null)
                {
                    text3 = text;
                }
                else if (text2 != null)
                {
                    text3 = text2;
                }
                if (text3 != null)
                {
                    NotifyHealthEffectTriggered(cardEffectParams.saveManager, cardEffectParams.popupNotificationManager, text3, target.GetCharacterUI());
                }
                yield return(target.ApplyCardUpgrade(upgradeState));

                CardState spawnerCard = target.GetSpawnerCard();
                bool      flag        = target.HasStatusEffect("cardless");
                if (spawnerCard != null && !cardEffectParams.saveManager.PreviewMode && !flag)
                {
                    CardAnimator.CardUpgradeAnimationInfo type = new CardAnimator.CardUpgradeAnimationInfo(spawnerCard, upgradeState);
                    CardAnimator.DoAddRecentCardUpgrade.Dispatch(type);
                    spawnerCard.GetTemporaryCardStateModifiers().AddUpgrade(upgradeState);
                    spawnerCard.UpdateCardBodyText();
                    cardEffectParams.cardManager?.RefreshCardInHand(spawnerCard);
                }
            }
        }
Пример #2
0
        public override void OnApplyingCardUpgradeToUnit(CardState thisCard, CharacterState targetUnit, CardUpgradeState upgradeState, CardManager cardManager)
        {
            int multiplier = GetMultiplier(cardManager.GetCardStatistics());

            upgradeState.SetAttackDamage(upgradeState.GetAttackDamage() * multiplier);
            upgradeState.SetAdditionalHP(upgradeState.GetAdditionalHP() * multiplier);
            upgradeState.SetAdditionalSize(upgradeState.GetAdditionalSize() * multiplier);
        }
        public override bool OnCardBeingUpgraded(CardState cardState, CardState upgradingCardSource, CardManager cardManager, CardUpgradeState cardUpgradeState)
        {
            int scaleAmount = GetScaleAmount(upgradingCardSource, cardManager);

            cardUpgradeState.SetAttackDamage(cardUpgradeState.GetAttackDamage() * scaleAmount);
            cardUpgradeState.SetAdditionalHP(cardUpgradeState.GetAdditionalHP() * scaleAmount);
            cardUpgradeState.SetCostReduction(cardUpgradeState.GetCostReduction() * scaleAmount);
            cardUpgradeState.SetAdditionalHeal(cardUpgradeState.GetAdditionalHeal() * scaleAmount);
            cardUpgradeState.SetAdditionalSize(cardUpgradeState.GetAdditionalSize() * scaleAmount);
            foreach (StatusEffectStackData statusEffectStackData in cardUpgradeState.GetStatusEffectUpgrades())
            {
                cardUpgradeState.AddStatusEffectUpgradeStacks(statusEffectStackData.statusId, statusEffectStackData.count * (scaleAmount - statusEffectStackData.count));
            }

            return(true);
        }
Пример #4
0
 private string GetAttackNotificationText(CardUpgradeState upgradeState)
 {
     return(CardEffectBuffDamage.GetNotificationText(upgradeState.GetAttackDamage()));
 }