Esempio n. 1
0
        public ushort CurrentVal(Mobile from)
        {
            int val = 0;

            foreach (Mobile.AuraReleaseTimer art in from.Auras)
            {
                if (art.aura.SkillId == this.Id)
                {
                    val += art.aura.SkillBonus - art.aura.SkillMalus;
                }
            }
            foreach (PermanentAura art in from.PermanentAuras)
            {
                if (art.aura.SkillId == this.Id)
                {
                    val += art.aura.SkillBonus - art.aura.SkillMalus;
                }
            }
            switch (from.Classe)
            {
            case Classes.Warrior:
                if (this.Id == DefenseSkill.SkillId)
                {
                    if (from.HaveTalent(Talents.Anticipation))
                    {
                        AuraEffect af = (AuraEffect)from.GetTalentEffect(Talents.Anticipation);
                        val += af.S1;
                    }
                }
                break;
            }
            if ((current + val) < 0)
            {
                return(0);
            }
            return((ushort)(current + val));
        }
Esempio n. 2
0
        float NatureSpellModifier( Mobile from )
        {
            float mod = 1.0f;
            AuraEffect ae = null;
            if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 2606 ] )//	Shock
                if ( from.HaveTalent( Talents.Concussion ) )
                {
                    ae = (AuraEffect)from.GetTalentEffect( Talents.Concussion );
                    mod += (float)( ae.s1 ) / 100f;
                }
                else

                    if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 324 ] )//	Lightning shield
                    if ( from.HaveTalent( Talents.ImprovedLightningShield ) )
                    {
                        ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedLightningShield );
                        mod += (float)( ae.s1 ) / 100f;
                    }
            return mod;
        }
Esempio n. 3
0
        public int SpellDamageCalculationBonus(float damg, Mobile src, Mobile target)
        {
            float dmg = damg;
            int damageTalentBonus = 0;
            float damageTalentModificator = 1f;

            #region talents handling bonuses
            if (src.Level > 9)
            {
                switch(src.Classe)
                {
                    case Classes.Warlock:
                        #region Warlock
                        // emberstorm
                        if ( resistance == Resistances.Fire )
                            if ( src.HaveTalent( Talents.Emberstorm ) )
                            {
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.Emberstorm );
                                damageTalentModificator *=1 + ((float)ae.S1 / 100f );
                            }

                        // Improved Curse of Agony
                        if ( src.HaveTalent( Talents.ImprovedCurseOfAgony ) && SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 980 ] )
                        {
                            AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ImprovedCurseOfAgony );
                            damageTalentModificator *=1 + ( (float)ae.S1 / 100f );
                        }

                        // Shadow Mastery
                        if ( AbilityClasses.abilityClasses[ (int)Id ] == (int)ClassesOfSpells.ShadowMagic )
                            if ( src.HaveTalent( Talents.ShadowMastery ) )
                            {
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ShadowMastery );
                                damageTalentModificator *=1 + ( (float)ae.S1/ 100f );
                            }
                        #endregion
                        break;
                    case Classes.Mage:
                        #region Mage
                        // Piercing Ice
                        if ( resistance == Resistances.Frost )
                            if ( src.HaveTalent( Talents.PiercingIce ) )
                            {
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.PiercingIce );
                                damageTalentModificator *=1 + ( (float)ae.S1/ 100f );
                            }
                        // Firepower
                        if ( resistance == Resistances.Fire)
                            if ( src.HaveTalent( Talents.FirePower ) )
                            {
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.FirePower );
                                damageTalentModificator *=1 + ( (float)ae.S1/ 100f );
                            }
                        // Improved Cone of Cold
                        if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 120 ])//	Cone of Cold
                            if ( src.HaveTalent( Talents.ImprovedConeOfCold ) )
                            {
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ImprovedConeOfCold );
                                damageTalentModificator *=1 + (float)ae.S1/100;
                            }
                        // ArcanePower
                        if( src.HaveTalent(Talents.ArcanePower))
                        {
                            bool bonus = false;
                            ArrayList al1 = new ArrayList();
                            AuraEffect af = (AuraEffect)src.GetTalentEffect( Talents.ArcanePower );
                            foreach( Mobile.AuraReleaseTimer art in src.Auras )
                                if(art.aura.SpecialState == SpecialStates.ArcanePower)
                                {
                                    bonus = true;
                                    al1.Add(art);
                                }

                            if (bonus)
                            {
                                damageTalentModificator *=1 + (float)af.S1/100;
                            }
                        }
                        #endregion
                        break;
                    case Classes.Druid:
                        #region Druid

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

                        #endregion
                        break;
                }
            }
            #endregion

            dmg += damageTalentBonus;
            dmg *= damageTalentModificator;

            #region Magical damage boost
            switch (this.resistance)
            {
                case Resistances.Fire : dmg += src.FireDamageIncrease;  dmg *=(1 + (float)src.FirePercentDamageIncrease/100);break;
                case Resistances.Shadow : dmg += src.ShadowDamageIncrease;  dmg *=(1 + (float)src.ShadowPercentDamageIncrease/100);break;
                case Resistances.Frost : dmg += src.FrostDamageIncrease;  dmg *=(1 + (float)src.FrostPercentDamageIncrease/100);break;
                case Resistances.Nature : dmg += src.NatureDamageIncrease;  dmg *=(1 + (float)src.NaturePercentDamageIncrease/100);break;
                case Resistances.Light : dmg += src.HolyDamageIncrease;break;
                case Resistances.Armor : dmg += src.PhysicalDamageIncrease;  dmg *=(1 + (float)src.PhysicalPercentDamageIncrease/100);break;
                case Resistances.Arcane : dmg +=src.ArcaneDamageIncrease;break;
            }
            dmg = (dmg + src.AllDamageDoneBonus - src.AllDamageDoneMalus)*src.AllDamageDoneModifier;
            dmg = (dmg + src.AllMagicDamageIncrease);
            switch (target.NpcType)
            {
                case (int)NpcTypes.Demon : dmg += src.SpellDamageDoneAgainsDemonsBonus;break;
                case (int)NpcTypes.Undead : dmg += src.SpellDamageDoneAgainsUndeadBonus;break;
            }

            if (src.SummonedBy !=null)
            {
                dmg+= src.SummonedBy.PetDamageBonus - src.SummonedBy.PetDamageMalus;
            }
            #endregion
            return (int)dmg;
        }
