/**********************************************************
RunUO AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by Red Squirrel on Mar-09-2012 08:19:35pm
Filepath: scripts\Mobiles\custom mobiles - to sort\ML Named\Pyre.cs
Lines of code: 108

Description: 

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


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

namespace Server.Mobiles
{
	[CorpseName( "a pyre corpse" )]
	public class Pyre : BaseCreature
	{	
		public override WeaponAbility GetWeaponAbility()
		{
			switch ( Utility.Random( 2 ) )
			{
				default:
				case 0: return WeaponAbility.BleedAttack;
				case 1: return WeaponAbility.ParalyzingBlow;
			}
		}
	
		[Constructable]
		public Pyre () : base( AIType.AI_Super, FightMode.Closest, 18, 1, 0.2, 0.4  )
		{
			Name = "Pyre";
			Hue = 1161;
			Body = 5;
			BaseSoundID = 0x2EE;			
			
			SetStr( 600, 620 );
			SetDex( 383, 400 );
			SetInt( 600, 790 );

			SetMana( 784, 800 );
			SetStam( 350, 400 );
			SetHits( 1700, 1850 );

			SetDamage( 20, 30 );

			SetDamageType( ResistanceType.Physical, 50);
			SetDamageType( ResistanceType.Fire, 50);

			SetResistance( ResistanceType.Physical, 65, 75);
			SetResistance( ResistanceType.Fire, 70, 80 );
			SetResistance( ResistanceType.Cold, 10, 20 );
			SetResistance( ResistanceType.Poison, 38, 40 );
			SetResistance( ResistanceType.Energy, 50, 62 );

			SetSkill( SkillName.EvalInt, 90.1, 101.4 );
			SetSkill( SkillName.Magery, 101.3, 123.4 );
			SetSkill( SkillName.Meditation, 110.7, 118.7 );
			SetSkill( SkillName.MagicResist, 111.2, 150.8 );
			SetSkill( SkillName.Tactics, 100.8, 108.8 );
			SetSkill( SkillName.Wrestling, 112, 121.2 );

			Fame = 12500;
			Karma = -12500;

			VirtualArmor = 36;

		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.UltraRich, 3 );
			AddLoot( LootPack.FilthyRich, 1 );
		}
		
		public override bool IsMLBoss { get { return true;} }
		public override int TreasureMapLevel{ get{ return 6; } }
		public override double MLChestChance{ get{ return 0.05; } }
		
		public override bool AutoDispel{ get{ return true; } }
		public override double AutoDispelChance{ get{ return 0.4; } }
		public override bool Unprovokable{ get{ return true; } }
		public override bool Uncalmable{ get{ return true; } }
		public override bool IsMLCreature { get { return true;} }
 
		public override void OnDamage( int amount, Mobile from, bool willKill )
		{
			if (0.15 >= Utility.RandomDouble() )
				RadiateHeat();
				
		base.OnDamage( amount, from, willKill );
		}

		public Pyre( Serial serial ) : base( serial )
		{
		}
		
		public void RadiateHeat()
		{
			ArrayList list = new ArrayList();

			foreach ( Mobile m in this.GetMobilesInRange( 14 ) )
			{
				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, 37, 3, (EffectLayer)255 );
				m.PlaySound( 0x208 );
				m.SendMessage( "Pyre radiates heat" );

				int toburn = Utility.RandomMinMax( 55, 70 );
				m.Hidden = false;
				AOS.Damage(m, this, toburn, 0, 100, 0, 0, 0 );
			}
		}

		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();

			if ( BaseSoundID == 263 )
				BaseSoundID = 1170;
		}
	}
}