All pastes #2049427 Raw Edit

Untitled

public text v1 · immutable
#2049427 ·published 2011-04-22 18:31 UTC
rendered paste body
// Tracking players uses tracking and detect hidden vs. hiding and stealth 
		private static bool CheckDifficulty( Mobile from, Mobile m )
		{
			if ( !Core.AOS || !m.Player )
				return true;



			int tracking = from.Skills[SkillName.Tracking].Fixed;	
			int detectHidden = from.Skills[SkillName.DetectHidden].Fixed;

			if( Core.ML && m.Race == Race.Elf )
				tracking /= 2; //The 'Guide' says that it requires twice as Much tracking SKILL to track an elf.  Not the total difficulty to track.

			int hiding = m.Skills[SkillName.Hiding].Fixed;
			int stealth = m.Skills[SkillName.Stealth].Fixed;
			int divisor = hiding + stealth;

			// Necromancy forms affect tracking difficulty 
			if ( TransformationSpellHelper.UnderTransformation( m, typeof( HorrificBeastSpell ) ) )
				divisor -= 200;
			else if ( TransformationSpellHelper.UnderTransformation( m, typeof( VampiricEmbraceSpell ) ) && divisor < 500 )
				divisor = 500;
			else if ( TransformationSpellHelper.UnderTransformation( m, typeof( WraithFormSpell ) ) && divisor <= 2000 )
				divisor += 200;

			int chance;
			if ( divisor > 0 )
			{
				if ( Core.SE )
					chance = 50 * (tracking * 2 + detectHidden) / divisor;
				else
					chance = 50 * (tracking + detectHidden + 10 * Utility.RandomMinMax( 1, 20 )) / divisor;
			}
			else
				chance = 100;

			return chance > Utility.Random( 100 );
		}