Esempio n. 4
0
        public void Summon(Mobile c)
        {
            if (c.Summon != null)
            {
                c.Summon.Delete();
                if (World.allMobiles.Contains(c.Summon))
                {
                    World.Remove(c.Summon, c);
                }
            }
            ConstructorInfo ci = World.MobilePool(mountId);
            BaseCreature    bc = (BaseCreature)ci.Invoke(null);

            bc.Faction    = c.Faction;
            bc.AIEngine   = new SummonedAI(c, bc);
            bc.SummonedBy = c;
            c.Summon      = bc;
            bc.Level      = c.Level;
            bc.Stamina    = bc.Str = bc.Iq = bc.Spirit = bc.HitPoints = bc.BaseHitPoints = bc.Agility = bc.BaseMana = 0;
            bc.InitStats();
            //	bc.AIEngine = new SummonedAI( c, bc );
            if (c.Classe == Classes.Warlock)
            {
                #region Fel Intellect
                if (bc.Id == 416 || bc.Id == 1863 || bc.Id == 1860 || bc.Id == 417)
                {
                    if (c.HaveTalent(Talents.FelIntellect))
                    {
                        AuraEffect ae = (AuraEffect)c.GetTalentEffect(Talents.FelIntellect);
                        float      bm = (float)bc.BaseMana;
                        bm         += bm * ((float)ae.S1) / 100f;
                        bc.BaseMana = bc.Mana = (int)bm;
                    }
                }
                #endregion
                #region Fel Stamina
                if (bc.Id == 416 || bc.Id == 1863 || bc.Id == 1860 || bc.Id == 417)
                {
                    if (c.HaveTalent(Talents.FelStamina))
                    {
                        AuraEffect ae = (AuraEffect)c.GetTalentEffect(Talents.FelStamina);
                        float      bm = (float)bc.BaseHitPoints;
                        bm += bm * ((float)ae.S1) / 100f;
                        bc.BaseHitPoints = bc.HitPoints = (int)bm;
                    }
                }
                #endregion
            }

            World.Add(bc, c.X, c.Y, c.Z, c.MapId);
            if (c is Character)
            {
                //	c.SendSmallUpdate( new int[] { (int)UpdateFields.UNIT_FIELD_CHARM, (int)UpdateFields.UNIT_FIELD_SUMMON }, new object[] { bc.Guid, bc.Guid } );

                Character ch     = c as Character;
                int       offset = 4;
                Converter.ToBytes(1, c.tempBuff, ref offset);
                Converter.ToBytes((byte)0, c.tempBuff, ref offset);
                c.PrepareUpdateData(c.tempBuff, ref offset, UpdateType.UpdateFull, false);
                //				bc.PrepareUpdateData( c.tempBuff, ref offset , UpdateType.UpdateFull, false );
                ch.Send(OpCodes.SMSG_UPDATE_OBJECT, c.tempBuff, offset);
                ch.ItemsUpdate();

                if (bc.Id == 89 || bc.Id == 416 || bc.Id == 1863 || bc.Id == 1860 || bc.Id == 304 || bc.Id == 417)
                {
                    ch.SendPetActionBar();
                }
            }
        }
Esempio n. 5
0
        public virtual int CoolDown( Mobile from )
        {
            int coldwn = cooldown;
            AuraEffect ae = null;
            if(this is SpellTemplate)
            {
                switch(from.Classe)
                {
                    #region mage
                    case Classes.Mage:
                        // improved fireblast
                        if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 2136 ] )//	FireBlast
                            if ( from.HaveTalent( Talents.ImprovedFireBlast ) )
                            {
                                ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedFireBlast );
                                coldwn += ae.S1;
                            }
                        // improved frost nova
                        if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 6131 ] )//	FireBlast
                            if ( from.HaveTalent( Talents.ImprovedFrostNova ) )
                            {
                                ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedFrostNova );
                                coldwn += ae.S1;
                            }
                    break;
                    #endregion
                    #region warrior
                    case Classes.Warrior:
                        //improved taunt
                    if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 355 ] )//	Taunt
                        if ( from.HaveTalent( Talents.ImprovedTaunt ) )
                        {
                            ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedTaunt );
                            coldwn += ae.S1;
                        }
                        //improved intercept
                        if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 20252 ] )//	intercept
                            if ( from.HaveTalent( Talents.ImprovedIntercept ) )
                            {
                                ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedIntercept );
                                coldwn += ae.S1;
                            }
                    break;
                    #endregion
                    #region warlock
                    case Classes.Warlock:

                    break;
                    #endregion
                }
                if(from.SummonedBy != null)
                    if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 4388] )
                    if(from.SummonedBy.HaveTalent(Talents.ImprovedLashOfPain))
                    {
                        ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedLashOfPain );
                        coldwn += ae.S1;
                    }
            }
            int cooldwn = coldwn;
            #region Cooldown for ability
            foreach(Mobile.AuraReleaseTimer art in from.Auras)
            {
                if (art.aura.CooldownEffectedAbilityList != 0)
                {
                    if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] != null)
                    {
                        if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] is ArrayList)
                        {
                            if((from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] as ArrayList).Contains((int)this.Id))
                                    cooldwn =(int)((cooldwn + art.aura.CooldownBonusForAbility)*art.aura.CooldownModificatorForAbility);
                        }
                        if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] is int)
                        {
                            int list = (int)from.SpecialForAuras[art.aura.CooldownEffectedAbilityList];
                            if( list == this.Id)
                                cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility)*art.aura.CooldownModificatorForAbility);
                        }
                    }

                }
                if (art.aura.CooldownEffectedAbilityClass != 0)
                {
                    if ( AbilityClasses.abilityClasses[ (int)Id ] == art.aura.CooldownEffectedAbilityClass )
                    {
                        cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility)*art.aura.CooldownModificatorForAbility);
                    }
                }
            }
            foreach(PermanentAura art in from.PermanentAuras)
            {
                if (art.aura.CooldownEffectedAbilityList != 0)
                {
                    if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] != null)
                    {
                        if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] is ArrayList)
                        {
                            if((from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] as ArrayList).Contains((int)this.Id))
                            {
                                cooldwn =(int)((cooldwn + art.aura.CooldownBonusForAbility)*art.aura.CooldownModificatorForAbility);
                            }
                        }
                        if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] is int)
                        {
                            int list = (int)from.SpecialForAuras[art.aura.CooldownEffectedAbilityList];
                            if( list == this.Id)
                                cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility)*art.aura.CooldownModificatorForAbility);
                        }
                    }

                }
                if (art.aura.CooldownEffectedAbilityClass != 0)
                {
                    if ( AbilityClasses.abilityClasses[ (int)Id ] == art.aura.CooldownEffectedAbilityClass )
                    {
                        cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility)*art.aura.CooldownModificatorForAbility);
                    }
                }
            }

            #endregion

            return cooldwn;
        }
Esempio n. 6
0
		public float RangedBlockChanceCalculation(Mobile m,float dif)
		{
			float chance = 0f;
			if (m.activeShield != null)
			{
				if (m is Character) 
				{
					chance = (int)((m as Character).BaseBlockChance + BlockBonus - BlockMalus - (int)dif/2);					
				}
				else chance = 5 + BlockBonus - BlockMalus - (int)dif/2;
#if TRACES_COMBAT
				Console.WriteLine("Block result: chance: " +  chance + " roll"); 
#endif		
			}
			// shield specialization
			if (m.HaveTalent(Talents.ShieldSpecialization))
			{
				AuraEffect af = (AuraEffect)m.GetTalentEffect(Talents.ShieldSpecialization);
				chance +=af.S1;
			}
			return chance;
		}
Esempio n. 7
0
		public float ParryChanceCalculation(Mobile m,float dif)
		{
			float chance = 0f;
			if(m.HaveSpell(3127))
			{			
				if (m is Character) chance = (int)((m as Character).BaseParryChance + ParryBonus - ParryMalus - dif/2);
				else chance = 5 + ParryBonus - ParryMalus - (int)dif/2;
#if TRACES_COMBAT
				Console.WriteLine("Parry result: parryChance: " +  chance + " roll");  
#endif
				if ( m.HaveTalent( Talents.Deflection) )
				{
					AuraEffect ae = (AuraEffect)m.GetTalentEffect( Talents.Deflection );
					chance = (chance * 1 + (float)ae.S1/100); 
				}
				
			}
			return chance;
		}
Esempio n. 8
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;
        }
Esempio n. 9
0
 public void Heal( Mobile src, Mobile target,float dmg )
 {
     float spellMod = 1.0f;
     dmg +=src.HealGiveIncrease - src.HealGiveDecrease;
     dmg *=src.HealGiveModifier;
     dmg +=src.HealTakeIncrease - src.HealTakeDecrease;
     dmg *=src.HealTakeModifier;
     switch( resistance )
     {
         case Resistances.Light:
             spellMod = LightSpellHealModifier( src );
             break;
         case Resistances.Nature:
             spellMod = NatureSpellHealModifier( src );
             break;
     }
     dmg *= spellMod;
     if ( src.Classe == Classes.Warlock )
     {
         #region Warlock Improved HealthStone
         if ( src.HaveTalent( Talents.ImprovedHealthstone ) && SpellTemplate.SpellEffects[ 5720 ] == SpellTemplate.SpellEffects[ Id ] )
         {
             AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ImprovedHealthstone );
             dmg += dmg * (float)( ae.s1 ) / 100f;
         }
         #endregion
     }
     target.GainHealth( src, (int)dmg );
 }
