本文整理匯總了C#中WCell.RealmServer.Entities.WorldObject.IsBehind方法的典型用法代碼示例。如果您正苦於以下問題:C# WorldObject.IsBehind方法的具體用法?C# WorldObject.IsBehind怎麽用?C# WorldObject.IsBehind使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WCell.RealmServer.Entities.WorldObject
的用法示例。
在下文中一共展示了WorldObject.IsBehind方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CheckValidTarget
/// <summary>
/// Checks whether the given target is valid for the given caster.
/// Is called automatically when SpellCast selects Targets.
/// Does not do maximum range check.
/// </summary>
public SpellFailedReason CheckValidTarget(WorldObject caster, WorldObject target)
{
if (target is Unit)
{
// AuraState
if (RequiredTargetAuraState != 0 || ExcludeTargetAuraState != 0)
{
var state = ((Unit)target).AuraState;
if ((RequiredTargetAuraState != 0 && !state.HasAnyFlag(RequiredTargetAuraState)) ||
(ExcludeTargetAuraState != 0 && state.HasAnyFlag(ExcludeTargetAuraState)))
{
return SpellFailedReason.TargetAurastate;
}
}
// Required Auras
if ((ExcludeTargetAuraId != 0 && ((Unit)target).Auras.Contains(ExcludeTargetAuraId)) ||
(RequiredTargetAuraId != 0 && !((Unit)target).Auras.Contains(RequiredTargetAuraId)))
{
return SpellFailedReason.TargetAurastate;
}
}
// Make sure that we have a GameObject if the Spell requires one
if (TargetFlags.HasAnyFlag(SpellTargetFlags.UnkUnit_0x100) &&
(!(target is GameObject) || !target.IsInWorld))
{
return SpellFailedReason.BadTargets;
}
// CreatureTypes
if (TargetCreatureTypes != TargetCreatureMask.None &&
(!(target is NPC) || !((NPC)target).CheckCreatureType(TargetCreatureTypes)))
{
return SpellFailedReason.BadImplicitTargets;
}
if (!CanCastOnPlayer && target is Character)
{
return SpellFailedReason.BadImplicitTargets;
}
// Corpse target
if (ReqDeadTarget)
{
if (TargetFlags.HasAnyFlag(SpellTargetFlags.PvPCorpse | SpellTargetFlags.Corpse))
{
if (!(target is Corpse) ||
(TargetFlags.HasAnyFlag(SpellTargetFlags.PvPCorpse) && !caster.IsHostileWith(target)))
{
return SpellFailedReason.BadImplicitTargets;
}
}
else if (!(target is NPC) || ((NPC)target).IsAlive || target.Loot != null)
{
// need to be dead and looted empty
return SpellFailedReason.TargetNotDead;
}
}
else
{
if (target is Unit && !((Unit)target).IsAlive)
{
return SpellFailedReason.TargetsDead;
}
}
// Rogues do it from behind
if (AttributesExB.HasFlag(SpellAttributesExB.RequiresBehindTarget))
{
if (!caster.IsBehind(target))
{
return SpellFailedReason.NotBehind;
}
}
if (AttributesExC.HasFlag(SpellAttributesExC.NoInitialAggro))
{
if (target is Unit && ((Unit)target).IsInCombat)
{
return SpellFailedReason.TargetAffectingCombat;
}
}
if (Range.MinDist > 0 &&
//caster.IsInRadius(target, caster.GetSpellMinRange(Range.MinDist, target)))
caster.IsInRadius(target, Range.MinDist))
{
return SpellFailedReason.TooClose;
}
return SpellFailedReason.Ok;
}