using System;
using Server;
using Server.Items;

namespace Server.Mobiles
{
	[CorpseName( "a bat corpse" )]
	public class CaveBat : BaseCreature
	{
		[Constructable]
		public CaveBat() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = "a cave bat";
			Body = 185;
			BaseSoundID = 0x270;
			AnimationMod = 7;

			SetStr( 91, 110 );
			SetDex( 91, 115 );
			SetInt( 26, 50 );

			SetHits( 55, 66 );

			SetDamage( 7, 9 );

			SetSkill( SkillName.MagicResist, 70.1, 95.0 );
			SetSkill( SkillName.Tactics, 55.1, 80.0 );
			SetSkill( SkillName.HandToHand, 30.1, 55.0 );

			Fame = 1000;
			Karma = -1000;

			VirtualArmor = 14;
		}

		public void DrainBlood( Mobile m )
		{
			DoHarmful( m );
			new Blood().MoveToWorld( m.Location, m.Map );
			m.SendMessage( "The creature feeds on your blood!" );
			int toDrain = Utility.RandomMinMax( 2, 10 );
			m.PlaySound( 0x23F );
			Hits += toDrain;
			m.Damage( toDrain, this );
		}

		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );
			DrainBlood( defender );
		}

		public override void OnGotMeleeAttack( Mobile attacker )
		{
			base.OnGotMeleeAttack( attacker );
			DrainBlood( attacker );
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.Poor );
		}

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