/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\mobiles\deathbladesummoner.cs
Lines of code: 111
***********************************************************/


using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.ContextMenus;
using Server.Misc;
using Server.Network;

namespace Server.Mobiles
    {
    public class deathbladesummoner : BaseGreaterHire
        {

        private ArrayList m_dbs = new ArrayList();


        [Constructable]
        public deathbladesummoner() : base( AIType.AI_Super )
            {

            SpeechHue = Utility.RandomDyedHue();
            Hue = Utility.RandomSkinHue();

            if( this.Female = Utility.RandomBool() )
                {
                Body = 0x191;
                Name = NameList.RandomName( "female" );

                switch( Utility.Random( 2 ) )
                    {
                    case 0: AddItem( new Skirt( Utility.RandomNeutralHue() ) ); break;
                    case 1: AddItem( new Kilt( Utility.RandomNeutralHue() ) ); break;
                    }
                }
            else
                {
                Body = 0x190;
                Name = NameList.RandomName( "male" );
                AddItem( new ShortPants( Utility.RandomNeutralHue() ) );
                }
            Title = "The death blade summoner";


            Utility.AssignRandomHair( this );

			vaporizer wep = new vaporizer();
			wep.Movable=false;
            AddItem( wep );

            SetStr( 100, 150 );
            SetDex( 81, 100 );
            SetInt( 81, 100 );

            SetDamage( 1, 10 );

            SetSkill( SkillName.Tactics, 70, 120 );
            SetSkill( SkillName.Wrestling, 100, 120 );
            SetSkill( SkillName.Swords, 120, 130 );

            Fame = 800;
            Karma = 0;

			ControlSlots = 3;

            m_dbs = new ArrayList();


            AddItem( new Sandals( Utility.RandomNeutralHue() ) );
            switch( Utility.Random( 2 ) )
                {
                case 0: AddItem( new Doublet( Utility.RandomNeutralHue() ) ); break;
                case 1: AddItem( new Shirt( Utility.RandomNeutralHue() ) ); break;
                }

            PackGold( 0, 260 );
            }
        public override bool ClickTitle { get { return false; } }
        public deathbladesummoner( Serial serial ) : base( serial )
            {
            }

        public override void Serialize( GenericWriter writer )
            {
            base.Serialize( writer );

            writer.Write( (int)1 ); // version 

         //   writer.Write(m_dbs);
            }

        public override void Deserialize( GenericReader reader )
            {
            base.Deserialize( reader );

            int version = reader.ReadInt();

         //  if( version >= 1 )    m_dbs=reader.ReadStrongMobileList();
            }


           public override void OnDamage( int amount, Mobile attacker, bool willKill )
            {
			if(attacker==null)return;
			
            base.OnGotMeleeAttack( attacker );

			
			     if( this.Followers < 1 && 0.5>Utility.RandomDouble())
                {
                PlaySound( 533 );
                switch( Utility.Random( 4 ) )
                    {
                    case 0: Say( "You have provoked me to summon my wrath!" ); break;
                    case 1: Say( "You shall regret this!" ); break;
                    case 2: Say( "My minion shall destroy you!" ); break;
                    case 3: Say( "You shall all be vaporised into dust!" ); break;
                    }

                Map map = this.Map;

                BaseCreature dbs = new summoneddeathblade();
				SetTempSummon(this,dbs);
				dbs.Controlled=true;
                dbs.MoveToWorld( new Point3D( attacker.X, attacker.Y, attacker.Z ), map );
				dbs.ControlOrder=OrderType.Guard;

                m_dbs.Add( dbs );
                }
            }

			public override bool OnBeforeDeath()
            {

				for( int i = 0; i < m_dbs.Count; ++i )
                {
                Mobile m = m_dbs[i] as Mobile;

                if( m != null && !m.Deleted )
				{				
				Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 );
				Effects.PlaySound( m, m.Map, 0x201 );
				}
				
                 m.Delete();
                }

            m_dbs.Clear();

            return true;
            }
        }
    }