Esempio n. 10
0
        //need modifications talents modif this too
        public int GetManaCost(Mobile c)
        {
            int mc = manaCost;
            switch (c.Classe)
            {
                    #region mage
                case Classes.Mage:
                    // frost channeling
                    if ( resistance == Resistances.Frost )
                    {
                        if ( c.HaveTalent( Talents.FrostChanneling ) )
                        {
                            AuraEffect ae = (AuraEffect)c.GetTalentEffect( Talents.FrostChanneling );
                            mc = (int)(mc * 1 + (float)ae.S1/100);
                        }
                    }
                    //arcane concentration
                    int ClearingState = 0xd45a45;
                    if ( c.AdditionnalStates.Contains(ClearingState))
                    {
                        AuraEffect ae = (AuraEffect)c.GetTalentEffect( Talents.ArcaneConcentration);
                        mc +=ae.S1;
                        c.AdditionnalStates.Remove(ClearingState);
                    }
                    // ArcanePower
                    if( c.HaveTalent(Talents.ArcanePower))
                    {
                        bool bonus = false;
                        ArrayList al1 = new ArrayList();
                        AuraEffect af = (AuraEffect)c.GetTalentEffect( Talents.ArcanePower );
                        foreach( Mobile.AuraReleaseTimer art in c.Auras )
                            if(art.aura.SpecialState == SpecialStates.ArcanePower)
                            {
                                bonus = true;
                                al1.Add(art);
                            }

                        if (bonus)
                        {
                            mc = (int)(mc * (1 + (float)af.S1/100));
                        }
                    }

                    break;
                    #endregion
                    #region warrior
                case Classes.Warrior:
                    // improved heroic strike
                    if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 284 ] )//herroic strike
                        if ( c.HaveTalent( Talents.ImprovedHeroicStrike) )
                        {
                            AuraEffect ae = (AuraEffect)c.GetTalentEffect( Talents.ImprovedHeroicStrike );
                            mc += ae.S1;
                        }
                    //improved thunder clap
                    if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 6343 ] )//	Thunder clap
                        if ( c.HaveTalent( Talents.ImprovedThunderClap ) )
                        {
                            AuraEffect ae = (AuraEffect)c.GetTalentEffect( Talents.ImprovedThunderClap );
                            mc += ae.s1;
                        }
                    //improved sunder armor
                    if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 11597 ] )//	Sunder aromr
                        if ( c.HaveTalent( Talents.ImprovedSunderArmor ) )
                        {
                            AuraEffect ae = (AuraEffect)c.GetTalentEffect( Talents.ImprovedSunderArmor );
                            mc += ae.s1;
                        }
                    // improved execute
                    if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 5308 ] )//execute
                        if ( c.HaveTalent( Talents.ImprovedExecute) )
                        {
                            AuraEffect ae = (AuraEffect)c.GetTalentEffect( Talents.ImprovedExecute );
                            mc += ae.S1;
                        }

                    break;
                    #endregion
                    #region Warlock
                case Classes.Warlock:
                    if ( AbilityClasses.abilityClasses[ (int)Id ] == (int)ClassesOfSpells.Destruction )
                        if ( c.HaveTalent( Talents.Cataclysm) )
                        {
                            AuraEffect ae = (AuraEffect)c.GetTalentEffect( Talents.Cataclysm );
                            mc = (int)(mc*(1 + (float)ae.S1/100));
                        }
                    // fel domination
                    if( c.HaveTalent(Talents.FelDomination))
                    {
                        bool bonus = false;
                        ArrayList al1 = new ArrayList();
                        AuraEffect ae = (AuraEffect)c.GetTalentEffect( Talents.FelDomination );
                        foreach( Mobile.AuraReleaseTimer art in c.Auras )
                            if(art.aura.SpecialState == SpecialStates.FelDomination)
                            {
                                bonus = true;
                                al1.Add(art);
                            }
                        if (bonus)
                        {
                            mc = (int)(mc*0.5);
                        }
                    }
                    break;
                    #endregion
            }
            switch( this.resistance )
            {
                case Resistances.Fire:
                    mc -= c.FireCostMalus;
                    break;
                case Resistances.Frost:
                    mc -= c.FrostCostMalus;
                    break;
                case Resistances.Light:
                    mc -= c.HolyCostMalus;
                    break;
                case Resistances.Arcane:
                    mc -= c.ArcaneCostMalus;
                    break;
                case Resistances.Shadow:
                    mc -= c.ShadowCostMalus;
                    break;
                case Resistances.Nature:
                    mc -= c.NatureCostMalus;
                    break;
            }
            mc -=c.AllCostMalus;
            int val = 0;

            mc -= val;
            mc =(int)((float)mc * c.PowerCostModifier);

            #region Cost for ability
            foreach(Mobile.AuraReleaseTimer art in c.Auras)
            {
                if (art.aura.CostEffectedAbilityList != 0)
                {
                    if (c.SpecialForAuras[art.aura.CostEffectedAbilityList] != null)
                    {
                        if (c.SpecialForAuras[art.aura.CostEffectedAbilityList] is ArrayList)
                        {
                            if((c.SpecialForAuras[art.aura.CostEffectedAbilityList] as ArrayList).Contains((int)this.Id))
                                mc =(int)((mc + art.aura.CostBonusForAbility)*art.aura.CostModificatorForAbility);
                        }
                        if (c.SpecialForAuras[art.aura.CostEffectedAbilityList] is int)
                        {
                            int list = (int)c.SpecialForAuras[art.aura.CostEffectedAbilityList];
                            if( list == this.Id)
                                mc = (int)((mc + art.aura.CostBonusForAbility)*art.aura.CostModificatorForAbility);
                        }
                    }

                }
                if (art.aura.CostEffectedAbilityClass != 0)
                {
                    if ( AbilityClasses.abilityClasses[ (int)Id ] == art.aura.CostEffectedAbilityClass )
                    {
                        mc = (int)((mc + art.aura.CostBonusForAbility)*art.aura.CostModificatorForAbility);
                    }
                }
            }
            foreach(PermanentAura art in c.PermanentAuras)
            {
                if (art.aura.CostEffectedAbilityList != 0)
                {
                    if (c.SpecialForAuras[art.aura.CostEffectedAbilityList] != null)
                    {
                        if (c.SpecialForAuras[art.aura.CostEffectedAbilityList] is ArrayList)
                        {
                            if((c.SpecialForAuras[art.aura.CostEffectedAbilityList] as ArrayList).Contains((int)this.Id))
                            {
                                mc =(int)((mc + art.aura.CostBonusForAbility)*art.aura.CostModificatorForAbility);
                            }
                        }
                        if (c.SpecialForAuras[art.aura.CostEffectedAbilityList] is int)
                        {
                            int list = (int)c.SpecialForAuras[art.aura.CostEffectedAbilityList];
                            if( list == this.Id)
                                mc = (int)((mc + art.aura.CostBonusForAbility)*art.aura.CostModificatorForAbility);
                        }
                    }

                }
                if (art.aura.CostEffectedAbilityClass != 0)
                {
                    if ( AbilityClasses.abilityClasses[ (int)Id ] == art.aura.CostEffectedAbilityClass )
                    {
                        mc = (int)((mc + art.aura.CostBonusForAbility)*art.aura.CostModificatorForAbility);
                    }
                }
            }

            #endregion

            if (mc <=0) mc = 0;
            return mc;
        }
