/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\events and scenarios\misc\Halloween Event\UnknownCreature2.cs
Lines of code: 132
***********************************************************/


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

namespace Server.Mobiles
{
	[CorpseName("a strange creature's corpse")]
	public class UnknownCreature2 : BaseCreature
	{
	
		public override WeaponAbility GetWeaponAbility()
		{
			switch ( Utility.Random( 6 ) )
			{
				default:
				case 0: return WeaponAbility.Dismount;
				case 1: return WeaponAbility.ArmorIgnore;
				case 2: return WeaponAbility.NerveStrike;
				case 3: return WeaponAbility.NerveStrike;
				case 4: return WeaponAbility.Dismount;
				case 5: return WeaponAbility.ArmorIgnore;
			}
		}

		[Constructable]
		public UnknownCreature2() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = "Strange Creature";
			Body = 0x309;
			BaseSoundID = 0x451;
			Hue = 1; 

			SetStr( 300 );
			SetDex( 300, 600 );
			SetInt( 100, 100 );

			SetHits( 250, 300 );

			SetDamage( 5, 10 );

			if ( 1.0 > Utility.RandomDouble() ) {
				this.Hidden = true;
				this.AllowedStealthSteps = 2000;
			}
			
			ActiveSpeed = 0.11;
			CurrentSpeed = 0.11;
			PassiveSpeed = 0.11;
			
			SetDamageType( ResistanceType.Cold, 75 );
			SetDamageType( ResistanceType.Physical, 25 );

			SetResistance( ResistanceType.Physical, 100, 100 );
			SetResistance( ResistanceType.Fire, 0, 0 );
			SetResistance( ResistanceType.Cold, 100 );
			SetResistance( ResistanceType.Poison, 100 );
			SetResistance( ResistanceType.Energy, 0 );

			SetSkill( SkillName.MagicResist, 95.1, 100.0 );
			SetSkill( SkillName.Magery, 40.0, 55.0 );
			SetSkill( SkillName.EvalInt, 40.0, 55.0 );
			SetSkill( SkillName.Tactics, 90);
			SetSkill( SkillName.Wrestling, 120 );
			SetSkill( SkillName.Stealth, 120 );

			Fame = 2000;
			Karma = -2000;

			VirtualArmor = 40;
				
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.Rich, 8 );
			AddLoot( LootPack.Gems, 2 );
		}

		public override void OnGaveMeleeAttack(Mobile defender)
 		{
			if ( 0.2 > Utility.RandomDouble() && this.Hidden == false)
			{
				this.Hidden = true;
				this.AllowedStealthSteps = 200;
				this.Stam = 600;
			}
			base.OnGaveMeleeAttack(defender);
		}

		public override void OnDamage( int amount, Mobile attacker, bool willKill ) 
		{
			
			if ( attacker!=null && 0.1 > Utility.RandomDouble() && this.Hidden == false) //Stealth jumping
			{
				this.Hidden = true;
				Map map = attacker.Map;
				
				int x = this.X + Utility.RandomMinMax( -2, 5 );
				int y = this.Y + Utility.RandomMinMax( -2, 5 );
				int z = this.Z;
				if ( map.CanSpawnMobile( new Point3D( x, y, z) ) )
					{
					this.MoveToWorld( new Point3D( x, y, z ), Map );
					this.AllowedStealthSteps = 200;
					}
			}
			
		}

		public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
		public override bool BleedImmune{ get{ return true; } }
		public override bool IgnoreYoungProtection { get { return true; } }
		public override bool Unprovokable{ get{ return true; } }
		public override bool Uncalmable{ get{ return true; } }
		
		public override void OnDeath( Container c )
		{
			if ( Utility.Random( 25 ) == 0 )
			{		
				Item item;

				switch ( Utility.Random( 7 ))
				{
					default:
					case 1: item = new HalloweenPumpkin(); break;
					case 2: item = new HalloweenDarkPlant(); break;
					case 3: item = new HalloweenDaemonStatue(); break;
					case 4: item = new HalloweenSteedStatue(); break;
					case 5: item = new HalloweenGuillotine(); break;
					case 6: item = new HalloweenBlood(); break;
					case 7: item = new HalloweenDeadTree(); break;
				}

				c.DropItem( item );
			}

			base.OnDeath( c );
		}

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

			if ( BaseSoundID == -1 )
				BaseSoundID = 219;
		}
	}
}