Register for your free account! | Forgot your password?

You last visited: Today at 03:39

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Damage Calculation

Discussion on Damage Calculation within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2005
Posts: 231
Received Thanks: 85
Damage Calculation

Okay. I haven't found any physical damage calculations out there that involves BP. Maybe nobody wants it or what but Ive been lurking these forums for a while looking for ideas for my server. Anyway, here's my ROUGH (+- 1.5k) damage compared to the real co. If anyone got any ideas on how to improve my equation by all means please post.

I use 5165 but the gist of it should be the same as other servers.
also, thanks to CoEmu v2, I used some of the damage calculation from there namely the reborn percentages.

This is only to fix FB/SS. Melee you need to change yourself in attack.cs
in skills.cs find

Code:
public uint GetDamage(Character C)
if you look a little bit below that line you should see

Code:
case DamageType.Melee:
replace the whole case with:
Code:
if (Game.World.NoPKMaps.Contains(User.Loc.Map))
                                    if (Info.ExtraEff == ExtraEffect.None)
                                        return 0;

                                ushort Def = (ushort)((double)C.EqStats.defense*2);
                                Buff Shield = C.BuffOf(SkillsClass.ExtraEffect.MagicShield);
                                if (Shield.Eff == SkillsClass.ExtraEffect.MagicShield)
                                    Def = (ushort)(Def * Shield.Value);

                                Damage = User.PrepareAttack(2, false);
                                Damage = (uint)(Damage * Info.EffectValue);
                                Damage += Info.Damage;


                                if (Def >= Damage)
                                    Damage = 1;
                                else
                                    Damage -= Def;

                                if (C.Reborns == 1)
                                {
                                    Damage = (uint)Math.Floor((double)Damage * .7);
                                }
                                else if (C.Reborns == 2)
                                {
                                    Damage = (uint)Math.Floor((double)Damage * .7);
                                    if (User.Reborns < 2)
                                        Damage = (uint)(Math.Floor((double)Damage * .5));
                                }

                                //STGs
                                Damage = (uint)(Math.Floor((double)Damage * (1 - ((C.EqStats.GemBless < .50) ? C.EqStats.GemBless : .50))));
                                

                                //EQ bless
                                if (C.EqStats.TotalBless > 0)
                                {
                                    Damage = (uint)(Math.Floor((double)Damage * (1 - ((C.EqStats.TotalBless < 60) ? (double)C.EqStats.TotalBless : (double)60) * .01)));
                                    //Console.WriteLine(C.EqStats.TotalBless);
                                }
                                
                                //BP
                                //Console.WriteLine(User.Name + " " + (int)User.Potency);
                                //Console.WriteLine(C.Name + " " + (int)C.Potency);
                                if (User.Potency < C.Potency)
                                {
                                    Damage = (uint)(((double)Damage) * (((double)C.Potency / (double)User.Potency) + .85) / Math.Sqrt((double)(C.Potency - User.Potency)));
                                    if (C.Potency - User.Potency >= 50)
                                        Damage = (uint)((double)Damage * .6);
                                }
                                else
                                {

                                    Damage = (uint)((double)Damage * .9);
                                }

                                if (C.Potency >= 300)
                                {
                                    Damage = Damage = (uint)((double)Damage * .7);
                                }





                                Damage += User.EqStats.MeleeDamageIncrease;
                                if (C.EqStats.MeleeDamageDecrease >= Damage)
                                    Damage = 1;
                                else
                                    Damage -= C.EqStats.MeleeDamageDecrease;
                                break;
anyway I also removed something I forget.. I think it was archer_fly or something

Also for 5165 users. Server calculates BP wrong. It doesn't add in the steed BP. So to make it add the steed bp to total bp:

find
Code:
public ushort Potency
replace with
Code:
public ushort Potency
        {
            get
            {
                string s = ((ushort)Equips.HeadGear.Soc1).ToString();
                int prePotency = 0;
                prePotency += Level + 5 * Reborns;
                for (byte x = 1; x <= 12; x++)
                {
                    Item I = Equips.Get(x);
                    if (I.UID != 0)
                        prePotency += I.Pot;
                }
                prePotency += (byte)Nobility.Rank;
                return (ushort)prePotency;
            }
        }
Added:
find:
Code:
public static void GetGemEffect(ref EquipStats E, Gem G)
and add the following cases:
Code:
case Gem.NormalTortoiseGem:
                    {
                        E.GemBless += 0.02;
                        break;
                    }
                case Gem.RefinedTortoiseGem:
                    {
                        E.GemBless += 0.04;
                        break;
                    }
                case Gem.SuperTortoiseGem:
                    {
                        E.GemBless += 0.06;
                        break;
                    }
find:
Code:
public double GemExtraMAttack;
below it add:
Code:
public double GemBless;


