/**********************************************************
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\Almincrus.cs
Lines of code: 171
***********************************************************/


using System;
using Server.Misc;
using Server.Network;
using System.Collections;
using Server.Items;
using Server.Targeting;
using Server.Spells.Necromancy;

namespace Server.Mobiles
{
	public class Almincrus : basedemitel
	{
		public override bool ClickTitle{ get{ return false; } }
		public override bool ShowFameTitle{ get{ return false; } }
		
		private int form=1;//1=first 2=second
		
	    //arty stuff
		private static Type[] artys = new Type[]
		{
		typeof( RingOfProtection ),typeof(TheLastBookOfArkkaza),typeof(TheManaBarrier)
		};
		
		public override bool OnBeforeDeath()
		{
		
			if(form==1)  //turn to new form
			{
				form++;
				
				AI=AIType.AI_Super;
				
				Effects.PlaySound(this, Map, GetDeathSound());
				Effects.SendLocationEffect( Location, Map, 0x3709, 30, 10, 0x835, 0 );
				
				Name = "Almincrus";
				Title = "the Dark Archmage";
				Body = 78;
				Hue = 1109;
				BaseSoundID = 0x3E9;

				SetStr( 216, 305 );
				SetDex( 96, 115 );
				SetInt( 966, 1045 );

				SetHits( 75000);
				SetMana(500000);

				SetDamage( 12, 35);

				SetDamageType( ResistanceType.Physical, 20 );
				SetDamageType( ResistanceType.Cold, 40 );
				SetDamageType( ResistanceType.Energy, 40 );

				SetResistance( ResistanceType.Physical, 55, 65 );
				SetResistance( ResistanceType.Fire, 30, 50 );
				SetResistance( ResistanceType.Cold, 85, 90 );
				SetResistance( ResistanceType.Poison, 100 );
				SetResistance( ResistanceType.Energy, 100 );

				SetSkill( SkillName.Wrestling, 100, 220.0 );
				SetSkill( SkillName.Tactics, 120, 170.0 );
				SetSkill( SkillName.EvalInt, 150.0, 220.0 );
				SetSkill( SkillName.Inscribe, 100.0, 100.0 );
				SetSkill( SkillName.Magery, 120.0, 150.0 );
				SetSkill( SkillName.Meditation, 100.1, 101.0 );
				SetSkill( SkillName.MagicResist, 175.2, 200.0 );
				SetSkill( SkillName.Necromancy, 120.0, 120.0 );
				SetSkill( SkillName.SpiritSpeak, 120.0, 120.0 );
				

				Fame = 23000;
				Karma = -23000;

				VirtualArmor = 60;
				
				FollowersMax=80;
				
				PackNecroReg( 130, 275 );
				
				OrnamentOfThePKer orny = new OrnamentOfThePKer();
				orny.Movable=false;
				AddItem(orny);
			

			return false;
			}
		
		//if we make it here he's actually dead
		
		GiveArtifact(artys);
		return base.OnBeforeDeath();
		}			
		

		


		[Constructable]
		public Almincrus():base( AIType.AI_Super, FightMode.Closest, 0.2, 0.4 )
		{
			Body = 0x190;
			Name = "Almincrus";

			SetStr( 2500, 2500 );
			SetDex( 101, 250 );
			SetInt( 502, 700 );

			SetHits( 30000);
			SetMana(500000);

			SetDamage( 5, 15 );

			SetDamageType( ResistanceType.Physical, 75 );
			SetDamageType( ResistanceType.Cold, 25 );

			SetResistance( ResistanceType.Physical, 35, 40 );
			SetResistance( ResistanceType.Fire, 45, 50 );
			SetResistance( ResistanceType.Cold, 75 );
			SetResistance( ResistanceType.Poison, 40, 50 );
			SetResistance( ResistanceType.Energy, 70 );

			SetSkill( SkillName.Wrestling, 90.1, 100.0 );
			SetSkill( SkillName.Swords, 90.1, 100.0 );
			SetSkill( SkillName.Tactics, 90.1, 100.0 );
			SetSkill( SkillName.MagicResist, 90.1, 100.0 );
			SetSkill( SkillName.Magery, 120.0 );
			SetSkill( SkillName.EvalInt, 100.0 );
			SetSkill( SkillName.Meditation, 120.1, 130.0 );

			VirtualArmor = 36;
			Fame = 25000;
			Karma = -20000;

			LeatherGloves gloves = new LeatherGloves();
			gloves.Hue = 1109;
			AddItem( gloves );

			Halberd weapon = new Halberd();
			weapon.Hue = 1359;
			weapon.Movable = false;
			AddItem( weapon );

			BoneHelm helm = new BoneHelm();
			helm.Hue = 1109;
			AddItem( helm );

			Necklace necklace = new Necklace();
			necklace.Hue = 1359;
			AddItem( necklace );

			Cloak cloak = new Cloak();
			cloak.Hue = 1175;
			AddItem( cloak );

			Kilt kilt = new Kilt();
			kilt.Hue = 1175;
			AddItem( kilt );
			

		
			Sandals sandals = new Sandals();
			sandals.Hue = 1175;
			AddItem( sandals );
		}
		
		public override OppositionGroup OppositionGroup
		{
			get{ return OppositionGroup.FeyAndUndead; }
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.SuperBoss, 3 );
			AddLoot( LootPack.SuperBoss, 2 );
			AddLoot( LootPack.MedScrolls, 2 );
		}

		public override bool AlwaysMurderer{ get{ return true; } }
		public override bool Unprovokable{ get{ return true; } }
		
		
		
		
		
		private void SummonMob(Mobile attacker)
		{
				if(attacker==null)return;
		
				ShadowWyrm s = new ShadowWyrm();
				s.HitsMaxSeed=100;
				int x = this.X + Utility.RandomMinMax( -2, 3 );
				int y = this.Y + Utility.RandomMinMax( -2, 3 );
				int z = this.Z;
				SetTempSummon(this ,s );
				s.Combatant = attacker;
				s.MoveToWorld( new Point3D( attacker.X, attacker.Y, attacker.Z ), attacker.Map );		
		}
		
		

		public override void OnDamage( int amount, Mobile attacker, bool willKill )
		{	
		base.OnDamage(amount,attacker,willKill);
		
		if(attacker==null || attacker==this)return;
		
				if(0.015>Utility.RandomDouble() && form==1)
				{			
						for(int i=Utility.Random(1,2);i>0;i--)
						{									
						SummonMob(attacker);
						}
				}
			
		}			

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

		
		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			
			writer.Write( (int) 0 ); // version
			
			writer.Write((int) form);
			
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
			
			form = reader.ReadInt();
		}
	}
}