本文整理汇总了C#中WCell.RealmServer.Entities.Unit.IsImmune方法的典型用法代码示例。如果您正苦于以下问题:C# Unit.IsImmune方法的具体用法?C# Unit.IsImmune怎么用?C# Unit.IsImmune使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WCell.RealmServer.Entities.Unit
的用法示例。
在下文中一共展示了Unit.IsImmune方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckImmune
/// <summary>
/// Returns whether the spell can be casted (true) or if immunity of the target prevents it (false)
/// </summary>
public static bool CheckImmune(Unit target, Spell spell, bool hostile)
{
if (spell.Mechanic != SpellMechanic.None &&
hostile == spell.Mechanic.IsNegative() &&
((spell.Mechanic == SpellMechanic.Invulnerable_2 || spell.Mechanic == SpellMechanic.Invulnerable) &&
!spell.Attributes.HasFlag(SpellAttributes.UnaffectedByInvulnerability) &&
(target.IsImmune(SpellMechanic.Invulnerable_2) || target.IsImmune(SpellMechanic.Invulnerable))) ||
(target.IsImmune(spell.Mechanic) || target.IsImmune(spell.DispelType)))
{
return false;
}
return true;
}
示例2: IsImmune
/// <summary>
/// Returns whether the given target is immune to the given spell
/// </summary>
public static bool IsImmune(Unit target, Spell spell, bool hostile)
{
if (
hostile &&
spell.Mechanic.IsNegative() &&
!spell.Attributes.HasFlag(SpellAttributes.UnaffectedByInvulnerability) &&
(spell.Mechanic == SpellMechanic.Invulnerable_2 || spell.Mechanic == SpellMechanic.Invulnerable) &&
(
// immune against spell
target.IsInvulnerable ||
target.IsImmune(SpellMechanic.Invulnerable_2) ||
target.IsImmune(SpellMechanic.Invulnerable) ||
target.IsImmune(spell.Mechanic) ||
target.IsImmune(spell.DispelType)
)
)
{
return true;
}
return false;
}
示例3: CheckCastHit
/// <summary>
/// Indicates whether a spell hit a target or not
/// </summary>
public CastMissReason CheckCastHit(Unit target, Spell spell)
{
if (Caster.MayAttack(target))
{
if (target.IsEvading)
{
return CastMissReason.Evade;
}
if (!spell.Attributes.Has(SpellAttributes.UnaffectedByInvulnerability) ||
(target is Character && ((Character)target).Role.IsStaff))
{
if (target.IsInvulnerable)
{
return CastMissReason.Immune_2;
}
var immune = true;
for (var i = 0; i < spell.Schools.Length; i++)
{
var school = spell.Schools[i];
if (!target.IsImmune(school))
{
immune = false;
break;
}
}
if (immune)
{
return CastMissReason.Immune;
}
}
if (target.CheckResist(CasterUnit, target.GetLeastResistant(spell), spell.Mechanic) && !spell.AttributesExB.Has(SpellAttributesExB.CannotBeResisted))
{
return CastMissReason.Resist;
}
}
return CastMissReason.None;
}