/**********************************************************
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\Raven.cs
Lines of code: 120

Description: 

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


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

namespace Server.Mobiles
{
	[CorpseName( "a raven corpse" )]
	public class Raven : BaseCreature
	{
		[Constructable]
		public Raven() : base( AIType.AI_Super, FightMode.Aggressor, 10, 1, 0.2, 0.4 )
		{
			Name = "a raven";
			Body = 5;
			Hue = 1175;
			
			SetStr( 504, 700 );
			SetDex( 202, 300 );
			SetInt( 504, 700 );

			SetHits( 340, 383 );

			SetDamage( 25 );

			SetDamageType( ResistanceType.Physical, 100 );

			SetResistance( ResistanceType.Physical, 60, 70 );
			SetResistance( ResistanceType.Fire, 50, 55 );
			SetResistance( ResistanceType.Poison, 25, 35 );
			SetResistance( ResistanceType.Energy, 40, 50 );

			SetSkill( SkillName.Meditation, 75.1, 100.0 );
			SetSkill( SkillName.MagicResist, 86.0, 135.0 );
			SetSkill( SkillName.Tactics, 80.1, 90.0 );
			SetSkill( SkillName.Wrestling, 90.1, 100.0 );
			
			Fame = 8000;
			Karma = -8000;

			VirtualArmor = 60;
		}

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

		public override int Meat{ get{ return 1; } }
		public override MeatType MeatType{ get{ return MeatType.Bird; } }
		public override int Feathers{ get{ return 36; } }
		public override bool CantbeSupreme { get { return true;} }
		public override bool CantbeParagon { get { return true;} }	

		public override void OnDeath( Container c )
		{
			if ( Utility.Random( 10 ) == 0 )
			{		
				Item item;

				switch ( Utility.Random( 1 ))
				{
								default:
					case 1: item = new RavenWing(); break;
							}

				c.DropItem( item );
			}

			base.OnDeath( c );
		}


		public override void OnDamage( int amount, Mobile from, bool willKill )
		{
			if ( 0.3 >= Utility.RandomDouble() )
				RavensCaw();
				
		base.OnDamage( amount, from, willKill );
		}

		public void RavensCaw()
		{
			ArrayList list = new ArrayList();

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

				if ( m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned || ((BaseCreature)m).Team != this.Team) )
					list.Add( m );
				else if ( m.Player )
					list.Add( m );
			}

			foreach ( Mobile m in list )
			{
				DoHarmful( m );
				
				m.FixedParticles( 0x374A, 1, 15, 9502, 1175, 3, (EffectLayer)255 );
				m.PlaySound( 0x081 );
				m.SendMessage( "The raven's caw sends chills up your spine!" );

				m.Paralyze( TimeSpan.FromSeconds( 4.0 ) );
				m.Hidden = false;
			}
		}
		
		public override int GetAngerSound()
		{
			return 0x07D;
		}

		public override int GetIdleSound()
		{
			return 0x07E;
		}

		public override int GetAttackSound()
		{
			return 0x07F;
		}

		public override int GetHurtSound()
		{
			return 0x080;
		}

		public override int GetDeathSound()
		{
			return 0x081;
		}

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