コード例 #1
0
        /// <summary>
        /// First Effect: Draw 2 cards
        /// Second Effect: Restore 5 Health
        /// </summary>
        /// <param name="cardEffect">The card effect to use</param>
        /// <param name="target">The target of the heal</param>
        public void UseCardEffect(CardEffect cardEffect, IDamageableEntity target = null)
        {
            if (cardEffect == CardEffect.FIRST)
            {
                // Draw cards
                this.Owner.DrawCards(DRAW_COUNT);
            }
            else if (cardEffect == CardEffect.SECOND)
            {
                // Heal
                if (target == null)
                {
                    throw new InvalidOperationException("Needs to have a target!");
                }

                bool shouldAbort;
                GameEventManager.Healing(this.Owner, target, HEAL_AMOUNT, out shouldAbort);

                if (!shouldAbort)
                {
                    target.TakeHealing(HEAL_AMOUNT);
                }
            }
            else
            {
                throw new InvalidOperationException("You must choose a card effect to play it!");
            }
        }
コード例 #2
0
        /// <summary>
        /// Heals a target
        /// </summary>
        /// <param name="target">The target to heal</param>
        /// <param name="healAmount">The amount to heal for</param>
        protected void HealTarget(IDamageableEntity target, int healAmount)
        {
            if (target == null)
            {
                return;
            }

            // Ok, we have to do some hacky stuff here. Heals don't get affected by spell power UNLESS the heal actually does
            // damage instead. Auchenai Soulpriest's current implementation can't handle this nuance right now.
            // So instead of going through the normal flow, change the "heal amount" based on whether or not the current player
            // has a non-silenced Auchenai Soulpriest.
            int actualHealAmount = healAmount;

            var playZone = GameEngine.GameState.CurrentPlayerPlayZone;

            if (playZone.Any(card => card is AuchenaiSoulpriest && !((BaseMinion)card).IsSilenced))
            {
                actualHealAmount += this.BonusSpellPower;
            }

            bool shouldAbort;

            GameEventManager.Healing(this.Owner, target, actualHealAmount, out shouldAbort);

            if (!shouldAbort)
            {
                target.TakeHealing(actualHealAmount);
            }
        }
コード例 #3
0
        /// <summary>
        /// First Effect: Draw 2 cards
        /// Second Effect: Restore 5 Health
        /// </summary>
        /// <param name="cardEffect">The card effect to use</param>
        /// <param name="target">The target of the heal</param>
        public void UseCardEffect(CardEffect cardEffect, IDamageableEntity target = null)
        {
            if (cardEffect == CardEffect.FIRST)
            {
                // Draw cards
                this.Owner.DrawCards(DRAW_COUNT);
            }
            else if (cardEffect == CardEffect.SECOND)
            {
                // Heal
                if (target == null)
                {
                    throw new InvalidOperationException("Needs to have a target!");
                }

                bool shouldAbort;
                GameEventManager.Healing(this.Owner, target, HEAL_AMOUNT, out shouldAbort);

                if (!shouldAbort)
                {
                    target.TakeHealing(HEAL_AMOUNT);
                }
            }
            else
            {
                throw new InvalidOperationException("You must choose a card effect to play it!");
            }
        }
コード例 #4
0
ファイル: BaseSpell.cs プロジェクト: kwluo90/HearthAnalyzer
        /// <summary>
        /// Heals a target
        /// </summary>
        /// <param name="target">The target to heal</param>
        /// <param name="healAmount">The amount to heal for</param>
        protected void HealTarget(IDamageableEntity target, int healAmount)
        {
            if (target == null) return;

            // Ok, we have to do some hacky stuff here. Heals don't get affected by spell power UNLESS the heal actually does
            // damage instead. Auchenai Soulpriest's current implementation can't handle this nuance right now.
            // So instead of going through the normal flow, change the "heal amount" based on whether or not the current player
            // has a non-silenced Auchenai Soulpriest.
            int actualHealAmount = healAmount;

            var playZone = GameEngine.GameState.CurrentPlayerPlayZone;
            if (playZone.Any(card => card is AuchenaiSoulpriest && !((BaseMinion)card).IsSilenced))
            {
                actualHealAmount += this.BonusSpellPower;
            }

            bool shouldAbort;
            GameEventManager.Healing(this.Owner, target, actualHealAmount, out shouldAbort);

            if (!shouldAbort)
            {
                target.TakeHealing(actualHealAmount);
            }
        }