/**********************************************************
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\MirageDesert\MalkilusMirage.cs
Lines of code: 135
***********************************************************/


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

namespace Server.Mobiles 
{ 
    
	public class MalkilusMirage : basedemitel
	{ 
		public override bool DeleteCorpseOnDeath{ get{ return true; } }
		public override int ManaMax{ get{ return 15000; } }

		public override WeaponAbility GetWeaponAbility()
		{
			return Utility.RandomBool() ? WeaponAbility.ParalyzingBlow : WeaponAbility.BleedAttack;
		}	

		[Constructable] 
		public MalkilusMirage() : base( AIType.AI_Super, FightMode.Closest, 0.2, 0.4 ) 
		{ 
			Name = "Malkilus";
			Title = "The Cursed Tree Spirit";
			Body = 285;
			Hue = 16385;

			SetStr( 1000, 1500 );
			SetDex( 100, 250 );
			SetInt( 3000, 3200 );

			SetHits( 1000 );

			SetDamage( 33, 39 );

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

			SetResistance( ResistanceType.Physical, 150 );
			SetResistance( ResistanceType.Fire, 5, 10 );
			SetResistance( ResistanceType.Cold, 30, 50 );
			SetResistance( ResistanceType.Poison, 100, 100 );
			SetResistance( ResistanceType.Energy, 40, 50 );

			SetSkill( SkillName.EvalInt, 100.0, 100.0 );
			SetSkill( SkillName.Magery, 120.0, 120.0 );
			SetSkill( SkillName.Meditation, 100.0, 100.0 );
			SetSkill( SkillName.MagicResist, 100.0, 150.0 );
			SetSkill( SkillName.Tactics, 120.0, 120.0 );
			SetSkill( SkillName.Wrestling, 120.0, 120.0 );

			VirtualArmor = 120; 

			Fame = 25000;
			Karma = -25000;
		}

		public override bool OnBeforeDeath()
		{
			Gold gold = new Gold( Utility.RandomMinMax( 5400, 8750 ) );
			gold.MoveToWorld( Location, Map );

			Effects.SendLocationEffect( Location, Map, 0x376A, 10, 1 );
			return true;
		}

		public override OppositionGroup OppositionGroup
		{
			get{ return OppositionGroup.FeyAndUndead; }
		}

		public override bool AlwaysMurderer{ get{ return true; } }
		public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
		public override bool IgnoreYoungProtection { get { return true; } }
		public override bool BleedImmune{ get{ return true; } }
		public override bool BardImmune{ get{ return true; } }

		public override int GetHurtSound()
		{
			return 672;
		}

		public override int GetDeathSound()
		{
			return 0x108;
		}

		public override void AddNameProperties( ObjectPropertyList list )
		{
			base.AddNameProperties( list );

			list.Add("Mirage");
		}

		public override void OnGaveMeleeAttack( Mobile defender )
		{
		base.OnGaveMeleeAttack( defender );
		
		if(defender==null || defender==this)return;
			
			defender.Damage( Utility.Random( 10, 10 ), this );
			defender.Stam -= Utility.Random( 10, 10 );
			defender.Mana -= Utility.Random( 10, 10 );
		}

		public override void OnDamage( int amount, Mobile attacker, bool willKill )
		{	
		base.OnDamage(amount,attacker,willKill);
		
		if(attacker==null || attacker==this)return;
		
			
				attacker.Damage( Utility.Random( 1, 10 ), this );
				attacker.Stam -= Utility.Random( 1, 3 );
				attacker.Mana -= Utility.Random( 1, 3 );	

		
				if(0.18>Utility.RandomDouble() && Hits<800)
				{			
				attacker.Stam=Utility.Random(11);
				
						for(int i=Utility.Random(1,3);i>0;i--)
						{						
							BaseCreature s = new Reaper();
							s.AI=AIType.AI_Super;
							s.SetSkill( SkillName.Necromancy, 90.0, 120.0 );
							s.SetSkill( SkillName.SpiritSpeak, 90.0, 120.0 );		
							s.HitsMaxSeed=100;
							s.Hits=100;
							s.Hue=16385;
							s.ManaMaxSeed=1000;
							s.Mana=1000;
							s.Team = this.Team;
							s.SummonMaster=this;
							s.dispelonsummonerdeath=true;
							s.Combatant = attacker;
							s.MoveToWorld( new Point3D( attacker.X, attacker.Y, attacker.Z ), attacker.Map );
						}
				}
			
		}

		public override void OnGotMeleeAttack( Mobile attacker )
		{
			base.OnGotMeleeAttack( attacker );
			
			if(attacker==null || attacker==this)return;
			
			attacker.Damage( Utility.Random( 10, 10 ), this );
			attacker.Stam -= Utility.Random( 10, 10 );
			attacker.Mana -= Utility.Random( 10, 10 );
		}

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