Ejemplo n.º 1
0
		/// <summary>
		/// Calculates the chance to hit the given defender with a spell of the given school
		/// </summary>
		/// <returns>The effective hitchance</returns>
		public float CalcSpellHitChance(Unit defender, DamageSchool dmgSchool, float resistChance)
		{
			float res = GetResistance(dmgSchool);

			if (this is Character && defender is Character) //pvp has diffrent values compared to pve
			{
				res += (float)(99.24f / (1 + 0.0281f * Math.Log((0.516f * (defender.Level - Level)), MathUtil.E)));
			}
			else
			{
				res += (float)(98.77f / (1 + 0.0215f * Math.Log((0.6862f * (defender.Level - Level)), MathUtil.E)));
			}

			res *= resistChance;

			res -= defender.GetAttackerSpellHitChanceMod(dmgSchool);

			if (res < 1)
			{
				res = 1;
			}

			return res;
		}