本文整理汇总了C#中WCell.RealmServer.Entities.Unit.IsUnderInfluenceOf方法的典型用法代码示例。如果您正苦于以下问题:C# Unit.IsUnderInfluenceOf方法的具体用法?C# Unit.IsUnderInfluenceOf怎么用?C# Unit.IsUnderInfluenceOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WCell.RealmServer.Entities.Unit
的用法示例。
在下文中一共展示了Unit.IsUnderInfluenceOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckCasterConstraints
/// <summary>
/// Checks whether the given spell can be casted by the casting Unit
/// </summary>
public SpellFailedReason CheckCasterConstraints(Unit caster)
{
// check for combat
if (caster.IsInCombat && RequiresCasterOutOfCombat)
{
return SpellFailedReason.AffectingCombat;
}
// Power Type
if (CostsMana && PowerType != caster.PowerType && PowerType != PowerType.Health)
{
return SpellFailedReason.NoPower;
}
// Stealth Required
if (Attributes.HasAnyFlag(SpellAttributes.RequiresStealth) && caster.Stealthed < 1)
{
return SpellFailedReason.OnlyStealthed;
}
if (!caster.CanDoHarm && HasHarmfulEffects)
{
return SpellFailedReason.Pacified;
}
// Not while silenced
if (InterruptFlags.HasFlag(InterruptFlags.OnSilence) && caster.IsUnderInfluenceOf(SpellMechanic.Silenced))
{
return SpellFailedReason.Silenced;
}
// Check if castable while stunned
if (!AttributesExD.HasFlag(SpellAttributesExD.UsableWhileStunned) && !caster.CanInteract)
{
return SpellFailedReason.CantDoThatRightNow;
}
// Combo points
if (IsFinishingMove && caster.ComboPoints == 0)
{
return SpellFailedReason.NoComboPoints;
}
// spell focus
if (!CheckSpellFocus(caster))
{
return SpellFailedReason.RequiresSpellFocus;
}
// shapeshift
if (Attributes.HasFlag(SpellAttributes.NotWhileShapeshifted) &&
caster.ShapeshiftForm != ShapeshiftForm.Normal)
{
//return SpellFailedReason.NotShapeshift;
}
// Stealth Required
else if (Attributes.HasFlag(SpellAttributes.RequiresStealth) && caster.Stealthed < 1)
{
return SpellFailedReason.OnlyStealthed;
}
// Not while silenced
else if (InterruptFlags.HasFlag(InterruptFlags.OnSilence) &&
caster.IsUnderInfluenceOf(SpellMechanic.Silenced))
{
return SpellFailedReason.Silenced;
}
else if (!caster.CanDoHarm && HasHarmfulEffects)
{
return SpellFailedReason.Pacified;
}
else if (!AttributesExD.HasFlag(SpellAttributesExD.UsableWhileStunned) && !caster.CanInteract)
{
return SpellFailedReason.Stunned;
}
else if (!caster.CanCastSpells)
{
return SpellFailedReason.Interrupted;
}
// Combo points
else if (IsFinishingMove && caster.ComboPoints == 0)
{
return SpellFailedReason.NoComboPoints;
}
// spell focus
if (!CheckSpellFocus(caster))
{
return SpellFailedReason.RequiresSpellFocus;
}
// shapeshift
//if (Attributes.Has(SpellAttributes.NotWhileShapeshifted) && caster.ShapeShiftForm != ShapeShiftForm.Normal)
{
//return SpellFailedReason.NotShapeshift;
}
// AuraStates
//.........这里部分代码省略.........
示例2: CheckCasterConstraints
/// <summary>
/// Checks whether the given spell can be casted by the casting Unit.
/// Does not do range checks.
/// </summary>
public SpellFailedReason CheckCasterConstraints(Unit caster)
{
// check for combat
if (caster.IsInCombat && RequiresCasterOutOfCombat)
{
return SpellFailedReason.AffectingCombat;
}
// Power Type
if (CostsPower &&
PowerType != caster.PowerType &&
PowerType != PowerType.Health &&
!AttributesExB.HasFlag(SpellAttributesExB.DoesNotNeedShapeshift))
{
return SpellFailedReason.OnlyShapeshift;
}
// Stealth Required
if (Attributes.HasAnyFlag(SpellAttributes.RequiresStealth) && caster.Stealthed < 1)
{
return SpellFailedReason.OnlyStealthed;
}
if (!caster.CanDoHarm && HasHarmfulEffects)
{
return SpellFailedReason.Pacified;
}
// Not while silenced
if (InterruptFlags.HasFlag(InterruptFlags.OnSilence) && caster.IsUnderInfluenceOf(SpellMechanic.Silenced))
{
return SpellFailedReason.Silenced;
}
// Check if castable while stunned
if (!AttributesExD.HasFlag(SpellAttributesExD.UsableWhileStunned) && !caster.CanInteract)
{
return SpellFailedReason.CantDoThatRightNow;
}
// Combo points
if (IsFinishingMove && caster.ComboPoints == 0)
{
return SpellFailedReason.NoComboPoints;
}
// spell focus
if (!CheckSpellFocus(caster))
{
return SpellFailedReason.RequiresSpellFocus;
}
// Not while silenced
else if (!caster.CanCastSpells &&
(!IsPhysicalAbility ||
(InterruptFlags.HasFlag(InterruptFlags.OnSilence) &&
caster.IsUnderInfluenceOf(SpellMechanic.Silenced))))
{
return SpellFailedReason.Silenced;
}
// cannot use physical ability or not do harm at all
else if ((!caster.CanDoPhysicalActivity && IsPhysicalAbility) ||
(!caster.CanDoHarm && HasHarmfulEffects))
{
return SpellFailedReason.Pacified;
}
else if (!AttributesExD.HasFlag(SpellAttributesExD.UsableWhileStunned) && !caster.CanInteract)
{
return SpellFailedReason.Stunned;
}
// Combo points
else if (IsFinishingMove && caster.ComboPoints == 0)
{
return SpellFailedReason.NoComboPoints;
}
// spell focus
if (!CheckSpellFocus(caster))
{
return SpellFailedReason.RequiresSpellFocus;
}
// AuraStates
if (RequiredCasterAuraState != 0 || ExcludeCasterAuraState != 0)
{
// check AuraStates
var state = caster.AuraState;
if ((RequiredCasterAuraState != 0 && !state.HasAnyFlag(RequiredCasterAuraState)) ||
(ExcludeCasterAuraState != 0 && state.HasAnyFlag(ExcludeCasterAuraState)))
{
return SpellFailedReason.CasterAurastate;
}
}
// Required Auras
if ((ExcludeCasterAuraId != 0 && caster.Auras.Contains(ExcludeCasterAuraId)) ||
(RequiredCasterAuraId != 0 && !caster.Auras.Contains(RequiredCasterAuraId)))
//.........这里部分代码省略.........