Exemple #1
0
        public void OnHit(Mobile defender)
        {
            if (m_TargetType == null)
            {
                m_TypeName = EnemyOfOneSpell.GetTypeName(defender);

                if (defender is PlayerMobile || (defender is BaseCreature bc && bc.GetMaster() is PlayerMobile))
                {
                    m_PlayerOrPet = defender;
                    TimeSpan duration = TimeSpan.FromSeconds(8);

                    if (DateTime.UtcNow + duration < m_Expire)
                    {
                        m_Expire = DateTime.UtcNow + duration;
                    }

                    if (m_Timer != null)
                    {
                        m_Timer.Stop();
                        m_Timer = null;
                    }

                    m_Timer = Timer.DelayCall(duration, EnemyOfOneSpell.RemoveEffect, m_Owner);
                }
                else
                {
                    m_TargetType = defender.GetType();
                }

                UpdateDamage();
                DeltaEnemies();
                UpdateBuffInfo();
            }
Exemple #2
0
        public void OnHit(Mobile defender)
        {
            if (m_TargetType == null)
            {
                m_TargetType = defender.GetType();
                m_TypeName   = EnemyOfOneSpell.GetTypeName(defender);

                if (Core.SA)
                {
                    // Odd but OSI recalculates when the target changes...
                    var chivalry = (int)m_Owner.Skills.Chivalry.Value;
                    m_DamageScalar = 10 + ((chivalry - 40) * 9) / 10;
                }

                DeltaEnemies();
                UpdateBuffInfo();
            }
        }
        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;
        }