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


C# Unit.IsUnderInfluenceOf方法代碼示例

本文整理匯總了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
//.........這裏部分代碼省略.........
開發者ID:Skizot,項目名稱:WCell,代碼行數:101,代碼來源:Spell.CastParams.cs

示例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)))
//.........這裏部分代碼省略.........
開發者ID:enjoii,項目名稱:WCell,代碼行數:101,代碼來源:Spell.CastParams.cs


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