Esempio n. 11
0
        public virtual int Duration( Mobile from )
        {
            int dur = duration;

            switch (from.Classe)
            {
                case Classes.Mage:
                    // Permafrost
                    if ( resistance == Resistances.Frost )
                    {
                        if ( from.HaveTalent( Talents.Permafrost ) &&  SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 12485 ]  )
                        {
                            AuraEffect ae = (AuraEffect)from.GetTalentEffect( Talents.Permafrost );
                            return duration + ae.S1;
                        }
                    }
                    break;
                case Classes.Warrior:
                    // Improved shield block
                    if ( from.HaveTalent( Talents.ImprovedShieldBlock ) &&  SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 2565 ]  )
                        {
                            AuraEffect ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedShieldBlock );
                            return duration + ae.S2;
                        }
                    // improved disarm
                    if ( from.HaveTalent( Talents.ImprovedDisarm ) &&  SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 676 ]  )
                    {
                        AuraEffect ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedDisarm );
                        return duration + ae.S2;
                    }
                    // improved shield wall
                    if ( from.HaveTalent( Talents.ImprovedShieldWall ) &&  SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 871 ]  )
                    {
                        AuraEffect ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedShieldWall );
                        return duration + ae.S2;
                    }
                    break;
            }

            #region Duration for ability
            foreach(Mobile.AuraReleaseTimer art in from.Auras)
            {
                if (art.aura.DurationEffectedAbilityList != 0)
                {
                    if (from.SpecialForAuras[art.aura.DurationEffectedAbilityList] != null)
                    {
                        if (from.SpecialForAuras[art.aura.DurationEffectedAbilityList] is ArrayList)
                        {
                            if((from.SpecialForAuras[art.aura.DurationEffectedAbilityList] as ArrayList).Contains((int)this.Id))
                                dur =(int)((dur + art.aura.DurationBonusForAbility)*art.aura.DurationModificatorForAbility);
                        }
                        if (from.SpecialForAuras[art.aura.DurationEffectedAbilityList] is int)
                        {
                            int list = (int)from.SpecialForAuras[art.aura.DurationEffectedAbilityList];
                            if( list == this.Id)
                                dur = (int)((dur + art.aura.DurationBonusForAbility)*art.aura.DurationModificatorForAbility);
                        }
                    }

                }
                if (art.aura.DurationEffectedAbilityClass != 0)
                {
                    if ( AbilityClasses.abilityClasses[ (int)Id ] == art.aura.DurationEffectedAbilityClass )
                    {
                        dur = (int)((dur + art.aura.DurationBonusForAbility)*art.aura.DurationModificatorForAbility);
                    }
                }
            }
            foreach(PermanentAura art in from.PermanentAuras)
            {
                if (art.aura.DurationEffectedAbilityList != 0)
                {
                    if (from.SpecialForAuras[art.aura.DurationEffectedAbilityList] != null)
                    {
                        if (from.SpecialForAuras[art.aura.DurationEffectedAbilityList] is ArrayList)
                        {
                            if((from.SpecialForAuras[art.aura.DurationEffectedAbilityList] as ArrayList).Contains((int)this.Id))
                            {
                                dur =(int)((dur + art.aura.DurationBonusForAbility)*art.aura.DurationModificatorForAbility);
                            }
                        }
                        if (from.SpecialForAuras[art.aura.DurationEffectedAbilityList] is int)
                        {
                            int list = (int)from.SpecialForAuras[art.aura.DurationEffectedAbilityList];
                            if( list == this.Id)
                                dur = (int)((dur + art.aura.DurationBonusForAbility)*art.aura.DurationModificatorForAbility);
                        }
                    }

                }
                if (art.aura.DurationEffectedAbilityClass != 0)
                {
                    if ( AbilityClasses.abilityClasses[ (int)Id ] == art.aura.DurationEffectedAbilityClass )
                    {
                        dur = (int)((dur + art.aura.DurationBonusForAbility)*art.aura.DurationModificatorForAbility);
                    }
                }
            }

            #endregion
            return dur;
        }
Esempio n. 12
0
        public void DrainMana( Mobile src, Mobile target, float dmg )
        {
            int heal = MakeManaDamage( src, target, dmg, true );
            float damage = 0f;
            if ( src.HaveTalent( Talents.ImprovedDrainMana ) )
            {
                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ImprovedDrainMana );
                if(src.TalentLevel(Talents.ImprovedDrainMana) == 1)
                    damage = (float)(heal*0.15);
                else damage = (float)(heal*0.30);

            }
            if (damage > 0) this.MakeDamage(src,target,damage);
            src.GainMana( target, heal );
        }
Esempio n. 13
0
 public void DrainLife( Mobile src, Mobile target, float dmg )
 {
     #region Warlock Improved Health Funnel
     if ( src.HaveTalent( Talents.ImprovedHealthFunnel ) && SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 755 ] )
     {
         AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ImprovedHealthFunnel );
         dmg += dmg * ( (float)ae.S1 ) / 100f;
     }
     #endregion
     int heal = MakeDamage( true, src, target, dmg, true );
     if ( src.HaveTalent( Talents.ImprovedDrainLife ) )
     {
         AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ImprovedDrainLife );
         float minus = (float)heal;
         minus += ( minus * (float)ae.S1 ) / 100f;
         heal = (int)minus;
     }
     src.GainHealth( target, heal );
 }
Esempio n. 14
0
        public virtual int CoolDown(Mobile from)
        {
            int        coldwn = cooldown;
            AuraEffect ae     = null;

            if (this is SpellTemplate)
            {
                switch (from.Classe)
                {
                    #region mage
                case Classes.Mage:
                    // improved fireblast
                    if (SpellTemplate.SpellEffects[(int)Id] == SpellTemplate.SpellEffects[2136])                                  //	FireBlast
                    {
                        if (from.HaveTalent(Talents.ImprovedFireBlast))
                        {
                            ae      = (AuraEffect)from.GetTalentEffect(Talents.ImprovedFireBlast);
                            coldwn += ae.S1;
                        }
                    }
                    // improved frost nova
                    if (SpellTemplate.SpellEffects[(int)Id] == SpellTemplate.SpellEffects[6131])                                  //	FireBlast
                    {
                        if (from.HaveTalent(Talents.ImprovedFrostNova))
                        {
                            ae      = (AuraEffect)from.GetTalentEffect(Talents.ImprovedFrostNova);
                            coldwn += ae.S1;
                        }
                    }
                    break;

                    #endregion
                    #region warrior
                case Classes.Warrior:
                    //improved taunt
                    if (SpellTemplate.SpellEffects[(int)Id] == SpellTemplate.SpellEffects[355])                          //	Taunt
                    {
                        if (from.HaveTalent(Talents.ImprovedTaunt))
                        {
                            ae      = (AuraEffect)from.GetTalentEffect(Talents.ImprovedTaunt);
                            coldwn += ae.S1;
                        }
                    }
                    //improved intercept
                    if (SpellTemplate.SpellEffects[(int)Id] == SpellTemplate.SpellEffects[20252])                                  //	intercept
                    {
                        if (from.HaveTalent(Talents.ImprovedIntercept))
                        {
                            ae      = (AuraEffect)from.GetTalentEffect(Talents.ImprovedIntercept);
                            coldwn += ae.S1;
                        }
                    }
                    break;

                    #endregion
                    #region warlock
                case Classes.Warlock:

                    break;
                    #endregion
                }
                if (from.SummonedBy != null)
                {
                    if (SpellTemplate.SpellEffects[(int)Id] == SpellTemplate.SpellEffects[4388])
                    {
                        if (from.SummonedBy.HaveTalent(Talents.ImprovedLashOfPain))
                        {
                            ae      = (AuraEffect)from.GetTalentEffect(Talents.ImprovedLashOfPain);
                            coldwn += ae.S1;
                        }
                    }
                }
            }
            int cooldwn = coldwn;
            #region Cooldown for ability
            foreach (Mobile.AuraReleaseTimer art in from.Auras)
            {
                if (art.aura.CooldownEffectedAbilityList != 0)
                {
                    if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] != null)
                    {
                        if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] is ArrayList)
                        {
                            if ((from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] as ArrayList).Contains((int)this.Id))
                            {
                                cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility) * art.aura.CooldownModificatorForAbility);
                            }
                        }
                        if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] is int)
                        {
                            int list = (int)from.SpecialForAuras[art.aura.CooldownEffectedAbilityList];
                            if (list == this.Id)
                            {
                                cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility) * art.aura.CooldownModificatorForAbility);
                            }
                        }
                    }
                }
                if (art.aura.CooldownEffectedAbilityClass != 0)
                {
                    if (AbilityClasses.abilityClasses[(int)Id] == art.aura.CooldownEffectedAbilityClass)
                    {
                        cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility) * art.aura.CooldownModificatorForAbility);
                    }
                }
            }
            foreach (PermanentAura art in from.PermanentAuras)
            {
                if (art.aura.CooldownEffectedAbilityList != 0)
                {
                    if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] != null)
                    {
                        if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] is ArrayList)
                        {
                            if ((from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] as ArrayList).Contains((int)this.Id))
                            {
                                cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility) * art.aura.CooldownModificatorForAbility);
                            }
                        }
                        if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] is int)
                        {
                            int list = (int)from.SpecialForAuras[art.aura.CooldownEffectedAbilityList];
                            if (list == this.Id)
                            {
                                cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility) * art.aura.CooldownModificatorForAbility);
                            }
                        }
                    }
                }
                if (art.aura.CooldownEffectedAbilityClass != 0)
                {
                    if (AbilityClasses.abilityClasses[(int)Id] == art.aura.CooldownEffectedAbilityClass)
                    {
                        cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility) * art.aura.CooldownModificatorForAbility);
                    }
                }
            }

            #endregion

            return(cooldwn);
        }
