本文整理汇总了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!");
}
}
示例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);
}
}