is this the reflect code? anyone can help me out here :D

02/17/2010 03:51 salem rey#1
I get this code from other source but im not surely what this source come from. so anyone help me converting this to 5165?

i just copy this from other source but i want to put this in my source.


Code:
}
            if (Attacked.PackedSkills.Contains("3060"))
            {
                if (Other.ChanceSuccess(26))
                {
                    Attacked.ReflectOn = true;
                }
                else
                {
                    Attacked.ReflectOn = false;
                }
            }
            if (Attacked.ReflectOn == true)
            {
                Damage = 0;
                Attacked.CurHP -= 0;
                if (AttackType == 0 || AttackType == 1)//Melee
                {
                    ReflectDamage = General.Rand.Next((int)Attacker.MinAtk, (int)Attacker.MaxAtk);
                    double reborn = 1;
                    if (AttackType == 0)
                        ReflectDamage += ExtraDamage;
                    else
                        ReflectDamage = (int)((double)ExtraDamage + ReflectDamage);

                    ReflectDamage = (int)((double)ReflectDamage * Attacker.AddAtkPc);

                    if (Attacker.StigBuff)
                        ReflectDamage = (int)(ReflectDamage * (double)(1 + ((double)(10 + Attacker.StigLevel) / 100)));

                    if (Attacker.SMOn)
                        ReflectDamage *= 2;
                    if (Attacked.RBCount == 1)
                        reborn = 0.7;
                    else if (Attacked.RBCount == 2)
                        reborn = 0.4;


                    ReflectDamage -= (Attacked.Defense * 2);
                    ReflectDamage *= reborn;

                    if (ReflectDamage < 1)
                        ReflectDamage = 1;
                }
                else if (AttackType == 2)//Ranged
                {
                    double reborn = 1;

                    int Atk = General.Rand.Next((int)Attacker.MinAtk, (int)Attacker.MaxAtk);
                    Atk += ExtraDamage;

                    Atk = (int)((double)Atk * Attacker.AddAtkPc);

                    if (Attacker.SMOn)
                        Atk *= 2;
                    if (Attacker.StigBuff)
                        Atk = (int)(Atk * (double)(1 + ((double)(10 + Attacker.StigLevel) / 100)));

                    if (Attacked.RBCount == 1)
                        reborn = 0.7;
                    else if (Attacked.RBCount == 2)
                        reborn = 0.4;

                    ReflectDamage = (int)((Atk * .029 + (Attacker.Level * 2)) - ((Attacked.Dodge) * (Attacked.Level * .04))) * 2 * reborn;

                    if (ReflectDamage < 1)
                        ReflectDamage = 1;
                }
                else if (AttackType == 3 || AttackType == 4)//Magic
                {
                    double reborn = 1;
                    if (AttackType == 3)
                        ReflectDamage = (int)+ExtraDamage;
                    else
                        ReflectDamage = (int)((double)ExtraDamage * Attacker.MAtk);
                    if (Attacked.RBCount == 1)
                        reborn = 0.7;
                    else if (Attacked.RBCount == 2)
                        reborn = 0.4;
                    ReflectDamage = (int)((Attacker.MAtk - (Attacked.MDefense + Attacked.Level * 3)) * reborn);

                    //Atk = (float)(((((Atk - Defense) - PlusDef) * Reborn) * Blessed));

                    if (ReflectDamage < 1)
                        ReflectDamage = 1;

                }
                if (ReflectDamage <= 1)
                {
                    ReflectDamage = 1;
                }
                if (ReflectDamage >= 5000)
                {
                    ReflectDamage = 5000;
                }
                else
                {
                    ReflectDamage = ReflectDamage / 1.6;
                }
                Attacker.MyClient.SendPacket(General.MyPackets.Vital((long)Attacker.UID, 0, Attacker.CurHP));
                foreach (DictionaryEntry DE in World.AllChars)
                {
                    Damage = 0;
                    Attacked.CurHP -= (ushort)Damage;
                    ReflectDamage = ReflectDamage / 1.6;
                    if (ReflectDamage >= 5000)
                    {
                        ReflectDamage = 5000;
                    }

                    if (ReflectDamage == Attacker.CurHP)
                    {
                        Attacker.CurHP = 0;
                        Attacker.Death = DateTime.Now;
                        Attacker.Alive = false;

                        Attacker.MyClient.SendPacket(General.MyPackets.Vital(Attacker.UID, 0, Attacker.CurHP));


                    }
                    if (ReflectDamage > Attacker.CurHP)
                    {
                        Attacker.CurHP = 0;
                        Attacker.Death = DateTime.Now;
                        Attacker.Alive = false;

                        Attacker.MyClient.SendPacket(General.MyPackets.Vital(Attacker.UID, 0, Attacker.CurHP));
                    }
                    if (ReflectDamage < Attacker.CurHP)
                    {
                        Attacker.CurHP -= (ushort)ReflectDamage;
                        Attacker.MyClient.SendPacket(General.MyPackets.Vital(Attacker.UID, 0, Attacker.CurHP));
                    }

                    Character Chaar = (Character)DE.Value;
                    if (Chaar.Name != Attacked.Name)
                        if (Chaar.LocMap == Attacked.LocMap)
                            if (MyMath.PointDistance(Chaar.LocX, Chaar.LocY, Attacked.LocX, Attacked.LocY) < 20)
                                Chaar.MyClient.SendPacket(General.MyPackets.String(Attacked.UID, 10, "MagicReflect"));
                }
                Attacked.MyClient.SendPacket(General.MyPackets.String(Attacked.UID, 10, "MagicReflect"));
                Attacker.MyClient.SendPacket(General.MyPackets.SendMsg(Attacker.MyClient.MessageId, "SYSTEM", Attacker.Name, "The attack reflected back at you!", 2005));

            }
            if (Attacked.ReflectOn == false)
            {

                if (AttackType == 0 || AttackType == 1) // Direct Attack
                {
                    double reborn = 1;
                    Damage = General.Rand.Next((int)Attacker.MinAtk, (int)Attacker.MaxAtk);

                    if (AttackType == 0)
                        Damage += ExtraDamage;
                    else
                        Damage = (int)((ExtraDamage / (double)100) * Damage);
                    if (Attacked.RBCount == 1)
                        reborn = 0.7;
                    else if (Attacked.RBCount == 2)
                        reborn = 0.4;

                    Damage = (int)(Damage * Attacker.AddAtkPc);

                    if (Attacker.StigBuff)
                        Damage = (int)(Damage * (1 + ((10 + Attacker.StigLevel) / (double)100)));

                    if (Attacker.SMOn)
                        Damage *= 2;

                    Damage -= Attacked.Defense;
                    Damage *= reborn;

                    if (Damage < 1)
                        Damage = 1;
                }
                else if (AttackType == 2)//Ranged
                {
                    double reborn = 1;

                    int Atk = General.Rand.Next((int)Attacker.MinAtk, (int)Attacker.MaxAtk);
                    Atk += ExtraDamage;

                    Atk = (int)((double)Atk * Attacker.AddAtkPc);

                    if (Attacker.SMOn)
                        Atk *= 2;
                    if (Attacker.StigBuff)
                        Atk = (int)(Atk * (double)(1 + ((double)(10 + Attacker.StigLevel) / 100)));

                    if (Attacked.RBCount == 1)
                        reborn = 0.7;
                    else if (Attacked.RBCount == 2)
                        reborn = 0.4;

                    Damage = (int)((Atk * .029 + (Attacker.Level * 2)) - ((Attacked.Dodge) * (Attacked.Level * .04))) * 2 * reborn;

                    if (Damage < 1)
                        Damage = 1;
                }
                else if (AttackType == 3 || AttackType == 4)//Magic
                {
                    double reborn = 1;
                    if (AttackType == 3)
                        Damage = (int)+ExtraDamage;
                    else
                        Damage = (int)((double)ExtraDamage * Attacker.MAtk);
                    if (Attacked.RBCount == 1)
                        reborn = 0.7;
                    else if (Attacked.RBCount == 2)
                        reborn = 0.4;
                    Damage = (int)((Attacker.MAtk - (Attacked.MDefense + Attacked.Level * 3)) * reborn );

                    //Atk = (float)(((((Atk - Defense) - PlusDef) * Reborn) * Blessed));

                    if (Damage < 1)
                        Damage = 1;
                }

            }
            return (uint)Damage;
        }
anyone?

please
02/17/2010 03:53 pro4never#2
Simply go to wherever your attacks are handled in your source and do a check to see if the client has the skill learned. If they do do a percent success rate (sweet jesus, not a 26 percent chance though!) for reflect to activate. If it does do a damage calculation for how much dmg to return. If it doesn't activate continue on with the normal attack calculation.

This isn't something someone can just copy/paste a guide on how to do it. you have to go into your own attack calculations and read through how they work and then re-write them to include the check.
02/17/2010 04:01 salem rey#3
nah need a major help out here, or anyone got the code for reflect in 5165? :( please?
02/19/2010 14:54 12tails#4
use more or less the same code of counterkill.... just add the reflect effect and make the damage return to the attacker : D
02/19/2010 14:59 salem rey#5
nah, i really dont know where to add and cs
02/19/2010 17:47 Decker_#6
There was just a code released in the releases section. Go look.
02/19/2010 23:11 KraHen#7
IMHO delete the whole code, and examine it. When you fully understand how it works, port it to your source on your own, recoding every bit of it using your source`s variables, etc.
02/20/2010 04:05 hunterman01#8
Thats kinda how i learned i would go learn a lesson from [Only registered and activated users can see links. Click Here To Register...] and use what i learned in the source

Quick way to learn