Esempio n. 15
0
 public float AbsorbCalculation(float dmg, Mobile src, Mobile target)
 {
     int realDamage = 0;
     switch( resistance )
     {
         case Resistances.Fire:
             realDamage = target.DiminishFireAbsordb( (int)dmg );
             if (dmg - realDamage > 0)
             {
                 if (target.HaveTalent(Talents.ImprovedFireWard))
                 {
                     AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ImprovedFireWard );
                     float modif = (float)ae.S1/100;
                     bool haveFWSpell = false;
                     foreach( Mobile.AuraReleaseTimer art in target.Auras )
                         if ( art.ae == (AuraEffect)Abilities.abilities[10223])haveFWSpell = true;
                     if (haveFWSpell) this.MakeDamage(target,src,(dmg - realDamage)*modif);
                 }
             }
             realDamage = target.DiminishAbsordbAll( realDamage );
             break;
         case Resistances.Frost:
             realDamage = target.DiminishFrostAbsordb( (int)dmg );
             // Improved frost ward
             if ( target.Classe == Classes.Mage )
                 if ( target.HaveTalent( Talents.ImprovedFrostWard ) &&
                     realDamage != dmg )
                 {
                     bool haveFWSpell = false;
                     foreach( Mobile.AuraReleaseTimer art in target.Auras )
                         if ( art.ae == (AuraEffect)Abilities.abilities[6143])haveFWSpell = true;
                     if (haveFWSpell) target.GainMana( target, (int)(( dmg - realDamage ) / 2) );
                 }
             realDamage = target.DiminishAbsordbAll( realDamage );
             break;
         case Resistances.Light:
             realDamage = target.DiminishHolyAbsordb( (int)dmg );
             realDamage = target.DiminishAbsordbAll( realDamage );
             break;
         case Resistances.Arcane:
             realDamage = target.DiminishArcaneAbsordb( (int)dmg );
             realDamage = target.DiminishAbsordbAll( realDamage );
             break;
         case Resistances.Shadow:
             realDamage = target.DiminishShadowAbsordb( (int)dmg );
             realDamage = target.DiminishAbsordbAll( realDamage );
             break;
         case Resistances.Nature:
             realDamage = target.DiminishNatureAbsordb( (int)dmg );
             realDamage = target.DiminishAbsordbAll( realDamage );
             break;
         case Resistances.Armor:
             realDamage = target.DiminishAbsorbPhysical( (int)dmg );
             realDamage = target.DiminishAbsordbAll( realDamage );
             break;
     }
     realDamage = target.DiminishAbsorbAllDamage(realDamage);
     return realDamage;
 }
Esempio n. 16
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;
        }
Esempio n. 17
0
 public void LifeTap( Mobile src, Mobile target, float dmg )
 {
     target.LooseHits(src,(int)dmg);
     if ( src.HaveTalent( Talents.ImprovedLifeTap ) )
     {
         AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ImprovedLifeTap );
         float minus = (float)dmg;
         minus += ( minus * (float)ae.S1 ) / 100f;
         target.GainMana( src, (int)minus);
     }
     src.GainMana( src, (int)dmg );
 }
