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


C# IDamageableEntity类代码示例

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


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

示例1: OnDamagedEffect

 internal void OnDamagedEffect(IDamageableEntity target, int damageDealt)
 {
     if (target == this)
     {
         this.Owner.DrawCard();
     }
 }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:7,代码来源:AcolyteofPain.cs

示例2: Battlecry

        public void Battlecry(IDamageableEntity subTarget)
        {
            if (subTarget != null &&
                !GameEngine.GameState.CurrentPlayerPlayZone.Any(card => card != null && card.CurrentAttackPower >= BATTLECRY_POWER && card != this) &&
                !GameEngine.GameState.WaitingPlayerPlayZone.Any(card => card != null && card.CurrentAttackPower >= BATTLECRY_POWER))
            {
                throw new InvalidOperationException("No valid targets!");
            }

            if (subTarget == null &&
                (GameEngine.GameState.CurrentPlayerPlayZone.Any(card => card != null && card.CurrentAttackPower >= BATTLECRY_POWER && card != this) ||
                GameEngine.GameState.WaitingPlayerPlayZone.Any(card => card != null && card.CurrentAttackPower >= BATTLECRY_POWER)))
            {
                throw new InvalidOperationException("There is a valid target, must select one!");
            }

            if (subTarget != null && !(subTarget is BaseMinion))
            {
                throw new InvalidOperationException("Must target minions!");
            }

            var targetMinion = subTarget as BaseMinion;
            if (targetMinion != null)
            {
                if (targetMinion.CurrentAttackPower < BATTLECRY_POWER)
                {
                    throw new InvalidOperationException(
                        string.Format(
                            "Invalid minion {0}! It does not have enough attack power! Needs to be at least {1}",
                            targetMinion, BATTLECRY_POWER));
                }

                targetMinion.Die();
            }
        }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:35,代码来源:BigGameHunter.cs

示例3: 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

示例4: Battlecry

 public void Battlecry(IDamageableEntity subTarget)
 {
     BaseWeapon weapon = GameEngine.GameState.CurrentPlayer.Weapon;
     if (weapon != null) {
         weapon.TakeBuff(BATTLECRY_BUFF_VALUE, BATTLECRY_BUFF_VALUE);
     }
 }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:7,代码来源:CaptainGreenskin.cs

示例5: Battlecry

 public void Battlecry(IDamageableEntity subTarget)
 {
     if (this.Owner.Weapon != null)
     {
         this.TakeBuff(this.Owner.Weapon.CurrentAttackPower, 0);
     }
 }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:7,代码来源:BloodsailRaider.cs

示例6: Battlecry

 public void Battlecry(IDamageableEntity subTarget)
 {
     var enemy = GameEngine.GameState.WaitingPlayer;
     if (enemy.Weapon != null)
     {
         enemy.Weapon.Die();
     }
 }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:8,代码来源:AcidicSwampOoze.cs

示例7: OnSpellCasting

 private void OnSpellCasting(BaseSpell spell, IDamageableEntity target, out bool shouldAbort)
 {
     if (spell.Owner == this.Owner) {
         var fireball = HearthEntityFactory.CreateCard<Fireball> ();
         this.Owner.AddCardToHand (fireball);
     }
     shouldAbort = false;
 }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:8,代码来源:ArchmageAntonidas.cs

示例8: OnDamageDealt

 private void OnDamageDealt(IDamageableEntity target, int damageDealt)
 {
     var targetMinion = target as BaseMinion;
     if (targetMinion != null && GameEngine.GameState.CurrentPlayerPlayZone.Contains(targetMinion))
     {
         this.Owner.Armor++;
     }
 }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:8,代码来源:Armorsmith.cs

示例9: Activate

 public override void Activate(IDamageableEntity target = null, CardEffect cardEffect = CardEffect.NONE)
 {
     int totalSpellDamage = MAX_SPELL_POWER + this.BonusSpellPower;
     GameEngine.GameState.CurrentPlayer.TakeDamage(totalSpellDamage);
     GameEngine.GameState.WaitingPlayer.TakeDamage(totalSpellDamage);
     GameEngine.GameState.CurrentPlayerPlayZone.Where(card => card != null).ToList().ForEach(card => ((IDamageableEntity)card).TakeDamage(totalSpellDamage));
     GameEngine.GameState.WaitingPlayerPlayZone.Where(card => card != null).ToList().ForEach(card => ((IDamageableEntity)card).TakeDamage(totalSpellDamage));
 }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:8,代码来源:Hellfire.cs

示例10: DeathrattleHealTarget

        /// <summary>
        /// Constructs an instance of DeathrattleHealTarget
        /// </summary>
        /// <param name="owner">The owner of the deathrattle</param>
        /// <param name="healTarget">The target to heal</param>
        /// <param name="healAmount">The amount to heal</param>
        public DeathrattleHealTarget(BaseCard owner, IDamageableEntity healTarget, int healAmount)
        {
            if (owner == null) throw new ArgumentNullException("owner");
            if (healTarget == null) throw new ArgumentNullException("healTarget");

            this.owner = owner;
            this.healTarget = healTarget;
            this.healAmount = healAmount;
        }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:15,代码来源:DeathrattleHealTarget.cs

示例11: Battlecry

        public void Battlecry(IDamageableEntity subTarget)
        {
            if (subTarget is BasePlayer)
            {
                throw new InvalidOperationException("Can't buff players!");
            }

            subTarget.TakeTemporaryBuff(BATTLECRY_POWER);
        }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:9,代码来源:AbusiveSergeant.cs

示例12: Battlecry

        public void Battlecry(IDamageableEntity subTarget)
        {
            var targetPlayer = subTarget as BasePlayer;
            if (targetPlayer == null)
            {
                throw new InvalidOperationException("Target must be a player!");
            }

            targetPlayer.Health = 15;
        }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:10,代码来源:Alexstrasza.cs

示例13: OnHealing

        private void OnHealing(BasePlayer healer, IDamageableEntity target, int healAmount, out bool shouldAbort)
        {
            shouldAbort = false;

            if (healer == this.Owner)
            {
                shouldAbort = true;
                // Instead, do damage!
                target.TakeDamage(healAmount);
            }
        }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:11,代码来源:AuchenaiSoulpriest.cs

示例14: Activate

        public override void Activate(IDamageableEntity target = null, CardEffect cardEffect = CardEffect.NONE)
        {
            if (target == null)
            {
                throw new ArgumentNullException("Fireball must be cast with target in mind");
            }

            // Deal damage to the target
            var damageToDeal = MAX_SPELL_POWER + this.BonusSpellPower;
            target.TakeDamage(damageToDeal);
        }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:11,代码来源:Fireball.cs

示例15: Attack

        public virtual void Attack(IDamageableEntity target)
        {
            // Fire attacking event
            bool shouldAbort;
            GameEventManager.Attacking(this, target, isRetaliation: false, shouldAbort: out shouldAbort);

            if (!shouldAbort)
            {
                // Use up a durability charge
                this.TakeDamage(1);
                GameEngine.TriggerDeathrattles();
            }
        }
开发者ID:kwluo90,项目名称:HearthAnalyzer,代码行数:13,代码来源:BaseWeapon.cs


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