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

namespace Server.Mobiles
{
	[CorpseName( "an impossible corpse" )]
	public class ChuckNorris : BaseCreature
	{
		public override bool ClickTitle{ get{ return false; } }
		public override double SwitchWeaponChance{ get{ return 0.4; } }
		

		[Constructable]
		public ChuckNorris() : base( AIType.AI_Super, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			SpeechHue = Utility.RandomDyedHue();
			Hue = Utility.RandomSkinHue();
			Name = "Chuck Norris";
			Body = (( this.Female = Utility.RandomBool() ) ? Body = 0x191 : Body = 0x190);
			
			Hue = Utility.RandomSkinHue();

			SetStr( 9001, 9001 );
			SetDex( 9001, 9001 );
			SetInt( 9001, 9001 );

	        SetHits( 9001, 9001 );
			SetMana( 9001, 9001 );

			SetDamage(9001, 9001 );

			SetDamageType( ResistanceType.Physical, 9001 );
			SetDamageType( ResistanceType.Poison, 9001 );

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

			SetSkill( SkillName.MagicResist, 9001, 9001 );
			SetSkill( SkillName.Tactics, 90011, 9001 );
			SetSkill( SkillName.Wrestling, 9001, 9001 );
			SetSkill( SkillName.Anatomy, 9001, 9001 );
			SetSkill( SkillName.Bushido, 9001, 9001 );
			SetSkill( SkillName.Parry, 9001, 9001 );
			

			SetSkill( SkillName.Fencing, 9001, 9001 );
			SetSkill( SkillName.Macing, 9001, 9001 );
			SetSkill( SkillName.Swords, 9001, 9001 );

			Fame = 9001;
			Karma = -9001;

			AddItem( new SamuraiTabi() );
			AddItem( new LeatherHiroSode());
			AddItem( new LeatherDo());

			switch ( Utility.Random( 4 ))
			{
				case 0: AddItem( new LightPlateJingasa()); break;
				case 1: AddItem( new ChainHatsuburi() ); break;
				case 2: AddItem( new DecorativePlateKabuto() ); break;
				case 3: AddItem( new LeatherJingasa()); break;
			}

			switch ( Utility.Random( 3 ))
			{
				case 0: AddItem( new StuddedHaidate()); break;
				case 1: AddItem( new LeatherSuneate() ); break;
				case 2: AddItem( new PlateSuneate() ); break;
			}
			

			PackItem( new Wakizashi() );
			PackItem( new Longsword() );
			PackItem(new Halberd());
			PackItem(new NoDachi());	

			SwapWeapon(0);			

			Utility.AssignRandomHair( this );
		}
		
		
		public override void OnThink()
		{
			if (this.Combatant != null && this.Combatant is PlayerMobile)
			{		
				PlayerMobile pm = this.Combatant as PlayerMobile;
				
				pm.Kill();
				pm.SendMessage("You have been round house kicked by Chuck Norris");
								
				if (pm.NetState != null )
				{
					pm.NetState.Dispose();					
				}				
				
				if (pm.Corpse != null)
				{
					pm.Corpse.Delete(); 
				}
			}
			
			base.OnThink();	
		}
		
		private void DivideByZero()
		{
			int dz=0;
			string str = String.Format("{0}",1/dz);
		}
		
		
		public override void OnDelete()
		{
			DivideByZero();
		}
		
		
		public override void OnDeath( Container c )
 		{			
			DivideByZero();
 		}
		
		public override void Kill()
		{
			DivideByZero();
		}
		

		public override double WeaponAbilityChance{ get{ return 0.5; } }

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

		public override bool AlwaysMurderer{ get{ return true; } }
		public override bool BardImmune{ get{ return true; } }
		public override bool CanRummageCorpses{ get{ return true; } }

		public ChuckNorris( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
		}
	}
}