Esempio n. 18
0
		public virtual int RangedHit( Mobile m, float dmgBonus,bool pass, ref int amountBlocked, ref int amountAbsorbed )
		{
			Item weapon = this.RangedWeapon;
			Item ammo = this.RangedAmmo;
			if(weapon != null)
			{
				if (this is Character)
					if(weapon.InventoryType == InventoryTypes.Thrown)
					{
						(this as Character).ConsumeItemByIdUpTo(weapon.Id,1);
					}
					else
					{
						(this as Character).ConsumeItemByIdUpTo(ammo.Id,1);
					}
					
			
				float critChance = RangedCriticalChanceCalculation(weapon,m);
				float dif = SkillDifCalculation(weapon,m);
				float hitChance = RangedHitChanceCalculation(weapon,m,dif);
		
				bool criticalStrike = false;
			
				#region critical and hit test
				int roll =Utility.Random( 100 );	
				bool test = false;

				if ((int)critChance >= roll || test)
				{
					#region Critical hit trigger done
					ArrayList al = new ArrayList();
					ArrayList pal = new ArrayList();
					foreach( AuraReleaseTimer art in aura )
					{
						int a = art.aura.OnCriticalHit;
						if ( a != -1 )
							al.Add( art );
					}
					foreach( PermanentAura art in permanentAura )
					{
						int a = art.aura.OnCriticalHit;
						if ( a != -1 )
							al.Add( art );
					}
					foreach( object obj in al )
					{
						if(obj is AuraReleaseTimer)
						{ 
							AuraReleaseTimer art = (AuraReleaseTimer)obj;
							int a = art.aura.OnCriticalHit;
							if ( a != -1 )
								if(Triggers[ a ] != null)
									( Triggers[ a ] as OnCriticalHitTrigger )( this, m, art.ae );
						}
						if(obj is PermanentAura)
						{ 
							PermanentAura art = (PermanentAura)obj;
							int a = art.aura.OnCriticalHit;
							if ( a != -1 )
								if(Triggers[ a ] != null)
									( Triggers[ a ] as OnCriticalHitTrigger )( this, m, Abilities.abilities[(int)art.Id] );
						}
					}
					#endregion
				
					#region Critical hit done Triggers
					ArrayList al2 = new ArrayList();
					ArrayList pal2 = new ArrayList();
					foreach( AuraReleaseTimer art in aura )
					{
						int a = art.aura.OnCriticalHitDone;
						if ( a != -1 )
							al2.Add( art );
					}
					foreach( PermanentAura art in permanentAura)
					{
						int a = art.aura.OnCriticalHitDone;
						if ( a != -1 )
							pal2.Add( art );
					}
					foreach( object obj in al2 )
					{
						if(obj is AuraReleaseTimer)
						{ 
							AuraReleaseTimer art = (AuraReleaseTimer)obj;
					
							int a = art.aura.OnCriticalHitDone;
							if ( a != -1 )
								if(Triggers[ a ] != null) 
									( Triggers[ a ] as OnCriticalHitDoneTrigger )(this, m, art.ae );
						}
						if(obj is PermanentAura)
						{ 
							PermanentAura art = (PermanentAura)obj;
							int a = art.aura.OnCriticalHitDone;
							if ( a != -1 )
								if(Triggers[ a ] != null)
									( Triggers[ a ] as OnCriticalHitDoneTrigger )(this, m, Abilities.abilities[(int)art.Id] );
						}
					}
					#endregion
			
					/*bovie*/
					
					/*bovie*/	
					lastAttack = AttackStatus.Critical;
					m.lastAttackToMe = AttackStatus.Critical;
					criticalStrike = true;
				}
				else if((int)hitChance >= roll)
				{
					lastAttack = AttackStatus.NormalHit;
					m.lastAttackToMe = AttackStatus.NormalHit;
				}
				else 
				{
					lastAttack = AttackStatus.Loose;
					m.lastAttackToMe = AttackStatus.Loose;
					return 0;
				}
				#endregion

				if (!pass)
				{
					float dodgeChance = RangedDodgeChanceCalculation(m,dif);
	
					#region Dodge test
					roll = Utility.Random( 100 );
					if (dodgeChance >= roll)
					{
						lastAttack = AttackStatus.Dodge;
						m.lastAttackToMe = AttackStatus.Dodge;
						return 0;	
					}
					#endregion
				}


				float damage = RangedDamageDoneCalculation(m,dmgBonus,criticalStrike,weapon);
				float blockChance = RangedBlockChanceCalculation(m,dif);
				if (!pass)
				{
					#region Block test + block reduction	
					roll = Utility.Random( 100 );
				
					if (blockChance >= roll)
					{
						lastAttack = AttackStatus.Block;
						m.lastAttackToMe = AttackStatus.Block;
						amountBlocked = m.Block + m.Str/30;
						damage -= amountBlocked;
						#region talents
						// shield specialization
						if ( m.HaveTalent(Talents.ShieldSpecialization) )
						{
							AuraEffect af = (AuraEffect)m.GetTalentEffect(Talents.ShieldSpecialization);
							roll = Utility.Random( 100 );
							if ( roll < af.H )
							{
								m.GainMana(m,(Abilities.abilities[af.AdditionalSpell] as SpellTemplate).S1);
							}
						}
						#endregion
					}
		
					#endregion
				}
				#region Armor reduction
				float armor = ArmorReductionCalculation(m); 
				damage = damage * (1 - armor);
				#endregion

				#region immune
				if (m.ImmunePhysicalDamage)
				{
					lastAttack = AttackStatus.Immune;
					m.lastAttackToMe = AttackStatus.Immune;
					return 0;
				}
				#endregion
			
				#region absorb
				damage =(int)m.DamageAbsorbCombat(damage);
				if ( damage < 0 )
				{
					this.lastAttack = AttackStatus.Absorb;
					m.lastAttackToMe = AttackStatus.Absorb;	
					return 0;
				}
				#endregion

				#region Targets modificators 
				damage = RangedDamageTakenCalculation(m,damage);
				#endregion
				damage = m.ManaShieldLost(this,(int)damage);
				#region other effects
			
				switch (this.Classe)
				{
						#region warrior
					case Classes.Warrior:
					
						if ( this.HaveTalent( Talents.UnbridledWrath) )
						{
							AuraEffect ae = (AuraEffect)this.GetTalentEffect( Talents.UnbridledWrath );
							roll = Utility.Random( 100 );
							if(roll < ae.H)
							{
								this.GainMana(this,1);
							}
						}
					
						break;
						#endregion
				}
				#endregion

				if ( damage > 0 && this is Character)
					this.SkillUpWeapon(weapon);
				return (int)damage;
			}
			else 
				return 0;
		}
Esempio n. 19
0
        public void MakeDMGSpellTriggers(Mobile src, Mobile target, LastSpellState state,int dmg)
        {
            int roll;
            #region Additional effects
            #region OnCriticalTalentsHandling
                if(state == LastSpellState.Critical)
                {
                    if(src.Level > 9)
                    {
                        switch (src.Classe)
                        {
                            #region mage
                            case Classes.Mage:
                                // ignite
                                if ( resistance == Resistances.Fire)
                                {
                                    if ( src.HaveTalent( Talents.Ignite ) )
                                    {
                                        AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.Ignite );
                                        AuraEffect af = (AuraEffect)Abilities.abilities[12654];
                                        float modif = (float)ae.S1/100;
                                        af.ApplyDot(src, target, (int)(dmg*modif), af.T1, af.Duration(src));
                                    }
                                }
                                break;
                                #endregion
                            #region warrior
                            case Classes.Warrior:

                                break;
                                #endregion
                        }
                    }

                }
                #endregion
            #region Other Spell effecting Talents
                switch (src.Classe)
                {
                    #region mage
                    case Classes.Mage:
                        //Impact
                        if (state == LastSpellState.Normal)
                        {
                            if (src.HaveTalent(Talents.Impact))
                            {
                                if (this.resistance == Resistances.Fire)
                                {
                                    AuraEffect af = (AuraEffect)src.GetTalentEffect(Talents.Impact);
                                    roll = Utility.Random( 100 );
                                    if(roll < af.S1)
                                    {
                                        AuraEffect ef = (AuraEffect)Abilities.abilities[(int)af.AdditionalSpell];
                                        Aura aura = new Aura();
                                        aura.ForceStun = true;
                                        target.AddAura(src,ef,aura,true);
                                    }

                                }
                            }

                            // Improved Scorch
                            if ( src.HaveTalent( Talents.ImprovedScorch ) &&
                                SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 2948 ] )
                            {
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ImprovedScorch);
                                roll = Utility.Random( 100 );
                                if(roll < ae.S1)
                                {
                                    AuraEffect ef = (AuraEffect)Abilities.abilities[(int)ae.AdditionalSpell];
                                    Aura aura = new Aura();
                                    aura.FireDamageTakenModifier = 1 + (float)ef.S1/100;
                                    target.AddAura(src,ef,aura,true);
                                }
                            }

                            // Arcane Concentration
                            int ClearingState = 0xd45a45;
                            if ( src.HaveTalent( Talents.ArcaneConcentration ) )
                            {
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ArcaneConcentration);
                                roll = Utility.Random( 100 );
                                if(roll < ae.H)
                                {
                                    src.AdditionnalStates.Add(ClearingState);
                                }
                            }
                        }

                        break;
                    #endregion
                    #region Warlock
                    case Classes.Warlock:
                        ///aftewmatch
                        if ( AbilityClasses.abilityClasses[ (int)Id ] == (int)ClassesOfSpells.Destruction )
                            if ( src.HaveTalent( Talents.Aftermath ) )
                            {
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.Aftermath );
                                if ( Utility.Random( 100 ) < ae.H )
                                {
                                    Aura aura = new Aura();
                                    aura.SpeedModifier = ( -( (float)ae.S1 ) / 100.0f );
                                    aura.OnRelease = new Aura.AuraReleaseDelegate( SpellTemplate.OnCastSpeedModEnd );
                                    target.AddAura(src, ae, aura, true );
                                    target.ChangeRunSpeed( target.RunSpeed );
                                }
                            }
                        // pyroclasm
                        if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 1949 ] ||//Hell fire
                            SpellTemplate.SpellEffects[5740] == SpellTemplate.SpellEffects[ (int)Id ] )// Rain of fire
                            if ( src.HaveTalent( Talents.Pyroclasm ) )
                            {
                                int prob = 0;
                                if ( src.TalentLevel( Talents.Pyroclasm ) == 1 )
                                    prob = 13;
                                else
                                    prob = 26;
                                if ( Utility.Random( 100 ) < prob )
                                {
                                    Aura aura = new Aura();
                                    aura.ForceStun = true;
                                    target.AddAura( (AuraEffect)Abilities.abilities[ 18093 ], aura, true );
                                }
                            }
                        break;
                    #endregion
                }
            #endregion
            #endregion
        }
