/**********************************************************
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\Dark Palace\Mobiles\DarkLord.cs
Lines of code: 105
***********************************************************/


using System;
using Server;
using Server.Items;

namespace Server.Mobiles
{
	[CorpseName( "a demonic corpse" )]
	public class DarkLord : BaseCreature
	{
		public override bool AlwaysMurderer{ get{ return true; } }
		public override bool IgnoreYoungProtection { get { return true; } }

		private bool m_Stunning;
		[Constructable]
		public DarkLord () : base( AIType.AI_Super, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = "a dark lord";
			Body = 40;
			Hue = 2406;
			BaseSoundID = 357;

			SetStr( 986, 1185 );
			SetDex( 177, 255 );
			SetInt( 850 );

			SetHits( 2500, 3000 );

			SetDamage( 22, 29 );

			SetDamageType( ResistanceType.Physical, 25 );
			SetDamageType( ResistanceType.Energy, 25 );
			SetDamageType( ResistanceType.Fire, 50 );

			SetResistance( ResistanceType.Physical, 100 );
			SetResistance( ResistanceType.Fire, 50, 80 );
			SetResistance( ResistanceType.Cold, 40, 65 );
			SetResistance( ResistanceType.Poison, 100 );
			SetResistance( ResistanceType.Energy, 60, 65 );

			SetSkill( SkillName.Anatomy, 25.1, 50.0 );
			SetSkill( SkillName.EvalInt, 90.1, 100.0 );
			SetSkill( SkillName.Magery, 95.5, 100.0 );
			SetSkill( SkillName.Meditation, 25.1, 50.0 );
			SetSkill( SkillName.MagicResist, 100.5, 150.0 );
			SetSkill( SkillName.Tactics, 90.1, 100.0 );
			SetSkill( SkillName.Wrestling, 90.1, 100.0 );

			Fame = 24000;
			Karma = -24000;

			VirtualArmor = 90;

			PackItem( new Longsword() );
			PackItem( new Gold( Utility.RandomMinMax( 11510, 18000 ) ) );
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.FilthyRich, 2 );
			AddLoot( LootPack.SuperBoss );
			AddLoot( LootPack.MedScrolls, 2 );
		}

		public override bool CanRummageCorpses{ get{ return true; } }
		public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
		public override int TreasureMapLevel{ get{ return 5; } }
		public override PackInstinct PackInstinct{ get{ return PackInstinct.Daemon; } }
		public override bool BardImmune{ get{ return true; } }
		public override bool ReacquireOnMovement{ get{ return true; } } 

		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );

			if ( !m_Stunning && 0.3 > Utility.RandomDouble() )
			{
				m_Stunning = true;

				defender.Animate( 111, 5, 1, true, false, 0 );
				this.PlaySound( 0xEE );
				defender.Say("*Paralyzed by fear!*");
				defender.FixedParticles( 0x375A, 1, 17, 9919, 0x96C, 7, EffectLayer.Waist );
				defender.FixedParticles( 0x3728, 1, 13, 9502, 0x96C, 7, (EffectLayer)255 );
				defender.SendMessage("You are paralyzed by fear!");

				BaseWeapon weapon = this.Weapon as BaseWeapon;
				if ( weapon != null )
					weapon.OnHit( this, defender );

				if ( defender.Alive )
				{
					defender.Frozen = true;
					Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), new TimerStateCallback( Recover_Callback ), defender );
				}
			}
		}

		private void Recover_Callback( object state )
		{
			Mobile defender = state as Mobile;

			if ( defender != null )
			{
				defender.Frozen = false;
				defender.Combatant = null;
				defender.SendMessage("You snap out of it!");
			}

			m_Stunning = false;
		}

		private DateTime m_NextAbilityTime;

		public DarkLord( 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();
		}
	}
}