/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\mobiles\Pyrolisk.cs
Lines of code: 112
***********************************************************/


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

namespace Server.Mobiles
{
	[CorpseName( "a pyrolisk corpse" )]
	public class Pyrolisk : BaseCreature
	{
		[Constructable]
		public Pyrolisk() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = "a pyrolisk";
			Body = 5;
			Hue = 0x674;
			BaseSoundID = 0x8F;
			
			SetStr( 504, 700 );
			SetDex( 202, 300 );
			SetInt( 504, 700 );

			SetHits( 340, 383 );

			SetDamage( 25 );

			SetDamageType( ResistanceType.Fire, 100 );
			SetDamageType( ResistanceType.Physical, 0 );

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

			SetSkill( SkillName.EvalInt, 100.2, 110.0 );
			SetSkill( SkillName.Magery, 100.2, 110.0 );
			SetSkill( SkillName.Meditation, 100.1, 110.0 );
			SetSkill( SkillName.MagicResist, 86.0, 135.0 );
			SetSkill( SkillName.Tactics, 70.1, 80.0 );
			SetSkill( SkillName.Wrestling, 90.1, 100.0 );

			Fame = 15000;
			Karma = -7000;

			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 AlwaysMurderer{ get{ return true; } }
		
		public override void OnGaveMeleeAttack( Mobile defender)
		{
			base.OnGaveMeleeAttack( defender ); 

			if ( 0.3 >= Utility.RandomDouble() )
				Engulf(defender);
		}

		public void Engulf(Mobile m)
		{
			if(m==null)return;
			m.FixedParticles( 0x3709, 1, 30, 9965, 37, 7, EffectLayer.RightFoot );
			m.PlaySound( 0x208 );
			m.SendMessage( "The pyrolisk engulfs you in intense heat" );
			int toburn = Utility.RandomMinMax( 60, 70 );
			m.Hidden = false;
			AOS.Damage(m, this, toburn, 0, 100, 0, 0, 0 );
			/*
			Item am = m.Backpack.FindItemByType(typeof(HealScroll));
			
			if (am != null && am.Amount > 1)
			{
				am.Amount -= 1;
				m.SendMessage("Some of your items burn up");
			}
			else if (am != null && am.Amount == 1)
			{
				am.Delete();
				m.SendMessage("Some of your items burn up");
			}*/			
		}
		
		public override void OnDamage( int amount, Mobile from, bool willKill )
		{
			if ( 0.1 >= Utility.RandomDouble() )
				Engulf(from);
			else if ( 0.1 >= Utility.RandomDouble() )
				RadiateHeat();
				
		base.OnDamage( amount, from, willKill );
		}

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

			foreach ( Mobile m in this.GetMobilesInRange( 10 ) )
			{
				if ( m == this || !CanBeHarmful( 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( "The pyrolisk radiates heat" );

				int toburn = Utility.RandomMinMax( 25, 40 );
				m.Hidden = false;
				AOS.Damage(m, this, toburn, 0, 100, 0, 0, 0 );
			}
		}
		
		public override OppositionGroup OppositionGroup
		{
			get{ return OppositionGroup.PhoenixAndPyrolisk; }
		}

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