Esempio n. 20
0
		public virtual int Hit( Mobile m, float dmgBonus,bool pass, ref int amountBlocked, ref int amountAbsorbed )
		{			
			Item weapon = activeWeapon;
			if ( Level < m.Level - 7 )
			{
				lastAttack = AttackStatus.Dodge;
				m.lastAttackToMe = AttackStatus.Dodge;
				return -1;	
			}			
			float critChance = CriticalChanceCalculation(weapon,m);
			float dif = SkillDifCalculation(weapon,m);
			float hitChance = HitChanceCalculation(weapon,m,dif);
		
			bool criticalStrike = false;
			
			#region critical and hit test
			int roll =Utility.Random( 100 );	

			if ((int)critChance >= roll )
			{
				#region Critical hit trigger done
				ArrayList al = new ArrayList();
				ArrayList pal = new ArrayList();
				foreach( AuraReleaseTimer art in aura )
				{
					int a = art.aura.OnCriticalHit;
					if ( a != -1 )
						al.Add( art );
				}
				foreach( PermanentAura art in permanentAura )
				{
					int a = art.aura.OnCriticalHit;
					if ( a != -1 )
						al.Add( art );
				}
				foreach( object obj in al )
				{
					if(obj is AuraReleaseTimer)
					{ 
						AuraReleaseTimer art = (AuraReleaseTimer)obj;
						int a = art.aura.OnCriticalHit;
						if ( a != -1 )
							if(Triggers[ a ] != null)
								( Triggers[ a ] as OnCriticalHitTrigger )( this, m, art.ae );
					}
					if(obj is PermanentAura)
					{ 
						PermanentAura art = (PermanentAura)obj;
						int a = art.aura.OnCriticalHit;
						if ( a != -1 )
							if(Triggers[ a ] != null)
								( Triggers[ a ] as OnCriticalHitTrigger )( this, m, Abilities.abilities[(int)art.Id] );
					}
				}
				#endregion
				
				#region Critical hit done Triggers
				ArrayList al2 = new ArrayList();
				ArrayList pal2 = new ArrayList();
				foreach( AuraReleaseTimer art in aura )
				{
					int a = art.aura.OnCriticalHitDone;
					if ( a != -1 )
						al2.Add( art );
				}
				foreach( PermanentAura art in permanentAura)
				{
					int a = art.aura.OnCriticalHitDone;
					if ( a != -1 )
						pal2.Add( art );
				}
				foreach( object obj in al2 )
				{
					if(obj is AuraReleaseTimer)
					{ 
						AuraReleaseTimer art = (AuraReleaseTimer)obj;
					
						int a = art.aura.OnCriticalHitDone;
						if ( a != -1 )
							if(Triggers[ a ] != null) 
								( Triggers[ a ] as OnCriticalHitDoneTrigger )(this, m, art.ae );
					}
					if(obj is PermanentAura)
					{ 
						PermanentAura art = (PermanentAura)obj;
						int a = art.aura.OnCriticalHitDone;
						if ( a != -1 )
							if(Triggers[ a ] != null)
								( Triggers[ a ] as OnCriticalHitDoneTrigger )(this, m, Abilities.abilities[(int)art.Id] );
					}
				}
				#endregion
				
					
				/*bovie*/
					
				/*bovie*/	
				lastAttack = AttackStatus.Critical;
				m.lastAttackToMe = AttackStatus.Critical;
				criticalStrike = true;
			}
			else if((int)hitChance <= roll)
			{
				lastAttack = AttackStatus.NormalHit;
				m.lastAttackToMe = AttackStatus.NormalHit;
			}
			else 
			{
				lastAttack = AttackStatus.Loose;
				m.lastAttackToMe = AttackStatus.Loose;
				return 0;
			}
			#endregion

			if (!pass)
			{
				float parryChance = ParryChanceCalculation(m,dif);

				#region Parry test
				roll = Utility.Random( 100 );
				if (parryChance >= roll)
				{
					lastAttack = AttackStatus.Parry;
					m.lastAttackToMe = AttackStatus.Parry;
					return -2;	
				}
				#endregion			

				float dodgeChance = DodgeChanceCalculation(m,dif);

				#region Dodge test
				roll = Utility.Random( 100 );
				if (dodgeChance >= roll)
				{
					lastAttack = AttackStatus.Dodge;
					m.lastAttackToMe = AttackStatus.Dodge;
					return -1;	
				}
				#endregion
			}


			float damage = DamageDoneCalculation(m,dmgBonus,criticalStrike,weapon);
			float blockChance = BlockChanceCalculation(m,dif);
			if (!pass)
			{
				#region Block test + block reduction	
				roll = Utility.Random( 100 );
				// shield specialization
				if (blockChance >= roll)
				{
					lastAttack = AttackStatus.Block;
					m.lastAttackToMe = AttackStatus.Block;
					amountBlocked = m.Block + m.Str/30;
					damage -= amountBlocked;
					#region talents
					// shield specialization
					if ( m.HaveTalent(Talents.ShieldSpecialization) )
					{
						AuraEffect af = (AuraEffect)m.GetTalentEffect(Talents.ShieldSpecialization);
						roll = Utility.Random( 100 );
						if ( roll < af.H )
						{
							m.GainMana(m,(Abilities.abilities[af.AdditionalSpell] as SpellTemplate).S1);
						}
					}
					#endregion
				}
		
				#endregion
			}
			#region Armor reduction
			float armor = ArmorReductionCalculation(m); 
			damage = damage * (1 - armor);
			#endregion

			#region immune
			if (m.ImmunePhysicalDamage)
			{
				lastAttack = AttackStatus.Immune;
				m.lastAttackToMe = AttackStatus.Immune;
				return 0;
			}
			#endregion
			
			#region absorb
			amountAbsorbed = (int)damage;
			damage =(int)m.DamageAbsorbCombat(damage);
			amountAbsorbed -= (int)damage;
			if ( damage < 0 )
			{
				this.lastAttack = AttackStatus.Absorb;
				m.lastAttackToMe = AttackStatus.Absorb;	
				return 0;
			}
			#endregion

			#region Targets modificators 
			damage = DamageTakenCalculation(m,damage);
			#endregion
			damage = m.ManaShieldLost(this,(int)damage);
			#region other effects
			
			switch (this.Classe)
			{
					#region warrior
				case Classes.Warrior:
					// deep wounds 
					if (this.lastAttack == AttackStatus.Critical)
					{
						/*if ( src.HaveTalent( Talents.DeepWounds) )
						{
							AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.DeepWounds );
								
								AuraEffect af = (AuraEffect)Abilities.abilities[ae.AdditionalSpell];
								float modif = (float)ae.S1/100;
								af.ApplyDot(this, m, (int)(damage*modif), af.T1, af.Duration(this));
							
						}*/
						if ( m.HaveTalent( Talents.BloodCraze) )
						{
							AuraEffect ae = (AuraEffect)m.GetTalentEffect( Talents.BloodCraze );
							SpellTemplate st = (SpellTemplate)Abilities.abilities[ae.AdditionalSpell];
							HotAura aura = new HotAura(st,m,m,(int)(m.BaseHitPoints*((float)st.S1/100)/(st.Duration(m)/st.T1)),st.Duration(m),st.T1);
							
						}

					}
					//Mace specialization
					/*if ( src.HaveTalent( Talents.MaceSpecialization) && weapon.SubClass == 4 )
					{
						AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.MaceSpecialization );
						roll = Utility.Random( 100 );
						if(roll < ae.H)
						{
							AuraEffect af = (AuraEffect)Abilities.abilities[ae.AdditionalSpell];
							Aura aura = new Aura();
							aura.ForceStun = true;
							m.AddAura(this, af,aura,true);
						}
					}*/
					//int SwordSpecializationEffect = 0x14af5e;
					/*if ( src.HaveTalent( Talents.SwordSpecialization) && weapon.SubClass == 15 )
					{
						AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.SwordSpecialization );
					roll = Utility.Random( 100 );	
					if(roll < ae.H)
						{
							this.AdditionnalStates.Add(SwordSpecializationEffect);
						}
					}*/
					if ( this.HaveTalent( Talents.UnbridledWrath) )
					{
						AuraEffect ae = (AuraEffect)this.GetTalentEffect( Talents.UnbridledWrath );
						roll = Utility.Random( 100 );
						if(roll < ae.H)
						{
							this.GainMana(this,1);
						}
					}
					
					break;
					#endregion
			}
			#endregion
			if ( damage > 0 )
				this.SkillUpWeapon(weapon);
			return (int)damage;
		}
