Ejemplo n.º 1
0
        /// <summary>
        /// Calculates this Unit's chance to resist the given school.
        /// Value is between 0 and 100
        /// </summary>
        public float GetResistChancePct(Unit attacker, DamageSchool school)
        {
            int attackerLevel;
            var res = GetResistance(school);

            if (attacker != null)
            {
                attackerLevel = Math.Max(1, attacker.Level);
                res          -= attacker.GetTargetResistanceMod(school);
            }
            else
            {
                attackerLevel = 1;
            }

            res = Math.Max(0, res);

            var resist = (res / (attackerLevel * 5f)) * 0.75f;

            if (resist > 75)
            {
                resist = 75f;
            }

            if (resist < 0)
            {
                resist = 0;
            }

            return(resist);
        }
Ejemplo n.º 2
0
		/// <summary>
		/// Calculates this Unit's chance to resist the given school.
		/// Value is between 0 and 100
		/// </summary>
		public float GetResistChancePct(Unit attacker, DamageSchool school)
		{
			int attackerLevel;
			var res = GetResistance(school);
			if (attacker != null)
			{
				attackerLevel = Math.Max(1, attacker.Level);
				res -= attacker.GetTargetResistanceMod(school);
			}
			else
			{
				attackerLevel = 1;
			}

			res = Math.Max(0, res);

			var resist = (res / (attackerLevel * 5f)) * 0.75f;

			if (resist > 75)
			{
				resist = 75f;
			}

			if (resist < 0)
			{
				resist = 0;
			}

			return resist;
		}