/**********************************************************
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\Melisande\Mobiles\InsaneDryad.cs
Lines of code: 176
***********************************************************/


using System;
using System.Collections;
using Server;
using Server.Items;
using System.Collections.Generic;
using Server.Targeting;
using Server.Gumps;



////Coded by Bartok for Age of Valor shard////


//Resses high karma people
//Peaces + Reduces cast speed + mutes
//Armor come off (Cept jewelry and helmet) equips if you run away

namespace Server.Mobiles
{
	[CorpseName( "an insane dryad's corpse" )]
	public class InsaneDryad : BaseCreature
	{

		[Constructable]
		public InsaneDryad() : base( AIType.AI_Super, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = "an insane dryad";
			Body = 266;

			SetStr( 132, 147 );
			SetDex( 152, 168 );
			SetInt( 251, 272 );

			SetStam( 152, 168 );
			SetMana( 251, 272 );
			SetHits( 304, 316 );

			SetDamage( 28, 40 );
			
			SetDamageType( ResistanceType.Physical, 100 );

			SetResistance( ResistanceType.Physical, 41, 50 );
			SetResistance( ResistanceType.Fire, 17, 25 );
			SetResistance( ResistanceType.Cold, 40, 44 );
			SetResistance( ResistanceType.Poison, 34, 40 );
			SetResistance( ResistanceType.Energy, 25, 35 );

			SetSkill( SkillName.Magery, 70.7, 75.2 );
			SetSkill( SkillName.EvalInt, 70.7, 78.7 );
			SetSkill( SkillName.Meditation, 82.9, 89.9 );
			SetSkill( SkillName.MagicResist, 112.7, 117.1 );
			SetSkill( SkillName.Tactics, 71.7, 76.8 );
			SetSkill( SkillName.Wrestling, 72.5, 77.1 );

			Fame = 8500;
			Karma = -8500;
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.FilthyRich );
			AddLoot( LootPack.Average );
		}
		
		public override bool ReacquireOnMovement{ get{ return true; } }
		public override bool CanRummageCorpses{ get{ return true; } }
		public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
		public override int TreasureMapLevel{ get{ return 4; } }
		public override bool InitialInnocent{ get{ return true; } }
		public override bool AlwaysMurderer{ get{ return true; } }
		
		public override void OnDamage( int amount, Mobile attacker, bool willKill )
		{
			if(attacker==null)
			{
			base.OnDamage(amount,attacker,willKill);
			return;
			}
		
			if(0.05>Utility.RandomDouble())
			{
			attacker.SendLocalizedMessage(1072066);//You gaze upon the dryad's beauty and are momentarily distracted.
			Server.Spells.Spell.Mute(attacker,6);
			}
			else if(0.05>Utility.RandomDouble())
			{
			attacker.SendLocalizedMessage(1072066);//You gaze upon the dryad's beauty and are momentarily distracted.
			Server.Spells.Spell.Mute(attacker,6,1.7);			
			}
			else if(0.02>Utility.RandomDouble())
			{
			attacker.SendLocalizedMessage(1072197);//The dryad's beauty makes your blood race. Your clothing is too confining.
			DoClothesRemoval(attacker);
			attacker.Pacify( this, DateTime.Now+TimeSpan.FromSeconds(1+Utility.Random(1)) );
			}	
		}
		
		public override void OnAfterSpawn() { 
			this.Say( 1074164 ); 
			base.OnAfterSpawn();
		}
		
		public static void RemoveLayer(Mobile from,Layer layer)
		{
		Item fi = from.FindItemOnLayer(layer);	
		
		if(fi==null)return;
		
		if(fi is ExpireArmor)return;
		
		ExpireArmor ea = new ExpireArmor(layer,30,fi);
		
		from.GiveItem(fi);
		
		from.AddItem(ea);	
		}
		
		public static void ExpireLayer(Mobile from, Layer layer)
		{
		Item ea = from.FindItemOnLayer(layer);	
		
		if(ea==null)return;		
		
		if(ea is ExpireArmor)((ExpireArmor)ea).ForceExpire=true;		
		}
		
		
		
		//both removal and removalexpire should have same layers:
			
		public static void DoClothesRemoval(Mobile from)
		{
		RemoveLayer(from,Layer.Helm);
		RemoveLayer(from,Layer.Neck);		
		RemoveLayer(from,Layer.Arms);
		RemoveLayer(from,Layer.Gloves);	
		RemoveLayer(from,Layer.InnerTorso);
		RemoveLayer(from,Layer.OuterTorso);
		RemoveLayer(from,Layer.Pants);
		RemoveLayer(from,Layer.MiddleTorso);		
		RemoveLayer(from,Layer.Cloak);		
		RemoveLayer(from,Layer.Shoes);		
		RemoveLayer(from,Layer.OuterLegs);		
		RemoveLayer(from,Layer.InnerLegs);		
		RemoveLayer(from,Layer.Waist);	
		}
		
		public static void DoClothesRemovalExpire(Mobile from)
		{
		ExpireLayer(from,Layer.Helm);
		ExpireLayer(from,Layer.Neck);		
		ExpireLayer(from,Layer.Arms);		
		ExpireLayer(from,Layer.Gloves);	
		ExpireLayer(from,Layer.InnerTorso);		
		ExpireLayer(from,Layer.OuterTorso);
		ExpireLayer(from,Layer.Pants);	
		ExpireLayer(from,Layer.MiddleTorso);		
		ExpireLayer(from,Layer.Cloak);		
		ExpireLayer(from,Layer.Shoes);		
		ExpireLayer(from,Layer.OuterLegs);		
		ExpireLayer(from,Layer.InnerLegs);		
		ExpireLayer(from,Layer.Waist);		
		}		
		
		
		
		public override void OnMovement( Mobile m, Point3D oldLocation )
		{
			if(m.AccessLevel>AccessLevel.Player)return;
			
			if(m.Alive && this.ShouldHarm(m) && 0.05>Utility.RandomDouble() && !InRange( oldLocation, 3 ) && InRange( m, 4 ) && InLOS( m ))
			{
			m.SendLocalizedMessage(1072197);//The dryad's beauty makes your blood race. Your clothing is too confining.
			DoClothesRemoval(m);
			m.Pacify( this, DateTime.Now+TimeSpan.FromSeconds(3+Utility.Random(3)) );
			}		
			else if(m.Alive && this.ShouldHarm(m) && InRange( oldLocation, 11 ) && !InRange( m, 10 ) )
			{
			DoClothesRemovalExpire(m);
			}		
			
			base.OnMovement(m, oldLocation); 
		}
		 
		public override int GetAngerSound()
		{
			return 1405;
		}

		public override int GetIdleSound()
		{
			return 1404;
		}

		public override int GetAttackSound()
		{
			return 1403;
		}

		public override int GetHurtSound()
		{
			return 1406; 
		}

		public override int GetDeathSound()
		{
			return 1402; 
		}

		public InsaneDryad( 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();
			
			this.Delete();
		}

	}
}
