/**********************************************************
RunUO AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by Red Squirrel on Jan-01-2012 10:09:13pm
Filepath: scripts\events and scenarios\Halloween2011\Mobiles\BoneHound.cs
Lines of code: 96

Description: 

***********************************************************/


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

namespace Server.Mobiles
{
	[CorpseName( "a bone hound corpse" )]
	public class BoneHound : BaseCreature
	{
	
		private DateTime lastcacophony;
	
		[Constructable]
		public BoneHound() : base( AIType.AI_Super, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = "a bone hound";
			Body = 1069;
			Hue = 2101;
			BaseSoundID = 229;

			SetStr( 102, 150 );
			SetDex( 81, 105 );
			SetInt( 36, 60 );

			SetHits( 1029, 1232 );

			SetDamage( 21, 34 );

			SetDamageType( ResistanceType.Physical, 20 );
			SetDamageType( ResistanceType.Fire, 80 );

			SetResistance( ResistanceType.Physical, 25, 35 );
			SetResistance( ResistanceType.Fire, 30, 40 );
			SetResistance( ResistanceType.Poison, 30, 40 );
			SetResistance( ResistanceType.Energy, 10, 20 );
			
			SetSkill( SkillName.MagicResist, 85.1, 100.0 );
			SetSkill( SkillName.Tactics, 80.1, 100.0 );
			SetSkill( SkillName.Wrestling, 60.1, 100.0 );

			Fame = 12000;
			Karma = -12000;

			VirtualArmor = 30;

			Tamable = false;

			PackItem( new SulfurousAsh( 10 ) );
			PackItem( new Bone( 35 ) );
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.SuperBoss, 2 );	
		}
		
		public override void OnThink()
		{
			if (0.05 > Utility.RandomDouble() && (lastcacophony+TimeSpan.FromMinutes(1)) < DateTime.Now) {
				CacophonousLambaste();
				lastcacophony=DateTime.Now;
			}
			base.OnThink();		
		}
		
		public void CacophonousLambaste()
		{		
			ArrayList list = new ArrayList();
			this.PlaySound( 1412 );

			foreach ( Mobile m in this.GetMobilesInRange( 12 ) )
			{
				if ( m == this || !ShouldHarm( m ) || !this.InLOS( m ) || !m.Alive || m.Blessed )
					continue;

				list.Add( m );
			}
			

			for(int i=0;i<list.Count;i++)
			{
			Mobile m=null;
			if(list[i] is Mobile)m = list[i] as Mobile;
			else continue;
			
				int muteduration = 15;
				double mutepower = 2.0;
				
				muteduration = (int)(this.GetDistanceToSqrt(m) + 15);
				mutepower = (this.GetDistanceToSqrt(m)/4) + 2.0;
			
				m.FixedEffect( 0x3779, 10, 25 );
				m.SendLocalizedMessage(1072069);
				
				Server.Items.BaseWeapon.Mute(m,muteduration,mutepower);
				Server.Spells.Spell.Mute(m,muteduration,mutepower);
			}		
		}

		public override bool Unprovokable{ get{ return true; } }
		public override bool Uncalmable{ get{ return true; } }
		public override bool CantbeSupreme { get { return true;} }
		public override bool CantbeParagon { get { return true;} }	
		public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
		public override bool NoFlee { get { return true; } }

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