当前位置: 首页>>代码示例>>C#>>正文


C# IDamageableEntity.TakeHealing方法代码示例

本文整理汇总了C#中IDamageableEntity.TakeHealing方法的典型用法代码示例。如果您正苦于以下问题:C# IDamageableEntity.TakeHealing方法的具体用法?C# IDamageableEntity.TakeHealing怎么用?C# IDamageableEntity.TakeHealing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDamageableEntity的用法示例。


在下文中一共展示了IDamageableEntity.TakeHealing方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UseCardEffect

        /// <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!");
            }
        }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:34,代码来源:AncientofLore.cs

示例2: HealTarget

        /// <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);
            }
        }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:29,代码来源:BaseSpell.cs


注:本文中的IDamageableEntity.TakeHealing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。