Not ranking based, most peoples uses this calc so peoples focus on donating and buy CPs...
Its basically BP based...
if Attacker BP >= Attacked BP then Attack = 100%
if Attacker BP < Attacked BP then Attack = 50%
if the server has Break and Critical, just put the Break calculation after the BP check, then if Break succeed you send the animation, otherwise, if fails, divide the damage by 2.. After it, you check the Critical..
Remember, Break - Counter or Critical - Immunity = Chance.. if > 100 , then chance = 100%, if less than 0, chance is 0
Immunity multiplies the damage by *1.5..
The damage Calc itself if you want to get TQ damage..
I still didnt make my Jiang system, so this works perfect to me..
Calculate the damage, a rand between Min Damage and Max Damage...
Then, without Jiang, multiply by 2... If you have Jiang, try reducing this, otherwise attacks will exceed the expected.
Then, check battle power, if less than the victim, break is enabled
Calc the break chance, if success, dont change the attack, if fails, Attack * 0.50 (or /2)
Now check the Critical, if fails, dont change the attack, if success, Attack *1.5
Remember, you cant break if u have higher BP! Peoples claim that it gives extra damage, it doesnt!
After this, you can calculate the Stigma...
Make the skills Calculations..
Check if attacker is blessed, calculate the bless hit chance...
If.. attacker is an assassin, this calculation worked perfectly to me..
Multiply Damage * 12 and divide by /100
Great, tested with a full +12 assassin with p6s, the damage will run around 3.7-5k (With skills that would increase it by 500% it gets around 18-25k with Stigma)
Reduce defense now, calculate the Azure Shield, and bla bla bla
Below is my Meele Code... Just for single attacks (no skill)
Code:
public static uint Melee(Entity attacker, Entity attacked, ref Attack Packet)
{
if (attacked.EntityFlag == EntityFlag.Player)
{
BlessEffect.Effect(attacked);
}
if (attacker.EntityFlag == EntityFlag.Player)
{
GemEffect.Effect(attacker);
}
long Damage = 0;
Boolean CritImmune = false;
Boolean canBT = false;
Boolean CriticalOK = false;
Boolean BreakOK = false;
if (attacker.EntityFlag == EntityFlag.Monster)
if (attacked.EntityFlag == EntityFlag.Player)
if (Kernel.Rate(Math.Min(60, attacked.Dodge + 30)))
return 1;
Durability(attacker, attacked, null);
if(attacked.ContainsFlag(Network.GamePackets.Update.Flags.ShurikenVortex)){
Damage = (long)(Kernel.Random.Next((int)Math.Min((long)attacker.MinAttack, (long)attacker.MaxAttack), (int)Math.Max((long)attacker.MinAttack, (long)attacker.MaxAttack) + 1) * 0.05);
}
if (!attacker.Transformed)
{
Damage = Kernel.Random.Next((int)Math.Min((long)attacker.MinAttack, (long)attacker.MaxAttack), (int)Math.Max((long)attacker.MinAttack, (long)attacker.MaxAttack) + 1);
}
else
{
Damage = Kernel.Random.Next((int)attacker.TransformationMinAttack, (int)attacker.TransformationMaxAttack + 1);
}
/*if (attacker.WearsGoldPrize) Damage += (long)(Damage + 1000);
if (attacked.WearsGoldPrize) Damage -= (long)(Damage - 1000);*/
Damage = (long)(Damage * 2);
if (attacker.EntityFlag == EntityFlag.Player)
{
if (attacker.BattlePower < attacked.BattlePower)
{
canBT = true;
}
}
float BTDiff = 0f;
if (attacker.Breaktrough > attacked.Counteraction)
{
BTDiff = attacker.Breaktrough - attacked.Counteraction;
if(BTDiff > 100){
BTDiff = 100;
}
}
else
{
canBT = false;
}
if(canBT){
if (!Kernel.Rate((float)BTDiff / 1000f))
{
Damage = (long)(Damage / 2);
//Console.WriteLine("Porra de Dano sem Break BP Baixa: " + Damage.ToString());
}
else
{
Packet.Effect1 |= Attack.AttackEffects1.Penetration;
BreakOK = true;
//Damage = (long)(Damage * 1);
}
}
float CritDiff = 0f;
if (attacker.CriticalStrike > attacked.Immunity)
{
CritDiff = attacker.CriticalStrike - attacked.Immunity;
if (CritDiff > 100)
{
CritDiff = 100;
}
}
else
{
CritImmune = true;
}
if(!CritImmune){
if(Kernel.Rate((float)CritDiff / 100f)){
Damage = (long)(Damage * 1.5);
Packet.Effect1 |= Attack.AttackEffects1.CriticalStrike;
CriticalOK = true;
}
}
//attacker.SendSysMesage("Potência: " + attacker.BattlePower.ToString() + " vs " + attacked.BattlePower.ToString() + " Seu Break: " + attacker.Breaktrough.ToString() + " Counteraction Oponente: " + attacked.Counteraction.ToString());
//attacked.SendSysMesage("Potência: " + attacker.BattlePower.ToString() + " vs " + attacked.BattlePower.ToString() + " Break Oponente: " + attacker.Breaktrough.ToString() + " Seu Counteraction: " + attacked.Counteraction.ToString());
//attacker.SendSysMesage("BT Diferença: " + (BTDiff / 1000f).ToString() + " Chance: " + (BTDiff / 100f).ToString() + " Foi: " + BreakOK.ToString());
//attacker.SendSysMesage("Potência: " + attacker.BattlePower.ToString() + " vs " + attacked.BattlePower.ToString() + " Seu Critico: " + attacker.CriticalStrike.ToString() + " Imunidade Oponente: " + attacked.Immunity.ToString());
//attacked.SendSysMesage("Potência: " + attacker.BattlePower.ToString() + " vs " + attacked.BattlePower.ToString() + " Critico Oponente: " + attacker.CriticalStrike.ToString() + " Sua Imunidade: " + attacked.Immunity.ToString());
//attacker.SendSysMesage("Diferença: " + (CritDiff / 1000f).ToString() + "Chance: " + (CritDiff / 100f).ToString() + " Foi: " + CriticalOK.ToString());
//Arrumar o Stigma dps
if(attacker.ContainsFlag(Network.GamePackets.Update.Flags.Stigma)){
if(!attacker.Transformed && Damage > 1){
Damage = (long)(Damage * 1.3);
}
}
/*
Verificar depois
if (attacked.EntityFlag == EntityFlag.Monster)
{
if (attacked.MapID < 1351 || attacked.MapID > 1354)
Damage = (long)(Damage * (1 + (GetLevelBonus(attacker.Level, attacked.Level) * 0.08)));
}
*/
if(attacker.EntityFlag == EntityFlag.Player)
{
//Se estiver no Superman
if (attacker.OnSuperman())
{
//E o alvo for um monstro
if (attacked.EntityFlag == EntityFlag.Monster)
{
//Verifica se é boss
if (!attacked.MonsterInfo.Boss)
{
//Se não for multiplica o ataque
Damage *= 10;
}
}
}
//Se estiver no FatalStrike
if (attacker.OnFatalStrike())
{
//E o alvo for um monstro
if (attacked.EntityFlag == EntityFlag.Monster)
{
//E não for um boss
if (!attacked.MonsterInfo.Boss)
{
//Multiplica o ataque
Damage *= 5;
}
}
}
if(attacker.OnOblivion())
{
if(attacked.EntityFlag == EntityFlag.Monster)
{
Damage *= 2;
}
}
//Calcula o Bless
/*
* Foi modificada a ordem de algumas coisas, pois a defesa tem de ser
* calculada por último, de fato algumas coisas vão ultrapassar as expectativas
* se você calcular no meio do caminho, o ataque pode ser aumentado
* no meio do caminho... O calculo de Bless do Ataque vai ser calculado junto com as skills
* por: Felipe Vieira
*/
if(attacker.Owner.BlessTime > 0)
{
if (Kernel.Rate(10))
{
Damage *= 2;
_String str = new _String(true);
str.UID = attacker.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("LuckyGuy");
attacker.Owner.SendScreen(str, true);
}
}
}
if (!attacked.Transformed)
{
if (attacked.ContainsFlag(Network.GamePackets.Update.Flags.MagicShield))
{
if (attacked.ShieldTime > 0)
{
Damage -= attacked.Defence;
}
else
{
Damage -= (ushort)(attacked.Defence * attacked.MagicShieldIncrease);
}
}
else
{
Damage -= attacked.Defence;
}
}
else
{
Damage -= attacked.TransformationDefence;
}
if(attacked.IsDefensiveStance)
{
if (attacked.FatigueSecs > 120)
{
Damage -= (long)(attacked.Defence * 1.4);
}
else
{
Damage -= (long)(attacked.Defence * 1.2);
}
}
if(attacked.EntityFlag == EntityFlag.Player)
{
if(attacked.Owner.BlessTime > 0)
{
if (Kernel.Rate(10))
{
Damage = 1;
_String str = new _String(true);
str.UID = attacker.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("LuckyGuy");
attacked.Owner.SendScreen(str, true);
}
}
}
//Damage = RemoveExcessDamage(Damage, attacker, attacked);
if (attacker.Assassin())
{
Damage = (Damage * 12) / 100;
if(attacked.EntityFlag == EntityFlag.Player)
{
if (attacked.Class >= 100)
{
Damage = (Damage * 20) / 90;
}
}
}
Damage += attacker.PhysicalDamageIncrease;
Damage -= attacked.PhysicalDamageDecrease;
//Damage -= attacked.ItemBless;
//Console.WriteLine("Atacante: " + attacker.ItemBless.ToString() + " Vitima: " + attacked.ItemBless.ToString());
//attacked.SendSysMesage("Atacante: " + attacker.ItemBless.ToString() + " Vitima: " + attacked.ItemBless.ToString());
//attacker.SendSysMesage("Atacante: " + attacker.ItemBless.ToString() + " Vitima: " + attacked.ItemBless.ToString());
if (attacked.ContainsFlag2(Network.GamePackets.Update.Flags2.AzureShield))
{
if (attacked.AzureDamage >= Damage)
{
attacked.AzureDamage -= (int)Damage;
int sec = 60 - (Time32.Now - attacked.MagicShieldStamp).AllSeconds();
attacked.Owner.Send(Constants.Shield(attacked.AzureDamage, sec));
return 0;
}
else
{
Damage -= attacked.AzureDamage;
attacked.AzureDamage = 0;
attacked.RemoveFlag2(Update.Flags2.AzureShield);
return (uint)(Damage);
}
}
if (attacked.EntityFlag == EntityFlag.Monster)
{
if(Damage >= (700 * attacked.MaxHitpoints))
{
Damage = (long)(700 * attacked.MaxHitpoints);
}
}
if (attacker.EntityFlag == EntityFlag.Player)
{
if (attacked.EntityFlag == EntityFlag.Player)
{
float ItemsBless = (float)(attacked.ItemBless * 0.01);
Damage = (long)(Damage * (1 - ItemsBless));
}
}
AutoRespone(attacker, attacked, ref Damage);
//attacked.SendSysMesage("Bless Multiplicador: " + ItemsBless.ToString() + " | dDamage: " + dDamage.ToString());
//attacker.SendSysMesage("Bless Multiplicador: " + ItemsBless.ToString() + " | dDamage: " + dDamage.ToString());
/*
Damage += Damage;
Damage += Damage / 4;
AutoRespone(attacker, attacked, ref Damage);
if (Constants.Damage1Map.Contains(attacker.MapID))
Damage = 1;
if (attacked.Class >= 140 && attacked.Class <= 145)
Damage = (long)(Damage - (Damage * 0.10));
if (attacker.MapID == 2065)
if (attacker.EntityFlag == EntityFlag.Monster)
Damage *= 10;
else
Damage /= 10;
*/
if (Damage <= 0)
{
Damage = 1;
}
//Console.WriteLine("Dano Final: " + Damage.ToString());
return (uint)(Damage);
}