/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\engines\ML Peerless + misc areas\demitel\mobiles\basedemitel.cs
Lines of code: 84
***********************************************************/


using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Engines.CannedEvil;
using System.Collections.Generic;
using Server.Mobiles;
using Server.Multis;

namespace Server.Mobiles 
{
	public class basedemitel : BaseCreature
	{
		public override bool ClickTitle{ get{ return false; } }
		public override bool ShowFameTitle{ get{ return false; } }	
		public override bool AlwaysMurderer{ get{ return true; } }
		public override bool IgnoreYoungProtection { get { return true; } }
		
		public override int TreasureMapLevel{ get{ return 5; } }
		public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
		public override bool Unprovokable{ get{ return true; } }
		public override bool Uncalmable{ get{ return true; } }		
		public override int SuperAI_DelayMax{ get{ return 2; } }
		public override int SuperAI_Intensity{ get{ return 220; } }			
		
	
		public override bool NoFlee { get { return true; } }
	
		//main arty stuff ---------------------------------------
		public void GiveArtifact(Type[] artylist)
		{
			if(this.Region!=null && !this.Region.CanSpawnArtifacts())
				return;
			
			ArrayList toGive = new ArrayList();
			List<DamageStore> rights = BaseCreature.GetLootingRights( this.DamageEntries, this.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;
			
			int luck=m.Luck;
			if(luck>1500)luck=1500;
			
			double chance=0.01+((double)luck/10000); //1% with no luck, 16% with 1500 luck
			if(chance>0.3)chance=0.3;	

			if(pm.showartychance)pm.SendMessage(52,"Demitel artifact chance: {0}%" ,Math.Round(chance*100,3)); 
						
				if(chance>Utility.RandomDouble()) 
				{
				Item artifact =  Loot.Construct( artylist[Utility.Random(artylist.Length)] );					
				m.SendMessage(200,"As reward for fighting the hordes of Demitel, a special artifact has been bestoyed to you.");
				Container pack = m.Backpack;
				if ( pack == null || !pack.TryDropItem( m, artifact, false ) )
				m.BankBox.DropItem( artifact );			
				}
			}
			
		}//end main arty stuff------------------------------------------
	
	
	
	
	
	
		public basedemitel( AIType aiType, FightMode mode, double activespeed, double passivespeed ) : base( aiType, mode, 25, 1, activespeed, passivespeed)
		{
			Fame = 50000;
			Karma = -40000;


			PackItem(new RandomTalisman());
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.Gems, 5 );
		}
		
		
		public override void OnDamage( int amount, Mobile attacker, bool willKill )
		{		
		//global special attacks here
		
		
		base.OnDamage(amount,attacker,willKill);
		}
		
		public override double TargetTamerChance { get { return 0.1; }}

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