/**********************************************************
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\Halloween Items\Hel.cs
Lines of code: 190
***********************************************************/


using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Engines.CannedEvil;

namespace Server.Mobiles
{
	[CorpseName( "the remains of Hel" )]
	public class Hel : BaseChampion
	{
		public override bool DeleteCorpseOnDeath{ get{ return true; } }
		Random rand = new Random(); 
		private int amount; 
		public override ChampionSkullType SkullType{ get{ return ChampionSkullType.Death; } }
		private ArrayList spawns = new ArrayList();
		
		public override WeaponAbility GetWeaponAbility()
		{
			switch ( Utility.Random( 3 ) )
			{
				default:
				case 0: return WeaponAbility.Bladeweave;
				case 1: return WeaponAbility.WhirlwindAttack;
				case 2: return WeaponAbility.Dismount;
			}
		}
	
		[Constructable]
		public Hel() : base( AIType.AI_Super )
		{
			Name = "Hel";
			Body = 401;
			Hue = 0x83EC;
			
			SetStr( 420, 976 );
			SetDex( 306, 327 );
			SetInt( 1549, 1676 );

			SetHits( 100000, 100000 );

			SetDamage( 24, 30 );
			
			SetDamageType( ResistanceType.Cold, 50 );
			SetDamageType( ResistanceType.Physical, 50 );

			SetResistance( ResistanceType.Physical, 40, 50 );
			SetResistance( ResistanceType.Fire, 25, 30 );
			SetResistance( ResistanceType.Cold, 1000, 1000 );
			SetResistance( ResistanceType.Poison, 70, 74 );
			SetResistance( ResistanceType.Energy, 25, 30 );

		    SetSkill( SkillName.EvalInt, 100.0, 120.0 );
			SetSkill( SkillName.Magery, 100.0, 120.0 );
			SetSkill( SkillName.SpiritSpeak, 100.0, 120.0 );
			SetSkill( SkillName.Necromancy, 100.0, 120.0 );
			SetSkill( SkillName.MagicResist, 120.0, 120.0);
			SetSkill( SkillName.Tactics, 100.1, 101.9 );
			SetSkill( SkillName.Wrestling, 100.7, 102.0 );
			SetSkill( SkillName.Swords, 100.7, 102.0 );

			Fame = 40000;
			Karma = -40000;

			VirtualArmor = 50;
			
			Female = true;

			Item shroud = new HoodedShroudOfShadows();

			shroud.Movable = false;
			shroud.Hue = 762;

			AddItem( shroud );

			Scythe weapon = new Scythe();

			weapon.Hue = 762;
			weapon.Movable = false;

			AddItem( weapon );

			if(0.5>Utility.RandomDouble())	PackItem(new RandomTalisman());
		
		}

		public override bool OnBeforeDeath()
		{

			Effects.PlaySound(this, Map, GetDeathSound());
			Effects.SendLocationEffect( Location, Map, 0x3709, 30, 10, 0x835, 0 );
		
		return base.OnBeforeDeath();
		}
		
		public override void GenerateLoot()
		{
			AddLoot( LootPack.AosUltraRich, 2 );
			AddLoot( LootPack.AosSuperBoss, 2);
			AddLoot( LootPack.FilthyRich, 3 );
		}
	
		public override bool AutoDispel{ get{ return true; } }
		public override bool Unprovokable{ get{ return true; } }
		public override bool Uncalmable{ get{ return true; } }
		public override double AutoDispelChance{ get{ return 0.2; } }
		public override bool CanRummageCorpses{ get{ return true; } }
		public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
		public override int TreasureMapLevel{ get{ return 4; } }
		public override bool IsMLCreature { get { return true;} }
		public override bool IsMLBoss { get { return true;} }
		public override bool AlwaysMurderer{ get{ return true; } }
		public override bool ShowFameTitle{ get{ return false; } }
		public override bool ClickTitle{ get{ return false; } }
		
		public override void OnDamage( int amount, Mobile attacker, bool willKill ) 
		{
		
			if ( attacker!=null && attacker != this && GetLiveSpawns()<3 && 0.02 > Utility.RandomDouble())
			{
				Mobile spawn;
			
				if (GetLiveSpawns()==2)
				{
					spawn = new Ghost();
					spawn.MoveToWorld( this.Location, this.Map );
					spawns.Add(spawn);	
					attacker.SendMessage( "Hel summons souls to weaken you!" );
					spawn.Combatant = attacker;
				}
				else if (GetLiveSpawns()==1)
				{
					spawn = new Ghost();
					spawn.MoveToWorld( this.Location, this.Map );
					spawns.Add(spawn);
					spawn = new Ghost();
					spawn.MoveToWorld( this.Location, this.Map );
					spawns.Add(spawn);
					attacker.SendMessage( "Hel summons souls to weaken you!" );
					spawn.Combatant = attacker;
				}
				else if (GetLiveSpawns()==0)
				{
					spawn = new Ghost();
					spawn.MoveToWorld( this.Location, this.Map );
					spawns.Add(spawn);
					spawn = new Ghost();
					spawn.MoveToWorld( this.Location, this.Map );
					spawns.Add(spawn);
					spawn = new Ghost();
					spawn.MoveToWorld( this.Location, this.Map );
					spawns.Add(spawn);
					attacker.SendMessage( "Hel summons souls to weaken you!" );
					spawn.Combatant = attacker;
				}
			}
		
			if ( 0.05 >= Utility.RandomDouble() ) //Smack talk ftw
			{
				switch ( Utility.Random( 6 ))
				{                                   
					case 0: 
						this.PlaySound( 824 );
						this.Say( "I've had enough of you!" );
						break;   
					case 1: 
						this.PlaySound( 794 );
						this.Say( "All your souls will be mine!" );
						break;   
					case 2: 
						this.PlaySound( 822 );
						this.Say( "You cannot defeat me!" );
						break;   
					case 3: 
						this.PlaySound( 824 );
						this.Say( "My power is too much for you. Give in!" );
						break;     
					case 4: 
						this.PlaySound( 794 );
						this.Say( "You will make a great addition to my realm!" );
						break;     
					case 5: 
						this.PlaySound( 794 );
						this.Say( "You will lose! Quit now!" );
						break;    
				}   
			}
			base.OnDamage(amount, attacker, willKill );			
		}

		public override void OnDeath( Container c )
		{
			base.OnDeath( c );
		}
		
		public Hel( Serial serial ) : base( serial )
		{
		}
		
		private int GetLiveSpawns()
		{
		int live=0;
				for( int i = 0; i < spawns.Count; ++i )
                {
                Mobile m = spawns[i] as Mobile;

                if( m == null || m.Deleted || !m.Alive)continue;
				live++;							
                }
				
		return live;
		}

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