Example #1
0
        public float CriticalCalculationForSpells(Mobile src,Mobile target)
        {
            #region critical chance + damage + test
            int roll = Utility.Random( 100 );
            int critical = 0;
            int critTalentBonus = 0;
            int criticalDamageTalentBonus = 0;
            float crit = 1f;
            critical = (int)(5 + (float)src.Iq/29) + (int)src.MagicalCriticalBonus;
            switch ( this.resistance)
            {
                case Resistances.Arcane: critical += src.ArcaneCriticalBonus; break;
                case Resistances.Frost: critical += src.FrostCriticalBonus; break;
                case Resistances.Fire: critical += src.FireCriticalBonus; break;
                case Resistances.Nature: critical += src.NatureCriticalBonus; break;
                case Resistances.Shadow: critical += src.ShadowCriticalBonus; break;
                case Resistances.Light: critical += src.HolyCriticalBonus; break;
            }
            #region CriticalChanceTalentsHandling
            if (src.Level > 9)
            {
                switch(src.Classe)
                {
                    case Classes.Warlock:
                        #region Warlock
                        //devastation
                        if ( AbilityClasses.abilityClasses[ (int)Id ] == (int)ClassesOfSpells.Destruction )
                            if ( src.HaveTalent( Talents.Devastation) )
                            {
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.Devastation );
                                critTalentBonus +=ae.S1;
                            }
                        // improved searing pain
                        if ( src.HaveTalent( Talents.ImprovedSearingPain ) &&
                            SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 5676 ] )
                        {
                            AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.MasterHealer );
                            critTalentBonus += ae.S1;
                        }
                        #endregion
                        break;
                    case Classes.Mage:
                        #region Mage
                        // Incinerate
                        if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 2138 ] || // fire blast
                            SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 10205 ])//	scorch
                            if ( src.HaveTalent( Talents.Incinerate ) )
                            {
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.Incinerate );
                                critTalentBonus += ae.S1;
                            }
                        // FlameStrike
                        if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 10215 ])//	scorch
                            if ( src.HaveTalent( Talents.ImprovedFlamestrike ) )
                            {
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ImprovedFlamestrike );
                                critTalentBonus += ae.S1;
                            }
                        // Combustion
                        if( src.HaveTalent(Talents.Combustion))
                        {
                            if(this.resistance == Resistances.Fire)
                            {
                                bool bonus = false;
                                ArrayList al1 = new ArrayList();
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.Combustion );
                                foreach( Mobile.AuraReleaseTimer art in src.Auras )
                                    if(art.aura.SpecialState == SpecialStates.Combustion)
                                    {
                                        bonus = true;
                                        al1.Add(art);
                                    }

                                if (bonus)
                                {
                                    critTalentBonus +=100;
                                    foreach( Mobile.AuraReleaseTimer art in al1)
                                        src.ReleaseAura(art);
                                }
                            }

                        }
                        #endregion
                        break;
                    case Classes.Druid:
                        #region Druid

                        #endregion
                        break;
                    case Classes.Warrior:
                        #region warrior
                        // Improved Overpower
                        if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 7384 ]) // overpower
                            if ( src.HaveTalent( Talents.ImprovedOverpower ) )
                            {
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ImprovedOverpower);
                                critTalentBonus += ae.S1;
                            }
                        #endregion
                        break;
                }
            }
            #endregion
            critical +=critTalentBonus;
            if ( critical > roll )
            {
                src.LastSpellStatus = AttackStatus.Critical;
                #region CriticalDamageBonusHandling
                if (src.Level > 9)
                {
                    switch(src.Classe)
                    {
                        case Classes.Warlock:
                            #region Warlock
                            // ruin
                            if(src.HaveTalent( Talents.Ruin ) )
                                if ( AbilityClasses.abilityClasses[ (int)Id ] == (int)ClassesOfSpells.Destruction )
                                {
                                    AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.Ruin );
                                    criticalDamageTalentBonus +=100;
                                }
                            #endregion
                            break;
                        case Classes.Mage:
                            #region Mage
                            // Ice shards
                            if ( AbilityClasses.abilityClasses[this.Id] == (int)ClassesOfSpells.Frost)//
                                if ( src.HaveTalent( Talents.IceShards ) )
                                {
                                    AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.IceShards );
                                    criticalDamageTalentBonus += ae.S1;
                                }
                            // Shatter
                            if ( resistance == Resistances.Frost)
                            {
                                if ( src.HaveTalent( Talents.Shatter ) )
                                {
                                    if (IsFrozen(target))
                                    {
                                        AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.Shatter );

                                        switch (ae.Id)
                                        {
                                            case 11170 :criticalDamageTalentBonus +=10;
                                                break;
                                            case 12982 :criticalDamageTalentBonus +=20;
                                                break;
                                            case 12983 :criticalDamageTalentBonus +=30;
                                                break;
                                            case 12984 :criticalDamageTalentBonus +=40;
                                                break;
                                            case 12985 :criticalDamageTalentBonus +=50;
                                                break;
                                        }
                                    }
                                }
                            }
                            #endregion
                            break;
                        case Classes.Druid:
                            #region Druid

                            #endregion
                            break;
                        case Classes.Warrior:
                            #region warrior

                            #endregion
                            break;
                    }
                }
                #endregion
                crit = 1.5f + (float)criticalDamageTalentBonus/100;
            }
            #endregion

            return crit;
        }
