Example #1
0
		public override bool DoActionCombat()
		{
			bool ret = base.DoActionCombat();
			
			if ( m_Mobile.Spell == null && DateTime.Now > m_NextCastTime )
			{
				Spell spell = null;
				
				if ( m_Mobile.Poisoned ) // Top cast priority is cure
				{
					m_Mobile.DebugSay( "I am going to cure myself" );

					spell = new CleanseByFireSpell( m_Mobile, null );
				}
				else if ( FindDispelTarget( true ) != null )
				{
					m_Mobile.DebugSay( "I am going to area dispel" );

					spell = new DispelEvilSpell( m_Mobile, null );					
				}
				else
				{
					spell = ChooseSpell( m_Mobile.Combatant );
				}
				
				if ( spell != null )
					spell.Cast();
					
				TimeSpan delay;

				if ( spell is DispelEvilSpell )
					delay = TimeSpan.FromSeconds( m_Mobile.ActiveSpeed );
				else
					delay = GetDelay();
					
				m_NextCastTime = DateTime.Now + delay;
			}			

			return ret;
		}
        public virtual Spell ChooseSpell( Mobile c )
        {
            if ( !SmartAI )
            {
                if ( !m_Mobile.Summoned && ScaleByHealing( HealChance ) > Utility.RandomDouble() )
                {
                    if ( m_Mobile.Hits < (m_Mobile.HitsMax - 50) )
                        new CloseWoundsSpell( m_Mobile, null ).Cast();
                    else if ( m_Mobile.Hits < (m_Mobile.HitsMax - 10) )
                        new CloseWoundsSpell( m_Mobile, null ).Cast();
                }

                return GetRandomSpell();
            }

            Spell spell = null;

            int healChance = (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits));

            if ( m_Mobile.Summoned )
                healChance = 0;

            switch ( Utility.Random( 5 + healChance ) )
            {
                case 0: // Heal  myself
                {
                    if ( !m_Mobile.Summoned )
                    {
                        if ( m_Mobile.Hits < (m_Mobile.HitsMax - 50) )
                            new CloseWoundsSpell( m_Mobile, null ).Cast();
                        else if ( m_Mobile.Hits < (m_Mobile.HitsMax - 10) )
                            new CloseWoundsSpell( m_Mobile, null ).Cast();
                    }

                    break;
                }
                case 1: // Clean myself from Poison
                {
                    if ( m_Mobile.Poisoned )
                        spell = new CleanseByFireSpell( m_Mobile, null );

                    break;
                }
                case 2: // Select a random paladin spell to allow me to do some damage
                {
                    spell = GetRandomSpell();

                    break;
                }
                case 3: // Set up a combo of spell attacks
                {
                    if ( m_Mobile.Mana < 30 && m_Mobile.Mana > 15 )
                    {
                        if ( c.Paralyzed )
                        {
                            m_Mobile.DebugSay( "I am going to meditate" );

                            m_Mobile.UseSkill( SkillName.Meditation );
                        }
                        else if ( !c.Paralyzed ) //Not very paladin like, but.. I cant think of anything right now.
                        {
                            if ( Utility.Random( 2 ) == 0 )
                            {
                                m_Combo = 2;
                                spell = new EnemyOfOneSpell( m_Mobile, null );
                            }
                        }
                    }
                    else if ( m_Mobile.Mana > 30 && m_Mobile.Mana < 80 )
                    {
                        if ( Utility.Random( 2 ) == 0 )
                        {
                            m_Combo = 0;
                            spell = new DispelEvilSpell( m_Mobile, null ); //Necros are gonna hate this one :P
                        }
                        else
                        {
                            m_Combo = 1;
                            spell = new HolyLightSpell( m_Mobile, null ); //Blind them evil doers!!!
                        }

                    }
                     break;
                }
                case 4: //Combo to hurt them like crazy, fury + enemy of one ...pitty i cant think how to make it do a 3 spell combo
                {
                    if ( m_Mobile.Mana > 80 ) //Needs lotsa mana... so make pallys loaded in mana
                    {
                        if ( Utility.Random( 2 ) == 0 && !c.Paralyzed && !c.Frozen )
                        {
                            m_Combo = 0;
                            spell = new DivineFurySpell( m_Mobile, null );
                        }
                        else
                        {
                            m_Combo = 1;
                            spell = new EnemyOfOneSpell( m_Mobile, null );
                        }
                    }
                    break;
                }

            }

            return spell;
        }
        public virtual Spell DoCombo( Mobile c )
        {
            Spell spell = null;

            if ( m_Combo == 0 )
            {
                spell = new RemoveCurseSpell( m_Mobile, null );
                ++m_Combo; // Move to next spell
            }
            else if ( m_Combo == 1 )
            {
                spell = new DivineFurySpell( m_Mobile, null );
                ++m_Combo; // Move to next spell
            }
            else if ( m_Combo == 2 )
            {
                spell = new ConsecrateWeaponSpell( m_Mobile, null );

                ++m_Combo; // Move to next spell
            }

            if ( m_Combo == 3 && spell == null )
            {
                switch ( Utility.Random( 3 ) )
                {
                    default:
                    case 0:
                    {
                        if ( c.Int < c.Dex )
                            spell = new DivineFurySpell( m_Mobile, null );
                        else
                            spell = new EnemyOfOneSpell( m_Mobile, null );

                        ++m_Combo; // Move to next spell

                        break;
                    }
                    case 1:
                    {
                        spell = new HolyLightSpell( m_Mobile, null );
                        m_Combo = -1; // Reset combo state
                        break;
                    }
                    case 2:
                    {
                        spell = new DispelEvilSpell( m_Mobile, null );
                        m_Combo = -1; // Reset combo state
                        break;
                    }
                }
            }
            else if ( m_Combo == 4 && spell == null )
            {
                spell = new EnemyOfOneSpell( m_Mobile, null );
                m_Combo = -1;
            }

            return spell;
        }