本文整理汇总了C#中WCell.RealmServer.Entities.Unit.HasEnoughPowerToCast方法的典型用法代码示例。如果您正苦于以下问题:C# Unit.HasEnoughPowerToCast方法的具体用法?C# Unit.HasEnoughPowerToCast怎么用?C# Unit.HasEnoughPowerToCast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WCell.RealmServer.Entities.Unit
的用法示例。
在下文中一共展示了Unit.HasEnoughPowerToCast方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckCasterConstraints
//.........这里部分代码省略.........
// 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
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)))
{
return SpellFailedReason.CasterAurastate;
}
var spells = caster.Spells as PlayerSpellCollection;
// check cooldown and power cost
if (spells != null && !spells.CheckCooldown(this))
{
return SpellFailedReason.NotReady;
}
if (!IsPassive)
{
if (!caster.HasEnoughPowerToCast(this, null))
{
return SpellFailedReason.NoPower;
}
}
return SpellFailedReason.Ok;
}
示例2: CheckCasterConstraints
//.........这里部分代码省略.........
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)))
{
return SpellFailedReason.CasterAurastate;
}
// Shapeshift
var shapeshiftMask = caster.ShapeshiftMask;
bool ignoreShapeshiftRequirement = false; // use this to allow for lazy requirement lookup
if (ExcludeShapeshiftMask.HasAnyFlag(shapeshiftMask))
{
if (!(ignoreShapeshiftRequirement = caster.Auras.IsShapeshiftRequirementIgnored(this)))
{
return SpellFailedReason.NotShapeshift;
}
}
else if (!RequiredShapeshiftMask.HasAnyFlag(shapeshiftMask))
{
// our mask did not pass -> do the default checks
var shapeshiftEntry = caster.ShapeshiftEntry;
var shapeshifted = shapeshiftEntry != null && (shapeshiftEntry.Flags & ShapeshiftInfoFlags.NotActualShapeshift) == 0;
if (shapeshifted)
{
if (RequiredShapeshiftMask != 0)
{
// When shapeshifted, can only use spells that allow this form
if (!(ignoreShapeshiftRequirement = caster.Auras.IsShapeshiftRequirementIgnored(this)))
{
return SpellFailedReason.OnlyShapeshift;
}
}
else if (Attributes.HasAnyFlag(SpellAttributes.NotWhileShapeshifted))
{
if (!(ignoreShapeshiftRequirement = caster.Auras.IsShapeshiftRequirementIgnored(this)))
{
// cannot cast this spell when shapeshifted
return SpellFailedReason.NotShapeshift;
}
}
}
if (Attributes.HasFlag(SpellAttributes.RequiresStealth) && caster.Stealthed < 1)
{
if (ignoreShapeshiftRequirement || caster.Auras.IsShapeshiftRequirementIgnored(this))
{
// Stealth Required, but not stealthed
return SpellFailedReason.OnlyStealthed;
}
}
}
var spells = caster.Spells as PlayerSpellCollection;
// check cooldown and power cost
if (spells != null && !spells.IsReady(this))
{
return SpellFailedReason.NotReady;
}
if (!IsPassive)
{
if (!caster.HasEnoughPowerToCast(this, null))
{
return SpellFailedReason.NoPower;
}
}
return SpellFailedReason.Ok;
}