/**********************************************************
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\Dark Palace\Mobiles\PossessedWizard.cs
Lines of code: 96
***********************************************************/


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

namespace Server.Mobiles
{
	[CorpseName( "a spectral corpse" )]
	public class PossessedWizard : BaseCreature
	{
		public override bool IgnoreYoungProtection { get { return true; } }

		public override void DisplayPaperdollTo( Mobile to )
		{
			// Do nothing
		}

		private Mobile m_Mask;
		private bool m_SpawnedMask;
		[Constructable]
		public PossessedWizard() : base( AIType.AI_Super, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = "a possessed wizard";
			Body = 970;
			Hue = 1288;
			BaseSoundID = 412;

			SetStr( 50, 50 );
			SetDex( 50, 50 );
			SetInt( 2000 );

			SetHits( 1000 );

			SetDamage( 0, 0 );
			ActiveSpeed = 0.001;
			CurrentSpeed = 0.001;
			PassiveSpeed = 0.001;

			SetDamageType( ResistanceType.Physical, 0 );
			SetDamageType( ResistanceType.Energy, 100 );

			SetResistance( ResistanceType.Physical, 100, 100 );
			SetResistance( ResistanceType.Fire, 20, 20 );
			SetResistance( ResistanceType.Cold, 20, 20 );
			SetResistance( ResistanceType.Poison, 100 );
			SetResistance( ResistanceType.Energy, 40, 50 );

			SetSkill( SkillName.EvalInt, 90.1, 200.0 );
			SetSkill( SkillName.Magery, 120.0 );
			SetSkill( SkillName.MagicResist, 150.5, 200.0 );
			SetSkill( SkillName.Wrestling, 120.0 );

			Fame = 35000;
			Karma = -50000;

			VirtualArmor = 50;
			PackItem( new BlackStaff() );
			PackNecroReg( 12, 40 );
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.SuperBoss );
		}

		public override bool CanRummageCorpses{ get{ return true; } }
		public override bool BleedImmune{ get{ return true; } }
		public override bool ReacquireOnMovement{ get{ return true; } } 
		public override bool BardImmune{ get{ return true; } }
		public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
		public override bool AlwaysMurderer{ get{ return true; } }
		public override int TreasureMapLevel{ get{ return 6; } }


		public void CheckMask()
		{
			if ( !m_SpawnedMask )
			{
				Say("Ankla Simien Sigius Kal");
				m_Mask = new MaskOfDisaster();

				((BaseCreature)m_Mask).Team = this.Team;

				m_Mask.MoveToWorld( this.Location, this.Map );

				m_SpawnedMask = true;
			}
			else if ( m_Mask != null && m_Mask.Deleted )
			{
				m_Mask = null;
			}
		}

		public override void AlterDamageScalarFrom( Mobile caster, ref double scalar )
		{
			CheckMask();

			if ( m_Mask != null )
			{
				scalar *= 0.1;
			}
		}

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