Example #1
0
        public void SendDamageMessage(Mobile src, Mobile target, LastSpellState state, int dmg, int resisted, int absorbed, int blocked,bool white)
        {
            int num10 = 4;
            Converter.ToBytes((ulong)target.Guid, target.tempBuff, ref num10);
            Converter.ToBytes((ulong)src.Guid, target.tempBuff, ref num10);
            Converter.ToBytes((uint)this.Id, target.tempBuff, ref num10);
            Converter.ToBytes((uint)dmg, target.tempBuff, ref num10);
            Converter.ToBytes((byte)this.resistance , target.tempBuff, ref num10);
            Converter.ToBytes(absorbed, target.tempBuff, ref num10);
            Converter.ToBytes(resisted, target.tempBuff, ref num10);
            if(blocked == -1 || white)
                Converter.ToBytes((byte)1, target.tempBuff, ref num10);
            else
                Converter.ToBytes((byte)0, target.tempBuff, ref num10);
            Converter.ToBytes((byte)0, target.tempBuff, ref num10);
            if(blocked == -1)
                Converter.ToBytes(0, target.tempBuff, ref num10);
            else
                Converter.ToBytes(blocked, target.tempBuff, ref num10);
            if(state == LastSpellState.Critical)
                Converter.ToBytes((byte)2, target.tempBuff, ref num10);
            else
                Converter.ToBytes((byte)0, target.tempBuff, ref num10);
            Converter.ToBytes(0, target.tempBuff, ref num10);

            src.ToAllPlayerNear(OpCodes.SMSG_SPELLNONMELEEDAMAGELOG, target.tempBuff, num10);
            //	HexViewer.View( target.tempBuff, 4, num10 - 4 );
        }
Example #2
0
        public int SpellDMG(Mobile src, Mobile target, float basedmg,ref int absorbed ,ref int resisted, ref LastSpellState state,bool criticalTest)
        {
            state = LastSpellState.None;
            float dmg;
            float avarageResistance = this.ResistCalculation(src, target);

            dmg = SpellDamageCalculationBonus(basedmg,src,target);

            if(criticalTest)
            {
                float multipler = this.CriticalCalculationForSpells(src,target);
                dmg *= multipler;
                if(multipler > 1f)	state = LastSpellState.Critical;
            }

            float realDamage = AbsorbCalculation(dmg,src,target);
            absorbed = (int)(dmg - realDamage);
            if(realDamage <=0)
                state = LastSpellState.Absorb;

            resisted = (int)(realDamage);
            realDamage *= ResistanceMultiplerCalculation(avarageResistance, src, target);
            resisted -=(int)realDamage;
            if ( src.Level < target.Level - 7 )
                realDamage = -1;
            if(realDamage <=0)
                state = LastSpellState.Resist;

            realDamage = TargetsModificationOfDmg((int)realDamage,src,target);

            realDamage = target.ManaShieldLost(src, (int)realDamage);
            if(realDamage > 0) state = LastSpellState.Normal;
            return (int)realDamage;
        }
Example #3
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
        }