Server.Items.BaseWeapon.CheckHit C# (CSharp) Method

CheckHit() public method

public CheckHit ( Mobile attacker, Mobile defender ) : bool
attacker Mobile
defender Mobile
return bool
		public virtual bool CheckHit( Mobile attacker, Mobile defender )
		{
			BaseWeapon atkWeapon = attacker.Weapon as BaseWeapon;
			BaseWeapon defWeapon = defender.Weapon as BaseWeapon;

			Skill atkSkill = attacker.Skills[atkWeapon.Skill];
			Skill defSkill = defender.Skills[defWeapon.Skill];

			double atkValue = atkWeapon.GetAttackSkillValue( attacker, defender );
			double defValue = defWeapon.GetDefendSkillValue( attacker, defender );

			double ourValue, theirValue;

			if ( atkValue <= -50.0 )
				atkValue = -49.9;

			if ( defValue <= -50.0 )
				defValue = -49.9;

			ourValue = (atkValue + 50.0);
			theirValue = (defValue + 50.0);

			double chance = ourValue / (theirValue * 2.0);

			return attacker.CheckSkill( atkSkill.SkillName, chance );
		}