/**********************************************************
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\mobiles\Humus.cs
Lines of code: 140
***********************************************************/


using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Engines.CannedEvil;
using System.Collections.Generic;
using Server.Mobiles;

namespace Server.Mobiles 
{
	[CorpseName( "the remains of Humus" )]
	public class Humus : basedemitel
	{
		public override bool AlwaysMurderer{ get{ return true; } }
		public override bool IgnoreYoungProtection { get { return true; } }
	
	
		//arty stuff ---------------------------------------
		private static Type[] artys = new Type[]
		{
		typeof( HelmOfRage ),typeof( ClawOfHumus ),typeof(NecklaceOfRage)
		};
		
		

		
		
		public override bool OnBeforeDeath()
		{
		GiveArtifact(artys);
		return base.OnBeforeDeath();
		}
	
	

		[Constructable]
		public Humus () : base( AIType.AI_Super, FightMode.Closest, 0.2, 0.4 )
		{
			Name = "Humus";
			Title = "The Guardian Of Fire";
			Hue = 1161;
			Body = 46;
			BaseSoundID = 362;

			SetStr( 1096, 1185 );
			SetDex( 86, 175 );
			SetInt( 686, 775 );

			SetHits( 100000);
			SetMana(500000);

			SetDamage( 29, 35 );

			SetDamageType( ResistanceType.Fire, 80 );
			SetDamageType( ResistanceType.Physical, 10 );
			SetDamageType( ResistanceType.Energy, 10 );

			SetResistance( ResistanceType.Physical, 65, 75 );
			SetResistance( ResistanceType.Fire, 100, 100 );
			SetResistance( ResistanceType.Cold, 0, 5 );
			SetResistance( ResistanceType.Poison, 100, 100 );
			SetResistance( ResistanceType.Energy, 40, 60 );

			SetSkill( SkillName.EvalInt, 100.0, 100.0 );
			SetSkill( SkillName.Magery, 120.0, 120.0 );
			SetSkill( SkillName.Meditation, 100.0, 100.0 );
			SetSkill( SkillName.MagicResist, 100.0, 150.0 );
			SetSkill( SkillName.Tactics, 120.0, 120.0 );
			SetSkill( SkillName.Wrestling, 120.0, 120.0 );

			Fame = 50500;
			Karma = -22500;

			VirtualArmor = 70;
			
			if(0.5>Utility.RandomDouble())	PackItem(new RandomTalisman());
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.SuperBoss, 3 );
			AddLoot( LootPack.Gems, 5 );
		}
		
		public override void OnThink()
		{
		base.OnThink();
		
			if (this.Combatant != null && 0.002 >= Utility.RandomDouble())
			{
				Mobile target = this.Combatant; 
				FlameAttack();
			}
		
		}
		
		public override void OnDamage( int amount, Mobile attacker, bool willKill )
		{
			if((this.Hits<5000)&&(Utility.Random(20)==10))
			{		
			BaseCreature themobile = new humusminion();
			
			Map map = attacker.Map;
			Point3D loc = new Point3D(X ,Y, Z);
					
			themobile.MoveToWorld( loc, map );
			}
		
		base.OnDamage(amount,attacker,willKill);
		}

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

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

		public override bool ReacquireOnMovement{ get{ return true; } }
		public override bool HasBreath{ get{ return true; } } 
		public override int breathtargets{ get{ return 5; } }
		public override double BreathDamageScalar{ get{ return (0.003655); } } 
		public override bool AutoDispel{ get{ return true; } }
		public override double BonusPetDamageScalar{ get{ return 3.0; } }
		public override HideType HideType{ get{ return HideType.Horned; } }
		public override int Hides{ get{ return 200; } }
		public override int Meat{ get{ return 52; } }
		public override int Scales{ get{ return 100; } }
		public override ScaleType ScaleType{ get{ return ScaleType.Red; } }
		public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
		public override int TreasureMapLevel{ get{ return 5; } }
		
		
		private void FlameAttack()
		{
			Map map = this.Map;
		
			int x;
			int y;
			int z;
			
			if (Utility.Random(2) == 1)
				this.PlaySound( 837 ); 
			else
				this.PlaySound( 477 ); 
							
			for (int i = 0; i < 20; i++)
			{
				x = this.X + Utility.RandomMinMax( -8, 8 );
				y = this.Y + Utility.RandomMinMax( -8, 8 );
				z = this.Z;
				
				if ( map.CanSpawnMobile( new Point3D( x, y, z) ) )
				{
					Point3D loc = new Point3D(x ,y, z);
					Item item = new tempfirecollumn(this,TimeSpan.FromSeconds(30),134,168);
					item.MoveToWorld( loc, map );	
				}
			}
		}							
		
		public Humus( 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();
		}
	}
}