/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\engines\ML Peerless + misc areas\demitel\MirageDesert\DesertSeeker.cs
Lines of code: 109
***********************************************************/


using System;
using Server.Mobiles;
using System.Collections;
using Server;
using Server.Items;

namespace Server.Mobiles
{
	[CorpseName("a desert seeker corpse")]
	public class DesertSeeker : BaseCreature
	{
	
		public override WeaponAbility GetWeaponAbility()
		{
			switch ( Utility.Random( 1 ) )
			{
				default:
				case 0: return WeaponAbility.Dismount;
				case 1: return WeaponAbility.ParalyzingBlow;
			}
		}

		[Constructable]
		public DesertSeeker() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = "a desert hunter";
			Body = 51;
			Body = 8;
			BaseSoundID = 684;
			Hue = 2413; 

			SetStr( 500 );
			SetDex( 300, 600 );
			SetInt( 100, 100 );

			SetHits( 500, 500 );

			SetDamage( 35, 35 );

			if ( 1.0 > Utility.RandomDouble() )
			{
				this.Hidden = true;
				this.AllowedStealthSteps = 2000;
			}
			
			SetDamageType( ResistanceType.Physical, 75 );
			SetDamageType( ResistanceType.Energy, 25 );

			ActiveSpeed = 1;
			CurrentSpeed = 1;
			PassiveSpeed = 1;

			SetResistance( ResistanceType.Physical, 100, 100 );
			SetResistance( ResistanceType.Fire, 100 );
			SetResistance( ResistanceType.Cold, 20 );
			SetResistance( ResistanceType.Poison, 100 );
			SetResistance( ResistanceType.Energy, 90 );

			SetSkill( SkillName.MagicResist, 95.1, 100.0 );
			SetSkill( SkillName.Tactics, 90);
			SetSkill( SkillName.Wrestling, 120 );
			SetSkill( SkillName.Stealth, 120 );

			Fame = 25000;
			Karma = -25000;

			VirtualArmor = 40;
				
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.UltraRich, 8 );
			AddLoot( LootPack.Gems, 2 );
		}

		public override void OnGaveMeleeAttack(Mobile defender)
 		{
			if ( 0.4 > Utility.RandomDouble() && this.Hidden == false)
			{
				this.Hidden = true;
				this.AllowedStealthSteps = 200;
				this.Stam = 600;
			}
			base.OnGaveMeleeAttack(defender);
		}

		public override void OnDamage( int amount, Mobile attacker, bool willKill ) 
		{
		if(attacker==null)return;
			
			if ( 0.5 > Utility.RandomDouble() && this.Hidden == false) //Stealth jumping
			{
				this.Hidden = true;
				Map map = attacker.Map;

				
				int x = this.X + Utility.RandomMinMax( -8, 8 );
				int y = this.Y + Utility.RandomMinMax( -8, 8 );
				int z = this.Z;
				if ( map!=null && map.CanSpawnMobile( new Point3D( x, y, z) ) )
					{
					this.MoveToWorld( new Point3D( x, y, z ), Map );
					this.AllowedStealthSteps = 200;
					}
			}
			
		}

		public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
		public override bool BleedImmune{ get{ return true; } }
		public override bool IgnoreYoungProtection { get { return true; } }
		public override bool Unprovokable{ get{ return true; } }
		public override bool Uncalmable{ get{ return true; } }

		public DesertSeeker(Serial serial) : base(serial)
		{
		}

		public override void Serialize(GenericWriter writer)
		{
			base.Serialize(writer);

			writer.Write((int) 0);
		}

		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);

			int version = reader.ReadInt();

			if ( BaseSoundID == -1 )
				BaseSoundID = 219;
		}
	}
}