/**********************************************************
RunUO AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by Red Squirrel on May-15-2012 07:15:47pm
Filepath: scripts\events and scenarios\Long Live the King 2012\Britain Undead Invasions\Good Side\FightingTownPeasant.cs
Lines of code: 135

Description: 

***********************************************************/


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

namespace Server.Mobiles
{
	public class FightingTownPeasant : BaseCreature
	{
		public override bool ClickTitle{ get{ return false; } }
		public override double SwitchWeaponChance{ get{ return 0.4; } }
		public override double WeaponAbilityChance{ get{ return 0.2; } }
		private DateTime lastability;

		[Constructable]
		public FightingTownPeasant() : base( AIType.AI_Super, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			SpeechHue = Utility.RandomDyedHue();
			Title = "the peasant";
			Hue = Utility.RandomSkinHue();

			if ( this.Female = Utility.RandomBool() )
			{
				Body = 0x191;
				Name = NameList.RandomName( "female" );
				AddItem( new Skirt( Utility.RandomNeutralHue() ) );
			}
			else
			{
				Body = 0x190;
				Name = NameList.RandomName( "male" );
				AddItem( new ShortPants( Utility.RandomNeutralHue() ) );
			}

			SetStr( 86, 100 );
			SetDex( 81, 95 );
			SetInt( 61, 75 );

			SetDamage( 10, 23 );

			SetSkill( SkillName.Fencing, 66.0, 102.5 );
			SetSkill( SkillName.Macing, 65.0, 102.5 );
			SetSkill( SkillName.MagicResist, 25.0, 47.5 );
			SetSkill( SkillName.Swords, 65.0, 102.5 );
			SetSkill( SkillName.Tactics, 65.0, 87.5 );
			SetSkill( SkillName.Wrestling, 15.0, 37.5 );

			Fame = 1000;
			Karma = 1000;
			
			PackItem(new Pickaxe() );
			PackItem(new ButcherKnife() );
			PackItem(new Cleaver());
			PackItem(new Club());	
			PackItem(new SmithHammer());	
			PackItem(new SledgeHammer());	
			PackItem(new Pitchfork());	
			PackItem(new ShortSpear());	
			PackItem(new Dagger());	

			SwapWeapon(0);		

			if ( Female )
				AddItem( new PlainDress() );
			else
				AddItem( new Shirt( GetRandomHue() ) );

			int lowHue = GetRandomHue();

			AddItem( new ShortPants( lowHue ) );

			if ( Female )
				AddItem( new Boots( lowHue ) );
			else
				AddItem( new Shoes( lowHue ) );

			Utility.AssignRandomHair( this );

			PackGold( 200, 250 );

			Utility.AssignRandomHair( this );
		}
		
		private static int GetRandomHue()
		{
			switch ( Utility.Random( 6 ) )
			{
				default:
				case 0: return 0;
				case 1: return Utility.RandomBlueHue();
				case 2: return Utility.RandomGreenHue();
				case 3: return Utility.RandomRedHue();
				case 4: return Utility.RandomYellowHue();
				case 5: return Utility.RandomNeutralHue();
			}
		}
		
		
		public override void OnThink()
		{		
			if ( 0.01 >= Utility.RandomDouble() ) 
			{
				switch ( Utility.Random( 4 ) )
				{
					default:
					case 0: this.Say("We fight for Britain!"); break;
					case 1: this.Say("Return to the grave foul creature!"); break;
					case 2: this.Say("We will prevail!"); break;
					case 3: this.Say("Take this, hah, and that!"); break;
				}
				
			}
			
			if (0.2 > Utility.RandomDouble() && lastability < DateTime.Now) {
				Steal();
			}
		base.OnThink();	
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.Average );
		}
		
		public void Steal()
		{
			ArrayList ilist = new ArrayList();
			ArrayList list = new ArrayList();
			
			foreach ( Item i in this.GetItemsInRange( 1 ) )
			{
				if ( i.Movable == false || i == null)
					continue;
				else
					ilist.Add( i );
			}
			
			foreach ( Item i in ilist )
			{
				this.GiveItem(i);
			}
			
			lastability=DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax( 40, 60 ));
		}

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