本文整理汇总了C#中WCell.RealmServer.Spells.Spell.MatchesRequiredTargetType方法的典型用法代码示例。如果您正苦于以下问题:C# Spell.MatchesRequiredTargetType方法的具体用法?C# Spell.MatchesRequiredTargetType怎么用?C# Spell.MatchesRequiredTargetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WCell.RealmServer.Spells.Spell
的用法示例。
在下文中一共展示了Spell.MatchesRequiredTargetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
//.........这里部分代码省略.........
// 0x20
if (TargetFlags.HasAnyFlag(SpellTargetFlags.SourceLocation))
{
Map.GetObject(packet.ReadPackedEntityId()); // since 3.2.0
//SourceLoc = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
}
SourceLoc = CasterObject.Position;
// 0x40
if (TargetFlags.HasAnyFlag(SpellTargetFlags.DestinationLocation))
{
selected = Map.GetObject(packet.ReadPackedEntityId());
TargetLoc = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
//Console.WriteLine("SpellCast.Start - DestLoc {0}", TargetLoc);
targetFound = true;
}
// 0x2000
if (TargetFlags.HasAnyFlag(SpellTargetFlags.String))
{
StringTarget = packet.ReadCString();
}
if ((unkFlags & 2) != 0)
{
float f1 = packet.ReadFloat();
float f2 = packet.ReadFloat();
byte b1 = packet.ReadByte();
// here the client appends a MSG_MOVE_STOP movement packet
}
// special cast handler: Interrupt casting and call the handler instead
// for Spell-overrides through Addons
if (spell.SpecialCast != null)
{
spell.SpecialCast(spell, CasterObject, selected, ref m_targetLoc);
Cancel(SpellFailedReason.DontReport);
return SpellFailedReason.DontReport;
}
if (targetFound)
{
// default checks
if (selected != CasterObject)
{
if (CasterObject is Character)
{
// check range
var chr = CasterObject as Character;
var sqDistance = CasterObject.GetDistanceSq(ref m_targetLoc);
if (!Utility.IsInRange(sqDistance, chr.GetSpellMaxRange(spell, selected)) ||
(selected != null && selected.Map != CasterObject.Map))
{
Cancel(SpellFailedReason.OutOfRange);
return SpellFailedReason.OutOfRange;
}
if (Utility.IsInRange(sqDistance, spell.Range.MinDist))
{
Cancel(SpellFailedReason.TooClose);
return SpellFailedReason.TooClose;
}
}
if (selected != null && !selected.IsInWorld)
{
Cancel(SpellFailedReason.OutOfRange);
return SpellFailedReason.OutOfRange;
}
}
Selected = selected;
}
if (spell.RequiredTargetId != 0)
{
// check for custom Targets
if (Selected == null || Selected.EntryId != spell.RequiredTargetId || !spell.MatchesRequiredTargetType(Selected))
{
Cancel(SpellFailedReason.BadTargets);
return SpellFailedReason.BadTargets;
}
}
//if (selected == null && Caster is Unit)
//{
// Selected = ((Unit)Caster).Target;
//}
var reason = Prepare();
if (reason == SpellFailedReason.Ok)
{
return FinishPrepare();
}
//if (CasterChar != null)
//{
// CasterChar.SendSystemMessage("SpellCast (Total): {0} ms", stopwatch.ElapsedTicks / 10000d);
//}
return reason;
}