find:
Code:
Eqp.GemExtraMAttack += eqp.GemExtraMAttack;
below it add:
Code:
Eqp.GemBless += eqp.GemBless;


find:
Code:
Eqp.GemExtraMAttack -= eqp.GemExtraMAttack;
below it add:
Code:
Eqp.GemBless -= eqp.GemBless;


find:
Code:
EqStats.GemExtraAttack = 1;
below it add:
Code:
EqStats.GemBless = 0;
I think that should be it. If I'm missing anything just post something.

Also to those that wanna help make a better damage equation i also attached an excel file with all the info on the damages. It's kinda messy though but meh.

And if you are gonna use this, some thanks would be nice.
Attached Files
File Type: rar damages new.rar (21.9 KB, 49 views)
dragon89928 is offline  
Thanks
9 Users
Old 06/04/2010, 06:19   #2
 
xSynthesis's Avatar
 
elite*gold: 0
Join Date: Feb 2010
Posts: 80
Received Thanks: 29
I really didn't thing someone gonna release a proper damage calculation for 5165 source. Good job +k
xSynthesis is offline  
Old 06/04/2010, 06:29   #3
 
BlueFlame11's Avatar
 
elite*gold: 0
Join Date: Apr 2010
Posts: 116
Received Thanks: 12
Same thanks dude <333

#Edit
You should take the time to release it on 4bot before some one else does

Thanks AGAIN

#Edit 2

I get 2 errors when adding the the stuff above

Quote:
Error 1 A local variable named 'Def' cannot be declared in this scope because it would give a different meaning to 'Def', which is already used in a 'child' scope to denote something else C:\Users\DesignMonkey\Desktop\Stuff\Conquer Sources\Project #2\Game\Features\Skills.cs 459 32 NewestCOServer
Quote:
Error 2 A local variable named 'Shield' cannot be declared in this scope because it would give a different meaning to 'Shield', which is already used in a 'child' scope to denote something else C:\Users\DesignMonkey\Desktop\Stuff\Conquer Sources\Project #2\Game\Features\Skills.cs 460 30 NewestCOServer
BlueFlame11 is offline  
Old 06/04/2010, 09:29   #4
 
elite*gold: 0
Join Date: Dec 2005
Posts: 231
Received Thanks: 85
@synthesis
Yeah.. I got tired of the stupid 30ks full +12s did to each other on my server. This is a VERY rough estimation of the damages.

@blueflame11

Did you remove even the "case"? The code should be..

Code:
case DamageType.Melee:
if (Game.World.NoPKMaps.Contains(User.Loc.Map))
                                    if (Info.ExtraEff == ExtraEffect.None)
                                        return 0;

                                ushort Def = (ushort)((double)C.EqStats.defense*2);
                                Buff Shield = C.BuffOf(SkillsClass.ExtraEffect.MagicShield);
                                if (Shield.Eff == SkillsClass.ExtraEffect.MagicShield)
                                    Def = (ushort)(Def * Shield.Value);

                                Damage = User.PrepareAttack(2, false);
                                Damage = (uint)(Damage * Info.EffectValue);
                                Damage += Info.Damage;


                                if (Def >= Damage)
                                    Damage = 1;
                                else
                                    Damage -= Def;

                                if (C.Reborns == 1)
                                {
                                    Damage = (uint)Math.Floor((double)Damage * .7);
                                }
                                else if (C.Reborns == 2)
                                {
                                    Damage = (uint)Math.Floor((double)Damage * .7);
                                    if (User.Reborns < 2)
                                        Damage = (uint)(Math.Floor((double)Damage * .5));
                                }

                                //STGs
                                Damage = (uint)(Math.Floor((double)Damage * (1 - ((C.EqStats.GemBless < .50) ? C.EqStats.GemBless : .50))));
                                

                                //EQ bless
                                if (C.EqStats.TotalBless > 0)
                                {
                                    Damage = (uint)(Math.Floor((double)Damage * (1 - ((C.EqStats.TotalBless < 60) ? (double)C.EqStats.TotalBless : (double)60) * .01)));
                                    //Console.WriteLine(C.EqStats.TotalBless);
                                }
                                
                                //BP
                                //Console.WriteLine(User.Name + " " + (int)User.Potency);
                                //Console.WriteLine(C.Name + " " + (int)C.Potency);
                                if (User.Potency < C.Potency)
                                {
                                    Damage = (uint)(((double)Damage) * (((double)C.Potency / (double)User.Potency) + .85) / Math.Sqrt((double)(C.Potency - User.Potency)));
                                    if (C.Potency - User.Potency >= 50)
                                        Damage = (uint)((double)Damage * .6);
                                }
                                else
                                {

                                    Damage = (uint)((double)Damage * .9);
                                }

                                if (C.Potency >= 300)
                                {
                                    Damage = Damage = (uint)((double)Damage * .7);
                                }





                                Damage += User.EqStats.MeleeDamageIncrease;
                                if (C.EqStats.MeleeDamageDecrease >= Damage)
                                    Damage = 1;
                                else
                                    Damage -= C.EqStats.MeleeDamageDecrease;
                                break;
