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


C# Unit.GetLeastResistant方法代碼示例

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


在下文中一共展示了Unit.GetLeastResistant方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CheckDebuffResist

		/// <summary>
		/// Checks whether the given target resisted the debuff, represented through the given spell
		/// </summary>
		public static CastMissReason CheckDebuffResist(Unit target, Spell spell, int casterLevel, bool hostile)
		{
			var missReason = CastMissReason.None;
			if (hostile && target.CheckDebuffResist(casterLevel, target.GetLeastResistant(spell)))
			{
				missReason = CastMissReason.Resist;
			}
			return missReason;
		}
開發者ID:pallmall,項目名稱:WCell,代碼行數:12,代碼來源:SpellCast.Aura.cs

示例2: CheckCastHit

		/// <summary>
		/// Indicates whether a spell hit a target or not
		/// </summary>
		public CastMissReason CheckCastHit(Unit target, Spell spell)
		{
			if (Caster.MayAttack(target))
			{
				if (target.IsEvading)
				{
					return CastMissReason.Evade;
				}

				if (!spell.Attributes.Has(SpellAttributes.UnaffectedByInvulnerability) ||
					(target is Character && ((Character)target).Role.IsStaff))
				{
					if (target.IsInvulnerable)
					{
						return CastMissReason.Immune_2;
					}

					var immune = true;
					for (var i = 0; i < spell.Schools.Length; i++)
					{
						var school = spell.Schools[i];
						if (!target.IsImmune(school))
						{
							immune = false;
							break;
						}
					}
					if (immune)
					{
						return CastMissReason.Immune;
					}
				}

				if (target.CheckResist(CasterUnit, target.GetLeastResistant(spell), spell.Mechanic) && !spell.AttributesExB.Has(SpellAttributesExB.CannotBeResisted))
				{
					return CastMissReason.Resist;
				}
			}

			return CastMissReason.None;
		}
開發者ID:pallmall,項目名稱:WCell,代碼行數:44,代碼來源:SpellCast.cs

示例3: CheckCastHit

		/// <summary>
		/// Indicates whether a spell hit a target or not
		/// TODO: Actually check whether a spell 'Misses' (CastMissReason.Miss)
		/// </summary>
		public CastMissReason CheckCastHit(Unit target, Spell spell)
		{
			if (Caster.MayAttack(target))
			{
				var school = target.GetLeastResistant(spell);
				// evasion
				if (target.IsEvading)
				{
					return CastMissReason.Evade;
				}
				// immune & invul
                if (!spell.Attributes.HasFlag(SpellAttributes.UnaffectedByInvulnerability) ||
					(target is Character && ((Character)target).Role.IsStaff))
				{
					if (target.IsInvulnerable)
					{
						return CastMissReason.Immune_2;
					}

					if (spell.Schools.All(target.IsImmune))
					{
						return CastMissReason.Immune;
					}
				}

				//// avoid/miss
				//var avoidance = target.GetSpellAvoidancePct(school);
				//if (avoidance > 0 && Utility.Random(1, 101) < avoidance)
				//{
				//    return CastMissReason.Miss;
				//}


				// resist
                if (target.CheckResist(CasterUnit, school, spell.Mechanic) && !spell.AttributesExB.HasFlag(SpellAttributesExB.CannotBeResisted))
				{
					return CastMissReason.Resist;
				}
			}

			return CastMissReason.None;
		}
開發者ID:ray2006,項目名稱:WCell,代碼行數:46,代碼來源:SpellCast.cs


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