Example #2
0
        public override int CastingTime( Mobile from )
        {
            int ct = castingTime;
            AuraEffect ae = null;
            switch(from.Classe)
            {
                #region warrior
                case Classes.Warrior:
                    // Improved Slam
                    if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 1464 ] )//	Slam
                        if ( from.HaveTalent( Talents.ImprovedSlam ) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedSlam );
                            ct += ae.S1;
                        }
                    break;
                #endregion
                #region warlock
                case Classes.Warlock:
                    // bane
                    if (SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 686 ] || // Shadow bolt
                        SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 348 ] ) // Immolate
                        if ( from.HaveTalent( Talents.Bane ) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.Bane );
                            ct += ae.S1;
                        }
                    //improved corruption
                    if (SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 172 ] ) // Corruption
                        if ( from.HaveTalent( Talents.ImprovedCorruption ) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedCorruption );
                            ct += ae.S1;
                        }
                    //master summoner
                    if (SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 688 ] ||// summon imp
                        SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 712 ] ||// succubus
                        SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 691 ] ||// summon felhunter
                        SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 597 ] ) // summon voidwalker
                        if ( from.HaveTalent( Talents.MasterSummoner ) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.MasterSummoner );
                            ct += ae.S1;
                        }
                    // nightfall
                    if ( from.ShadowTrance && SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 686 ] )
                    {
                        from.ReleaseAura( (AuraEffect)Abilities.abilities[ 17941 ] );
                        return 10;
                    }
                    // fel domination
                    if( from.HaveTalent(Talents.FelDomination))
                    {
                        bool bonus = false;
                        ArrayList al1 = new ArrayList();
                        AuraEffect af = (AuraEffect)from.GetTalentEffect( Talents.FelDomination );
                        foreach( Mobile.AuraReleaseTimer art in from.Auras )
                            if(art.aura.SpecialState == SpecialStates.FelDomination)
                            {
                                bonus = true;
                                al1.Add(art);
                            }
                        if (bonus)
                        {
                            ct += af.S1;
                            foreach( Mobile.AuraReleaseTimer art in al1)
                                from.ReleaseAura(art);
                        }
                    }
                    break;
                #endregion
                #region shaman
                case Classes.Shaman:
                    // lightining mastery
                    if (SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 403] || //lightining bolt
                        SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 421 ] )//chain lightining
                        if ( from.HaveTalent( Talents.LightningMastery) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.LightningMastery );
                            ct += ae.S1;
                        }
                    // improved healing wave
                    if (SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 331 ] )//healing wave
                        if ( from.HaveTalent( Talents.ImprovedHealingWave) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedHealingWave );
                            ct += ae.S1;
                        }
                    // improved ghost wolf
                    if (SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 2645 ] )//ghost wolf
                        if ( from.HaveTalent( Talents.ImprovedGhostWolf) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedGhostWolf );
                            ct += ae.S1;
                        }

                    break;
                #endregion
                case Classes.Rogue:break;
                #region priest
                case Classes.Priest:
                    // improved mana burn
                    if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 8129 ] )//	Mana burn
                        if ( from.HaveTalent( Talents.ImprovedManaBurn ) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedManaBurn );
                            ct += ae.S1;
                        }
                    // divine fury
                    if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 585 ] ||//	Smite
                            SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 14914 ] )// holy fire
                        if ( from.HaveTalent( Talents.DivineFury ) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.DivineFury );
                            ct += ae.S1;
                        }
                    // master healer
                    if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 6063 ] ||//	Heal
                        SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 2060 ] )//	Greater heal
                        if ( from.HaveTalent( Talents.MasterHealer ) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.MasterHealer );
                            ct += ae.S1;
                        }
                    break;
                #endregion
                case Classes.Paladin:break;
                #region mage
                case Classes.Mage:
                    // Improved fireball
                    if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 133 ] )//	Fireball
                        if ( from.HaveTalent( Talents.ImprovedFireball ) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedFireball );
                            ct += ae.S1;
                        }
                    // Improved FrostBolt
                    if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 116 ] )//		FrostBolt
                        if ( from.HaveTalent( Talents.ImprovedFrostbolt ) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedFrostbolt );
                            ct += ae.S1;
                        }
                    // Improved Arcane Explosion
                    if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 1449 ] )//	Arcane explosion
                        if ( from.HaveTalent( Talents.ImprovedArcaneExplosion ) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedArcaneExplosion );
                            ct += ae.S1;
                        }
                    // Presence of mind
                    if( from.HaveTalent(Talents.PresenceOfMind))
                    {
                        bool bonus = false;
                        ArrayList al1 = new ArrayList();
                        AuraEffect af = (AuraEffect)from.GetTalentEffect( Talents.PresenceOfMind );
                        foreach( Mobile.AuraReleaseTimer art in from.Auras )
                            if(art.aura.SpecialState == SpecialStates.PresenceOfMind)
                            {
                                bonus = true;
                                al1.Add(art);
                            }

                            if (bonus)
                            {
                                foreach( Mobile.AuraReleaseTimer art in al1)
                                    from.ReleaseAura(art);
                                return 0;
                            }
                    }

                    break;
                #endregion
                #region hunter
                case Classes.Hunter:
                    // improved revive pet
                    if (SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 982 ] )//revive pet
                        if ( from.HaveTalent( Talents.ImprovedRevivePet) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedRevivePet );
                            ct += ae.S1;
                        }
                    break;
                #endregion
                #region druid
                case Classes.Druid:
                    // improved wrath
                    if (SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 16814 ] )//wrath
                        if ( from.HaveTalent( Talents.ImprovedWrath) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedWrath );
                            ct += ae.S1;
                        }
                    break;
                #endregion
            }
            #region other - pets

            // improved firebolt
            if ( from.SummonedBy != null )
            {
                if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 3110 ] )//	Firebolt
                    if ( from.SummonedBy.HaveTalent( Talents.ImprovedFirebolt ) )
                    {
                        ae = (AuraEffect)from.SummonedBy.GetTalentEffect( Talents.ImprovedFirebolt );
                        ct += ae.S1;

                    }
            }
            #endregion

            #region CastingTime for ability
            foreach(Mobile.AuraReleaseTimer art in from.Auras)
            {
                if (art.aura.CastingTimeEffectedAbilityList != 0)
                {
                    if (from.SpecialForAuras[art.aura.CastingTimeEffectedAbilityList] != null)
                    {
                        if (from.SpecialForAuras[art.aura.CastingTimeEffectedAbilityList] is ArrayList)
                        {
                            if((from.SpecialForAuras[art.aura.CastingTimeEffectedAbilityList] as ArrayList).Contains((int)this.Id))
                                ct =(int)((ct + art.aura.CastingTimeBonusForAbility)*art.aura.CastingTimeModificatorForAbility);
                        }
                        if (from.SpecialForAuras[art.aura.CastingTimeEffectedAbilityList] is int)
                        {
                            int list = (int)from.SpecialForAuras[art.aura.CastingTimeEffectedAbilityList];
                            if( list == this.Id)
                                ct = (int)((ct + art.aura.CastingTimeBonusForAbility)*art.aura.CastingTimeModificatorForAbility);
                        }
                    }

                }
                if (art.aura.CastingTimeEffectedAbilityClass != 0)
                {
                    if ( AbilityClasses.abilityClasses[ (int)Id ] == art.aura.CastingTimeEffectedAbilityClass )
                    {
                        ct = (int)((ct + art.aura.CastingTimeBonusForAbility)*art.aura.CastingTimeModificatorForAbility);
                    }
                }
            }
            foreach(PermanentAura art in from.PermanentAuras)
            {
                if (art.aura.CastingTimeEffectedAbilityList != 0)
                {
                    if (from.SpecialForAuras[art.aura.CastingTimeEffectedAbilityList] != null)
                    {
                        if (from.SpecialForAuras[art.aura.CastingTimeEffectedAbilityList] is ArrayList)
                        {
                            if((from.SpecialForAuras[art.aura.CastingTimeEffectedAbilityList] as ArrayList).Contains((int)this.Id))
                            {
                                ct =(int)((ct + art.aura.CastingTimeBonusForAbility)*art.aura.CastingTimeModificatorForAbility);
                            }
                        }
                        if (from.SpecialForAuras[art.aura.CastingTimeEffectedAbilityList] is int)
                        {
                            int list = (int)from.SpecialForAuras[art.aura.CastingTimeEffectedAbilityList];
                            if( list == this.Id)
                                ct = (int)((ct + art.aura.CastingTimeBonusForAbility)*art.aura.CastingTimeModificatorForAbility);
                        }
                    }

                }
                if (art.aura.CastingTimeEffectedAbilityClass != 0)
                {
                    if ( AbilityClasses.abilityClasses[ (int)Id ] == art.aura.CastingTimeEffectedAbilityClass )
                    {
                        ct = (int)((ct + art.aura.CastingTimeBonusForAbility)*art.aura.CastingTimeModificatorForAbility);
                    }
                }
            }

            #endregion
            if (!(ct <=0))
            {
                    ct = (int)((float)ct/from.CastingSpeed);
            }

            return ct;
        }