Esempio n. 21
0
 public float NatureSpellHealModifier( Mobile from )
 {
     float mod = 1.0f;
     AuraEffect ae = null;
     if ( from.HaveTalent( Talents.SpiritualHealing )  )
     {
         ae = (AuraEffect)from.GetTalentEffect( Talents.SpiritualHealing );
         mod += (float)( ae.s1 ) / 100f;
     }
     if ( from.HaveTalent( Talents.ImprovedHolyLight )  )
     {
         ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedHolyLight );
         mod += (float)( ae.s1 ) / 100f;
     }
     if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 13542 ] )//	Mend pet
         if ( from.HaveTalent( Talents.ImprovedRenew ) )
         {
             ae = (AuraEffect)from.GetTalentEffect( Talents.ImprovedRenew );
             mod += (float)( ae.s1 ) / 100f;
         }
     return mod;
 }
Esempio n. 22
0
 public ushort CurrentVal(Mobile from)
 {
     int val = 0;
     foreach( Mobile.AuraReleaseTimer art in from.Auras )
     {
         if(art.aura.SkillId == this.Id)
             val += art.aura.SkillBonus - art.aura.SkillMalus;
     }
     foreach( PermanentAura art in from.PermanentAuras )
     {
         if(art.aura.SkillId == this.Id)
             val += art.aura.SkillBonus - art.aura.SkillMalus;
     }
     switch (from.Classe)
     {
         case Classes.Warrior:
             if (this.Id == DefenseSkill.SkillId)
             {
                 if (from.HaveTalent(Talents.Anticipation))
                 {
                     AuraEffect af = (AuraEffect)from.GetTalentEffect(Talents.Anticipation);
                     val +=af.S1;
                 }
             }
             break;
     }
     if ((current + val)< 0) return 0;
     return (ushort)(current + val);
 }
Esempio n. 23
0
        public int Range( Mobile from )
        {
            int rng = range;
            if ( from.Classe == Classes.Warlock &&
                ( resistance == Resistances.Fire ||
                SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 686 ] ||
                SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 17877 ] ) )
                if ( from.HaveTalent( Talents.DestructiveReach ) )
                {
                    AuraEffect ae = (AuraEffect)from.GetTalentEffect( Talents.DestructiveReach );
                    float r = (float)range;
                    r += r * -(float)( ae.S1 ) / 100f;
                    rng = (int)r;
                }

            return rng;
        }
Esempio n. 24
0
        public void Summon( Mobile c )
        {
            if ( c.Summon != null )
            {
                c.Summon.Delete();
                if ( World.allMobiles.Contains( c.Summon ) )
                    World.Remove( c.Summon, c );
            }
            ConstructorInfo ci = World.MobilePool( mountId );
            BaseCreature bc = (BaseCreature)ci.Invoke( null );
            bc.Faction = c.Faction;
            bc.AIEngine = new SummonedAI( c, bc );
            bc.SummonedBy = c;
            c.Summon = bc;
            bc.Level = c.Level;
            bc.Stamina = bc.Str = bc.Iq = bc.Spirit = bc.HitPoints = bc.BaseHitPoints = bc.Agility = bc.BaseMana = 0;
            bc.InitStats();
            //	bc.AIEngine = new SummonedAI( c, bc );
            if ( c.Classe == Classes.Warlock )
            {
                #region Fel Intellect
                if ( bc.Id == 416 || bc.Id == 1863 || bc.Id == 1860 || bc.Id == 417 )
                {
                    if ( c.HaveTalent( Talents.FelIntellect ) )
                    {
                        AuraEffect ae = (AuraEffect)c.GetTalentEffect( Talents.FelIntellect );
                        float bm = (float)bc.BaseMana;
                        bm += bm * ( (float)ae.S1 ) / 100f;
                        bc.BaseMana = bc.Mana = (int)bm;
                    }
                }
                #endregion
                #region Fel Stamina
                if ( bc.Id == 416 || bc.Id == 1863 || bc.Id == 1860 || bc.Id == 417 )
                {
                    if ( c.HaveTalent( Talents.FelStamina ) )
                    {
                        AuraEffect ae = (AuraEffect)c.GetTalentEffect( Talents.FelStamina );
                        float bm = (float)bc.BaseHitPoints;
                        bm += bm * ( (float)ae.S1 ) / 100f;
                        bc.BaseHitPoints = bc.HitPoints = (int)bm;
                    }
                }
                #endregion
            }

            World.Add( bc, c.X, c.Y, c.Z, c.MapId );
            if ( c is Character )
            {
                //	c.SendSmallUpdate( new int[] { (int)UpdateFields.UNIT_FIELD_CHARM, (int)UpdateFields.UNIT_FIELD_SUMMON }, new object[] { bc.Guid, bc.Guid } );

                Character ch = c as Character;
                int offset = 4;
                Converter.ToBytes( 1, c.tempBuff, ref offset );
                Converter.ToBytes( (byte)0, c.tempBuff, ref offset );
                c.PrepareUpdateData( c.tempBuff, ref offset , UpdateType.UpdateFull, false );
                //				bc.PrepareUpdateData( c.tempBuff, ref offset , UpdateType.UpdateFull, false );
                ch.Send( OpCodes.SMSG_UPDATE_OBJECT, c.tempBuff, offset );
                ch.ItemsUpdate();

                if ( bc.Id == 89 || bc.Id == 416 || bc.Id == 1863 || bc.Id == 1860 || bc.Id == 304 || bc.Id == 417 )
                    ch.SendPetActionBar();
            }
        }
Esempio n. 25
0
 public float ResistCalculation(Mobile src, Mobile target)
 {
     // calculate avarage resistance
     float avarageResistance = 0f;
     switch( this.resistance )
     {
         case Resistances.Fire:
             avarageResistance = (float)(((float)target.ResistFire/(src.Level*5))*0.75);
             break;
         case Resistances.Frost:
             avarageResistance = (float)(((float)target.ResistFrost/(src.Level*5))*0.75);
             break;
         case Resistances.Light:
             avarageResistance = (float)(((float)target.ResistHoly/(src.Level*5))*0.75);
             break;
         case Resistances.Arcane:
             avarageResistance = (float)(((float)target.ResistArcane/(src.Level*5))*0.75);
             if (src.HaveTalent(Talents.ArcaneFocus))
             {
                 AuraEffect af = (AuraEffect)src.GetTalentEffect(Talents.ArcaneFocus);
                 avarageResistance -=af.S1;
             }
             break;
         case Resistances.Shadow:
             avarageResistance = (float)(((float)target.ResistShadow/(src.Level*5))*0.75);
             break;
         case Resistances.Nature:
             avarageResistance = (float)(((float)target.ResistNature/(src.Level*5))*0.75);
             break;
     }
     if (avarageResistance > 0.75) avarageResistance = 0.75f;
     // suppression
     /*if (src.HaveTalent(Talents.Suppression))
     {
         AuraEffect af = (AuraEffect)src.GetTalentEffect(Talents.Suppression);
         avarageResistance -=af.S1;
     }*/
     return avarageResistance;
 }