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;
}
please






and use what i learned in the source