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


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

namespace Server.Mobiles
{
	[CorpseName( "a sith lord corpse" )]
	public class sithlord : BaseCreature
	{
		public override bool ClickTitle{ get{ return false; } }
		public override double SwitchWeaponChance{ get{ return 1.0; } }
		
		public override OppositionGroup OppositionGroup
		{
			get{ return OppositionGroup.JediAndSith; }
		}
		
		

		
		//main arty stuff ---------------------------------------
		/*
		This code used for sith event in haven only!
			
		*/		
		public static void GiveArtifact(BaseCreature killed, double chance)
		{
			if(killed.SummonMaster!=null || killed.ControlMaster!=null)return;
			
			if(!killed.Region.IsPartOf("Haven"))return;		
		
			ArrayList toGive = new ArrayList();
			List<DamageStore> rights = BaseCreature.GetLootingRights( killed.DamageEntries, killed.HitsMax );

			for ( int i = rights.Count - 1; i >= 0; --i )
			{
				DamageStore ds = rights[i];
				if ( ds.m_HasRight )	toGive.Add( ds.m_Mobile );
			}
			if ( rights.Count == 0 )return;			
			
			for(int i=0;i<rights.Count;i++)
			{
			Mobile m = rights[i].m_Mobile;			
			PlayerMobile pm = m as PlayerMobile;

						
				if(chance>Utility.RandomDouble()) 
				{			
				m.SendMessage(200,"As reward for fighting the sith, a token has been bestoyed to you.  The force be with you, always.");
				m.GiveItem(new SilverToken());			
				}
			}
			
		}//end main arty stuff------------------------------------------		
		
		
		

		[Constructable]
		public sithlord() : base( AIType.AI_Super, FightMode.Closest, 10, 1, 0.13, 0.24 )
		{
			SpeechHue = Utility.RandomDyedHue();
			Hue = Utility.RandomSkinHue();
			Name = "a sith lord";
			Body = (( this.Female = Utility.RandomBool() ) ? Body = 0x191 : Body = 0x190);
			
			Hue = 1153;

			SetStr( 226, 545 );
			SetDex( 81, 213 );
			SetInt( 211, 597 );

	        SetHits( 200, 470 );
			SetMana( 191, 797 );

			SetDamage( 23, 27 );

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

			SetResistance( ResistanceType.Physical, 50, 70 );
			SetResistance( ResistanceType.Fire, 50, 90);
			SetResistance( ResistanceType.Cold, 55, 55 );
			SetResistance( ResistanceType.Poison, 57, 70 );
			SetResistance( ResistanceType.Energy, 86, 146  );

			SetSkill( SkillName.MagicResist, 70, 200 );
			SetSkill( SkillName.Tactics, 60, 248 );
			SetSkill( SkillName.Wrestling, 70, 320 );
			SetSkill( SkillName.Anatomy, 60.1, 376.0 );

			SetSkill( SkillName.Swords, 120.6, 297.5 );
			
			SetSkill( SkillName.Magery, 120, 200 );
			SetSkill( SkillName.EvalInt, 120, 220 );

			Fame = 21000;
			Karma = -29000;


			AddItem( new HoodedShroudOfShadows() );



lightsaberofthesithlord weapon = new lightsaberofthesithlord(); 			
weapon.WeaponAttributes.HitLightning=100;
AddItem( weapon );


			Utility.AssignRandomHair( this );
		}
		
		public override void OnDeath( Container c )
 		{
			GiveArtifact(this, 0.9);
			base.OnDeath( c );
	 	}

		// TODO: Bushido abilities

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

		public override bool AlwaysMurderer{ get{ return true; } }
		public override bool BardImmune{ get{ return true; } }
		public override bool ShowFameTitle{ get{ return false; } }

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