/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\mobiles\ml\CuSidhe.cs
Lines of code: 131
***********************************************************/


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

namespace Server.Mobiles
{
[CorpseName( "a Cu Sidhe corpse" )]
	public class CuSidhe : BaseMount
	{
        public override WeaponAbility GetWeaponAbility() { return WeaponAbility.BleedAttack; }
        
		[Constructable]
		public CuSidhe() : this( "a Cu Sidhe" )
		{
		}
		
		[Constructable]
		public CuSidhe( string name ) : base( name, 277, 0x3e91, AIType.AI_Melee, FightMode.Evil, 10, 1, 0.2, 0.4 )
		{
			BaseSoundID = 0xE5;
            Hue = 0;
            if (Utility.Random(12) == 1) Hue = Utility.RandomList(593, 2425, 2419, 2219, 2413, 2207, 2418, 2213, 1278, 26, 96, 900);
            else if (Utility.Random(24) == 1) Hue = Utility.RandomList(1643, 2406);
            else if (Utility.Random(50) == 1) Hue = Utility.RandomList(1150,1153);
            else if (Utility.Random(75) == 1) Hue = Utility.RandomList(1161);

			SetStr( 1200, 1225 );
			SetDex( 150, 170 );
			SetInt( 250, 285 );

			SetHits( 1010, 1200 );
			
			SetDamage( 21, 28 );

            SetDamageType(ResistanceType.Physical, 0);
			SetDamageType( ResistanceType.Energy, 50 );
			SetDamageType( ResistanceType.Cold, 50 );			

			SetResistance( ResistanceType.Physical, 45, 65 );
			SetResistance( ResistanceType.Fire, 27, 45 );
			SetResistance( ResistanceType.Cold, 70, 85 );
			SetResistance( ResistanceType.Poison, 30, 50 );
			SetResistance( ResistanceType.Energy, 70, 85 );
			
			SkillsCap=8000;

			SetSkill( SkillName.MagicResist, 50, 100 );
			SetSkill( SkillName.Tactics, 50, 100 );
			SetSkill( SkillName.Wrestling, 60, 100 );
            SetSkill( SkillName.Anatomy, 50, 100 );
            SetSkill( SkillName.Healing, 60, 100 );
            ;SetSkill( SkillName.AnimalLore, 100 );
            ;SetSkill(SkillName.Veterinary, 100);

			Fame = 10000;
			Karma = -10000;

			VirtualArmor = 75;

            PackGold(1000, 1300);
            PackItem(new Bandage(Utility.RandomMinMax(5, 15)));

			Tamable = true;
			ControlSlots = 4;
			MinTameSkill = 101.1;
		}
		
		public override bool StatLossAfterTame{ get{ return true; } }
		
		private void UseBandage(Mobile healtarget)
		{
			//check if beneficial target is pending
			Target targ = this.Target;
			
			if(targ!=null && ((targ.Flags & TargetFlags.Beneficial) != 0) && healtarget!=null)
			{
			if(InRange(healtarget,1))targ.Invoke( this, healtarget );
			else 
			return;
			}

			//ensure we did not already recently double click a bandage, and just pending for heal
			if(BandageContext.GetContext( this )!=null)return;
					
			//we don't have a target, so we'll double click a bandage instead		
			Bandage band = new Bandage();
			band.Delete();
			
			band.OnDoubleClick(this);
		}
		

        public override void OnThink()
        {
			base.OnThink();

			if((Hits<HitsMax || Poison!=null) && 0.5>Utility.RandomDouble() && !MortalStrike.IsWounded( this))UseBandage(this);
			
			Mobile owner=null;
			
			if(ControlMaster!=null)owner=ControlMaster;
			else if(SummonMaster!=null)owner=SummonMaster;
			
			if(owner!=null && owner.InRange(this,2) && !MortalStrike.IsWounded( owner))UseBandage(owner);			
        }
			
			
		
		public override void OnDoubleClick( Mobile from )
		{
			if(from==null)return;
			Item a = from.FindItemOnLayer(Layer.Shoes);
			if (( a != null && a is PadsOfTheCuSidhe) || (from.Race==Race.Elf))base.OnDoubleClick(from);
			else	from.SendMessage("You must be elf or wear pads of the Cusidhe to mount this!");	
		}
        

		public override void GenerateLoot()
		{
			AddLoot( LootPack.FilthyRich );			
		}

        public override int GetIdleSound()
        {
            return 1399;
        }

        public override int GetDeathSound()
        {
            return 1397;
        }

        public override int GetAttackSound()
        {
            return 1398;
        }

        public override int GetHurtSound()
        {
            return 1401;
        }

        public override int GetAngerSound()
        {
            return 0x577;
        }

		public override int Meat{ get{ return 3; } }
		public override int Hides{ get{ return 5; } }
		public override HideType HideType{ get{ return HideType.Barbed; } }
		public override FoodType FavoriteFood{ get{ return FoodType.Meat | FoodType.FruitsAndVegies; } }
        public override int TreasureMapLevel { get { return 5; } }	
		public override bool IsMLCreature { get { return true;} } 		
          
		public CuSidhe( Serial serial ) : base( serial )
		{
		}

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

			writer.Write( (int) 0 ); // version
		}

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

			int version = reader.ReadInt();
		}
	}
}