ie. Def and Shield has to be within the case
dragon89928 is offline  
Thanks
1 User
Old 06/04/2010, 10:26   #5
 
BlueFlame11's Avatar
 
elite*gold: 0
Join Date: Apr 2010
Posts: 116
Received Thanks: 12
Quote:
Originally Posted by dragon89928 View Post
@synthesis
Yeah.. I got tired of the stupid 30ks full +12s did to each other on my server. This is a VERY rough estimation of the damages.

@blueflame11

Did you remove even the "case"? The code should be..

Code:
case DamageType.Melee:
if (Game.World.NoPKMaps.Contains(User.Loc.Map))
                                    if (Info.ExtraEff == ExtraEffect.None)
                                        return 0;

                                ushort Def = (ushort)((double)C.EqStats.defense*2);
                                Buff Shield = C.BuffOf(SkillsClass.ExtraEffect.MagicShield);
                                if (Shield.Eff == SkillsClass.ExtraEffect.MagicShield)
                                    Def = (ushort)(Def * Shield.Value);

                                Damage = User.PrepareAttack(2, false);
                                Damage = (uint)(Damage * Info.EffectValue);
                                Damage += Info.Damage;


                                if (Def >= Damage)
                                    Damage = 1;
                                else
                                    Damage -= Def;

                                if (C.Reborns == 1)
                                {
                                    Damage = (uint)Math.Floor((double)Damage * .7);
                                }
                                else if (C.Reborns == 2)
                                {
                                    Damage = (uint)Math.Floor((double)Damage * .7);
                                    if (User.Reborns < 2)
                                        Damage = (uint)(Math.Floor((double)Damage * .5));
                                }

                                //STGs
                                Damage = (uint)(Math.Floor((double)Damage * (1 - ((C.EqStats.GemBless < .50) ? C.EqStats.GemBless : .50))));
                                

                                //EQ bless
                                if (C.EqStats.TotalBless > 0)
                                {
                                    Damage = (uint)(Math.Floor((double)Damage * (1 - ((C.EqStats.TotalBless < 60) ? (double)C.EqStats.TotalBless : (double)60) * .01)));
                                    //Console.WriteLine(C.EqStats.TotalBless);
                                }
                                
                                //BP
                                //Console.WriteLine(User.Name + " " + (int)User.Potency);
                                //Console.WriteLine(C.Name + " " + (int)C.Potency);
                                if (User.Potency < C.Potency)
                                {
                                    Damage = (uint)(((double)Damage) * (((double)C.Potency / (double)User.Potency) + .85) / Math.Sqrt((double)(C.Potency - User.Potency)));
                                    if (C.Potency - User.Potency >= 50)
                                        Damage = (uint)((double)Damage * .6);
                                }
                                else
                                {

                                    Damage = (uint)((double)Damage * .9);
                                }

                                if (C.Potency >= 300)
                                {
                                    Damage = Damage = (uint)((double)Damage * .7);
                                }





                                Damage += User.EqStats.MeleeDamageIncrease;
                                if (C.EqStats.MeleeDamageDecrease >= Damage)
                                    Damage = 1;
                                else
                                    Damage -= C.EqStats.MeleeDamageDecrease;
                                break;
ie. Def and Shield has to be within the case
WOOT
Thanks!!!!!!
BlueFlame11 is offline  
Old 06/04/2010, 19:11   #6
 
elite*gold: 0
Join Date: Dec 2005
Posts: 231
Received Thanks: 85
Quote:
Originally Posted by BlueFlame11 View Post
WOOT
Thanks!!!!!!
haha np. I wasn't too sure if that would fix it but glad it did
dragon89928 is offline  
Old 07/20/2010, 23:28   #7
 
elite*gold: 0
Join Date: Sep 2007
Posts: 54
Received Thanks: 1
i found it great release but it need more work
thanks any ways
wolvreen2006 is offline  
Old 07/21/2010, 00:20   #8
 
.Beatz's Avatar
 
elite*gold: 0
Join Date: May 2006
Posts: 1,190
Received Thanks: 516
Quote:
Originally Posted by wolvreen2006 View Post
i found it great release but it need more work
thanks any ways
Need more work? Then help out the thread starter and do "more work" to it then release it on this thread. I am sure the thread starter will be gratefull for your help
.Beatz is offline  
Old 07/21/2010, 02:18   #9
 
CØĐ£Ř||Mã©hÍñє's Avatar
 
