/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by Death on Sep-19-2011 08:06:23pm
Filepath: scripts\_custom\TormentedMinotaur.cs
Lines of code: 131
***********************************************************/


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


namespace Server.Mobiles
{
	[CorpseName( "a tormented minotaur corpse" )]
	public class TormentedMinotaur : BaseCreature
	{	
		private DateTime lastability;

		[Constructable]
		public TormentedMinotaur() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.16, 0.20 )
		{
			Name = "a tormented minotaur";
			Body = 262;

			SetStr( 822, 930 );
			SetDex( 401, 415 );
			SetInt( 128, 138 );

			SetHits( 4064, 4141 );
			SetStam( 401, 415 );

			SetDamage( 16, 30 );

			SetDamageType( ResistanceType.Physical, 100 );

			SetResistance( ResistanceType.Physical, 58, 62 );
			SetResistance( ResistanceType.Fire, 68, 74 );
			SetResistance( ResistanceType.Cold, 49, 54 );
			SetResistance( ResistanceType.Poison, 50, 56 );
			SetResistance( ResistanceType.Energy, 48, 54 );

			SetSkill( SkillName.MagicResist, 104.3, 116.3 );
			SetSkill( SkillName.Tactics, 100.7, 102.8 );
			SetSkill( SkillName.Wrestling, 110.1, 111.0 );
			SetSkill( SkillName.DetectHidden, 110.0, 124.0 );

			Fame = 15000;
			Karma = -15000;

			VirtualArmor = 20;
		}
		
		public override void GenerateLoot()
		{
			AddLoot( LootPack.UltraRich, 4 );
			AddLoot( LootPack.FilthyRich );
		}
		
		public override int GetAngerSound()
		{
			return 0x599;
		}

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

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

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

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

		public override bool Unprovokable{ get{ return true; } }
		public override Poison PoisonImmune{ get{ return Poison.Greater; } }
		public override int Meat{ get{ return 4; } }
		public override int Hides{ get{ return 12; } }
		public override FoodType FavoriteFood{ get{ return FoodType.FruitsAndVegies; } }
		public override bool IsMLCreature { get { return true;} } 

		public override void OnDamage( int amount, Mobile from, bool willKill )
		{
			if (this.InLOS( from ) && !from.InRange( this, 3 ) && from.Alive && !from.Blessed && 0.05 >= Utility.RandomDouble()) {
				this.Location = from.Location; 
				this.PlaySound( 0x59B );
				this.Combatant = from;
				from.SendMessage( "the tormented minotaur charges towards you!" );
			}
			
			base.OnDamage( amount, from, willKill );
		}
		
		public override void OnThink ()
		{
			if (lastability < DateTime.Now)
					GroundStomp();
					
			base.OnThink();	
		}
	
		public static readonly TimeSpan DefenderRemountDelay = TimeSpan.FromSeconds( 10.0 );
		
		public void GroundStomp()
		{
			ArrayList list = new ArrayList();

			foreach ( Mobile m in this.GetMobilesInRange( 10 ) )
			{
				if ( m == this || !CanBeHarmful( m ) || !ShouldHarm( m ))
					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.SendMessage( "the tormented minotaur slams the ground with tremendous force" );
				//m.SendMessage( "Distance: " + (int)this.GetDistanceToSqrt(m));
				
				if (m.Mounted)	
				{					
					m.Dismount();
					
					m.SendLocalizedMessage( 1060083 ); // You fall off of your mount and take damage!

					m.PlaySound( 0x59C );
					m.FixedParticles( 0x3728, 10, 15, 9955, EffectLayer.Waist );

					AOS.Damage( m, this, 30 * (12 - (int)this.GetDistanceToSqrt(m)), 100, 0, 0, 0, 0 );
					BaseMount.SetMountPrevention( m, BlockMountType.Dazed, DefenderRemountDelay );
				}
				else {
					m.PlaySound( 0x59C );
					m.FixedParticles( 0x3728, 10, 15, 9955, EffectLayer.Waist );

					AOS.Damage( m, this, 30 * (12 - (int)this.GetDistanceToSqrt(m)), 100, 0, 0, 0, 0 );
				}
			}
			lastability=DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax( 10, 35 ));
		}

		public TormentedMinotaur(Serial serial) : base(serial)
		{
		}

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

			writer.Write( (int) 1 ); // version

		}

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

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