本文整理汇总了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();
}
}
示例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();
}
}
示例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!");
}
}
示例4: Battlecry
public void Battlecry(IDamageableEntity subTarget)
{
BaseWeapon weapon = GameEngine.GameState.CurrentPlayer.Weapon;
if (weapon != null) {
weapon.TakeBuff(BATTLECRY_BUFF_VALUE, BATTLECRY_BUFF_VALUE);
}
}
示例5: Battlecry
public void Battlecry(IDamageableEntity subTarget)
{
if (this.Owner.Weapon != null)
{
this.TakeBuff(this.Owner.Weapon.CurrentAttackPower, 0);
}
}
示例6: Battlecry
public void Battlecry(IDamageableEntity subTarget)
{
var enemy = GameEngine.GameState.WaitingPlayer;
if (enemy.Weapon != null)
{
enemy.Weapon.Die();
}
}
示例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;
}
示例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++;
}
}
示例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));
}
示例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;
}
示例11: Battlecry
public void Battlecry(IDamageableEntity subTarget)
{
if (subTarget is BasePlayer)
{
throw new InvalidOperationException("Can't buff players!");
}
subTarget.TakeTemporaryBuff(BATTLECRY_POWER);
}
示例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;
}
示例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);
}
}
示例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);
}
示例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();
}
}