Server.Misc.SkillCheck.CheckSkill C# (CSharp) Méthode

CheckSkill() public static méthode

public static CheckSkill ( Server.Mobile from, Skill skill, object amObj, double chance ) : bool
from Server.Mobile
skill Server.Skill
amObj object
chance double
Résultat bool
		public static bool CheckSkill( Mobile from, Skill skill, object amObj, double chance )
		{
			if ( from.Skills.Cap == 0 )
				return false;

			bool success = ( chance >= Utility.RandomDouble() );
			double gc = (double)(from.Skills.Cap - from.Skills.Total) / from.Skills.Cap;
			gc += ( skill.Cap - skill.Base ) / skill.Cap;
			gc /= 2;

			gc += ( 1.0 - chance ) * ( success ? 0.5 : 0.2 );
			gc /= 2;

			gc *= skill.Info.GainFactor;

			if ( gc < 0.01 )
				gc = 0.01;

			if ( from is BaseCreature && ((BaseCreature)from).Controlled )
				gc *= 2;

			if ( from.Alive && ( ( gc >= Utility.RandomDouble() && AllowGain( from, skill, amObj ) ) || skill.Base < 10.0 ) )
				Gain( from, skill );

			return success;
		}