當前位置: 首頁>>代碼示例>>C#>>正文


C# Spell.SpecialCast方法代碼示例

本文整理匯總了C#中WCell.RealmServer.Spells.Spell.SpecialCast方法的典型用法代碼示例。如果您正苦於以下問題:C# Spell.SpecialCast方法的具體用法?C# Spell.SpecialCast怎麽用?C# Spell.SpecialCast使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WCell.RealmServer.Spells.Spell的用法示例。


在下文中一共展示了Spell.SpecialCast方法的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);
開發者ID:primax,項目名稱:WCell,代碼行數:67,代碼來源:SpellCast.cs


注:本文中的WCell.RealmServer.Spells.Spell.SpecialCast方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。