elite*gold: 0
Join Date: May 2010
Posts: 248
Received Thanks: 36
muaaaah OMG you are the best
CØĐ£Ř||Mã©hÍñє is offline  
Old 07/21/2010, 10:37   #10
 
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
Here's mine:

Code:
            int Damage = 0;

            if (attacked.ContainsFlag(Network.GamePackets.Update.Flags.ShurikenVortex))
                return 1;
            if (!attacker.Transformed)
                Damage = ServerBase.Kernel.Random.Next((int)attacker.MinAttack, (int)attacker.MaxAttack + 1);
            else
                Damage = ServerBase.Kernel.Random.Next((int)attacker.TransformationMinAttack, (int)attacker.TransformationMaxAttack + 1);

            if (attacker.OnSuperman())
                if (attacked.EntityFlag == EntityFlag.Monster)
                    Damage *= 10;
                else
                    Damage *= 2;

            if (attacker.OnFatalStrike())
                if (attacked.EntityFlag == EntityFlag.Monster)
                    Damage *= 5;

            if (!attacked.Transformed)
                Damage -= attacked.Defence;
            else
                Damage -= attacked.TransformationDefence;

            Damage -= Damage * attacked.ItemBless / 100;

            int potDifference = attacker.Potency - attacked.Potency;
            if (potDifference > 0)
            {
                float rate = (float)potDifference / 100;
                uint damageplus = (uint)(Damage * rate);
                if (damageplus > Damage)
                    Damage = (int)damageplus;
            }

            Damage += attacker.PhysicalDamageIncrease;
            Damage -= attacked.PhysicalDamageDecrease;

            if (Damage <= 0)
                Damage = 1;
For me,since MinAttack, MaxAttack and the Defence are accessors, when shield/stigma is on they get changed directly, so I don't have to add it every where.
-impulse- is offline  
Old 07/21/2010, 11:12   #11
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,338
Received Thanks: 490
both not rly accurate
~Yuki~ is offline  
Old 07/21/2010, 20:46   #12
 
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
Quote:
Originally Posted by ~Yuki~ View Post
both not rly accurate
I don't know about his, but for me, mine works pretty well.
-impulse- is offline  
Old 08/02/2010, 12:20   #13
 
Escapex's Avatar
 
elite*gold: 0
Join Date: Jul 2010
Posts: 102
Received Thanks: 36
anyway I also removed something I forget.. I think it was archer_fly or something

Also for 5165 users. Server calculates BP wrong. It doesn't add in the steed BP. So to make it add the steed bp to total bp:

find
Code:

public ushort Potency

replace with
Code:

public ushort Potency
{
get
{
string s = ((ushort)Equips.HeadGear.Soc1).ToString();
int prePotency = 0;
prePotency += Level + 5 * Reborns;
for (byte x = 1; x <= 12; x++)
{
Item I = Equips.Get(x);
if (I.UID != 0)
prePotency += I.Pot;
}
prePotency += (byte)Nobility.Rank;
return (ushort)prePotency;
}
}


--------------------------------------
dragon please input the following words
---------------------------------------
Character.cs to find this top stuff. <.<
Escapex is offline  
Reply


Similar Threads Similar Threads
Exp calculation?
01/09/2011 - CO2 Programming - 3 Replies
Hey, Does anyone has a decent exp calculation, or show me atleast how it is calculated? I really have no idea when it comes to conquer. Thanks in advance, ImmuneOne.
Repair Calculation
06/04/2010 - CO2 Private Server - 0 Replies
Here is the correct gold calculation for repairing an item: int nRecoverDurability = Math.Max(0, Item.Stats.Durability - Item.CurDurability); if (nRecoverDurability == 0) return; byte Quality = ItemManipulation.GetQuality((int)Item.Stats.ID); double QualityMultipier = 0;
5165 Damage Calculation
03/07/2010 - CO2 Private Server - 7 Replies
Fixes around the forum are useless and no where near good enough if you want to make a server public. Someone should go ahead and fix it then release their code. Get some thanks and make everyone happy. I wont because I can't, I would if i could. ^^
Monster to Player Magic Damage Calculation
02/12/2010 - CO2 Private Server - 3 Replies
Someone know the right calculation for MVP damage? I'm with small problemas at that... Ive tryied to many ways but never get the correct =/
AL Damage Calculation
07/15/2007 - Archlord - 0 Replies
Does anyone know how AL computes damage? I have been playing with combinations of weapons and stones and can't find the magic equation. Here is what I have been doing: Ab = Base Attack (without weapon) Aw = Attack with Weapon Ae = Attack bonus due to Elemental Stones (e.g. 4 level 3 stones is 5+5+1+5+1+5+1 = 23) Sb = Skill bonus for Basic Attack (%) Se = Skill bonus for Elemental Attack (%) a = attenuation factor based on mob level and player level b = boolean for elemental damage...



All times are GMT +1. The time now is 03:39.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.