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


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

using System.Collections.Generic;
using Server.Targeting;
using Server.Mobiles;
using Server.Spells.Third;
using Server.Misc;
using Server.Regions;
using Server.SkillHandlers;

namespace Server.Mobiles
{
	[CorpseName( "a vyle's corpse" )]
	public class Vyle : BaseCreature
	{
	
		[Constructable]
		public Vyle() : base( AIType.AI_Super, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = "a vyle";
			Body = 770;
			Hue = 1175;  

			SetStr( 160, 200 );
			SetDex( 126, 183 ); 
			SetInt( 110, 143 );

			SetHits( 254, 383 ); 

			SetDamage( 13, 20 ); 

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

			SetResistance( ResistanceType.Physical, 30, 40);
			SetResistance( ResistanceType.Fire, 25, 40 );
			SetResistance( ResistanceType.Cold, 30, 40 );
			SetResistance( ResistanceType.Poison, 5, 10 );
			SetResistance( ResistanceType.Energy, 5, 10 );

			SetSkill( SkillName.Musicianship, 100, 110 );
			SetSkill( SkillName.Peacemaking, 100, 110 );
			SetSkill( SkillName.Discordance, 100, 110 );
			SetSkill( SkillName.Provocation, 100, 110 );
			SetSkill( SkillName.Tactics, 65.3, 69.1 );
			SetSkill( SkillName.Wrestling, 75.0, 88.0 );

			Fame = 4200;
			Karma = -4200;

			VirtualArmor = 28;

			switch ( Utility.Random( 3 ))
			{
				case 0: PackItem( new Bone() ); break;
				case 1: PackItem( new RibCage() ); break;
				case 2: PackItem( new BonePile() ); break;
			}
			
			PackItem( new Lute() );
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.Rich, 4 );
		}
		
		public override int GetHurtSound()
		{
			return 0x14D;
		}

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

		public override int GetAttackSound()
		{
			return 0x75;
		}
		
		public override void OnDamagedBySpell(Mobile attacker)
		{
		//Wight may teleport when damaged by a spell
			if ( 0.5 > Utility.RandomDouble() )
			{
			this.Location = attacker.Location; 
			this.FixedParticles( 0x376A, 9, 32, 0x13AF, EffectLayer.Waist );
			attacker.PlaySound( 0x1FE );
			}
		}
		
		public override void OnGotMeleeAttack(Mobile attacker)
		{
		//Wight may teleport when damaged by a long range melee attack (archery)
			if ( 0.5 > Utility.RandomDouble() && !attacker.InRange( this, 1 ) )
			{
			this.Location = attacker.Location; 
			this.FixedParticles( 0x376A, 9, 32, 0x13AF, EffectLayer.Waist );
			attacker.PlaySound( 0x1FE );
			}
		}

		public override int TreasureMapLevel{ get{ return 3; } }
		public override bool BardImmune{ get{ return true; } }
		public override bool Unprovokable{ get{ return true; } }
		public override bool Uncalmable{ get{ return true; } }
		public override bool BleedImmune{ get{ return true; } } 
		public override Poison PoisonImmune{ get{ return Poison.Regular; } }

		public Vyle( Serial serial ) : base( serial )
		{
		}
		
		public override bool OnBeforeDeath()
		{
			Mobile spawn;
		
			for(int i=0;i<3;i++)
			{
				spawn = new BlackBat();
				spawn.MoveToWorld( this.Location, this.Map );
			}
			GenerateLoot ();
			
			return true; 
		}	

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

	}
}