PDA

View Full Version : 2 Hand Damage Bonus


renoofturks1
09-16-2008, 01:46 PM
This formula works for all the 2 handers that I have tested. It should work up to level 80. As for it's implementation into C++, It should work, I have never worked with C++ before so if there is a better way to do it. Let me know. This would go in attack.cpp in zone. Any thoughts/input appreciated.


if (Weapon->Delay <=27)
return (BasicBonus + 1);
if (Weapon->Delay <=39)
return (BasicBonus + ((GetLevel()-27)/4));
if (Weapon->Delay <= 41)
return (BasicBonus + ((GetLevel()-27)/4) + 1);
if (Weapon->Delay >= 42)
if (GetLevel() > 54)
int levelint = 1;
if (GetLevel() > 56)
levelint += 1;
if (GetLevel() > 58)
levelint += 1;
if (GetLevel() > 59)
levelint += 1;
if (GetLevel() > 66)
levelint += 1;
if (GetLevel() > 71)
levelint += 1;
if (Weapon->Delay > 42)
delayint = 1;
if (Weapon->Delay >44)
delayint += 1;

return (((Weapon->Delay-37)/3) + ((GetLevel()-25)/ 5) + ((Weapon->Delay * (GetLevel()-50 + levelint))/40) + delayint + BasicBonus);

trevius
09-16-2008, 04:27 PM
Doesn't there need to be 2 different formulas? I thought that 1 handed vs 2 handed weapons have different damage bonus formulas. At least I remember on live when they were first adding damage bonuses that 2 handers were supposed to get a much better damage bonus than 1 handers to help balance dps from them.

ChaosSlayer
09-16-2008, 04:45 PM
IMHo the whole dmg bonus thing was ridiculus atempt to biff up 2handers

they simply should have given 2handres better ratios than 2x one handers of same speed.

so if you have a pair of 10 dmg 30 dly swords an equal 2hander should be 20+ dmg 30 dly (preferably 22+ dmg)

no need to have dmg bonuses at all. specialy on both - 1handers and 1handers

trevius
09-16-2008, 06:26 PM
The emulator tries to simulate live as closely as possible, so it isn't an debate if they will have damage bonus or not, it is a debate on the exact equations to calculate it :P

renoofturks1
09-16-2008, 06:57 PM
Yes, there is a 1handed bonus, which we already have calculated correctly in the file. The whole finished product would resemble....
Replacing lines 1935 through 1971


int Mob::GetWeaponDamageBonus(const Item_Struct* Weapon)
{
// Kaiyodo - Calculate the damage bonus for a weapon on the main hand
if (GetLevel() < 28)
return(0);

// Check we're on of the classes that gets a damage bonus
if (!IsWarriorClass())
return 0;

int BasicBonus = ((GetLevel() - 25) / 3) + 1;

if(!Weapon)
return(BasicBonus);

// If we have no weapon, or only a single handed weapon, just return the default
// damage bonus of (Level - 25) / 3
if (Weapon->ItemClass == ItemClassCommon)
return BasicBonus;

if ((Weapon->ItemType == ItemType1HS) || (Weapon->ItemType == ItemTypePierce) || (Weapon->ItemType == ItemType1HB))
return BasicBonus;

//begin Reno's untested code
if (Weapon->Delay <=27)
return (BasicBonus + 1);
if (Weapon->Delay <=39)
return (BasicBonus + ((GetLevel()-27)/4));
if (Weapon->Delay <= 41)
return (BasicBonus + ((GetLevel()-27)/4) + 1);
if (Weapon->Delay >= 42)
if (GetLevel() > 54)
int levelint = 1;
if (GetLevel() > 56)
levelint += 1;
if (GetLevel() > 58)
levelint += 1;
if (GetLevel() > 59)
levelint += 1;
if (GetLevel() > 66)
levelint += 1;
if (GetLevel() > 71)
levelint += 1;
if (Weapon->Delay > 42)
int delayint = 1;
if (Weapon->Delay >44)
delayint += 1;

return (((Weapon->Delay-37)/3) + ((GetLevel()-25)/ 5) + ((Weapon->Delay * (GetLevel()-50 + levelint))/40) + delayint + BasicBonus);
}

cavedude
09-16-2008, 08:09 PM
I see no harm in merging this into TGC when it comes back up. The worst that can happen is 2H players will own until I pull it out. Thanks Reno, nice to see you here! The only thing I am going to change is adding a 2H check to your changes, otherwise all weapons will return true and get the 2H bonus.

renoofturks1
09-16-2008, 08:13 PM
Yes, I broke down and went to the EQEmu boards! I couldn't remember my login it's been so long, had to make a new account. I am testing it right now CD, Give me a bit and I'll let ya know how it works out...

As for the the 2h check, I assumed taht the previous 1h check would suffice to weed out the 1 hander's and saw no need for extra code, if avoidable.

cavedude
09-16-2008, 08:22 PM
You're right, it returns BasicBonus; so 1 handers won't check the delay statements. I just always like to make absolutely sure what we want to happen does happen.

renoofturks1
09-16-2008, 08:26 PM
Understandable, I'll see how it works out. I have a feeling I need to change the order that Damage Bonus is applied within the combat routine also, as it should be un-affected by AC and it currently is, I think.

cavedude
09-16-2008, 08:55 PM
You forgot to define delayint and levelint. Just add:

int delayint;
int levelint;

before your first if statement.

renoofturks1
09-16-2008, 08:59 PM
Aye, I tried to define them as they became needed. I see now, this wouldn't work. I'll have a revised tested version shortly here.

renoofturks1
09-16-2008, 10:20 PM
Ok, I have it tested and working, but I had to comment out part of the existing code, and I am not sure what it does.... Someone care to fill me in?

if (Weapon->ItemClass == ItemClassCommon)

What is ItemClassCommon? Barring that not being important...the below code is tested to work, and add the proper damage bonus(within two, rounding) after all AC calculations as it should. Now, if that little piece of code I commented out is important, I'll go back to the drawing board LOL

int Mob::GetWeaponDamageBonus(const Item_Struct* Weapon)
{
// Kaiyodo - Calculate the damage bonus for a weapon on the main hand
if (GetLevel() < 28)
return(0);

// Check we're on of the classes that gets a damage bonus
if (!IsWarriorClass())
return 0;

int BasicBonus = ((GetLevel() - 25) / 3) + 1;

if(!Weapon)
return(BasicBonus);

// If we have no weapon, or only a single handed weapon, just return the default
// damage bonus of (Level - 25) / 3
//if (Weapon->ItemClass == ItemClassCommon)
//return BasicBonus;

if ((Weapon->ItemType == ItemType1HS) || (Weapon->ItemType == ItemTypePierce) || (Weapon->ItemType == ItemType1HB))
return BasicBonus;

if (Weapon->Delay <= 27)
return (BasicBonus + 1);
if (Weapon->Delay <= 39)
return (BasicBonus + ((GetLevel()-27) / 4));
if (Weapon->Delay <= 41)
return (BasicBonus + ((GetLevel()-27) / 4) + 1);
//reno-calc 2hand dmg bonus
if (Weapon->Delay >= 42)
{
int levelint = 0;
int delayint = 0;
if (GetLevel() > 54)
levelint++;
if (GetLevel() > 56)
levelint++;
if (GetLevel() > 56)
levelint++;
if (GetLevel() > 58)
levelint++;
if (GetLevel() > 59)
levelint++;
if (GetLevel() > 66)
levelint++;
if (GetLevel() > 71)
levelint++;
if (Weapon->Delay > 42)
delayint++;
if (Weapon->Delay > 44)
delayint++;
return (((Weapon->Delay-37)/3) + ((GetLevel()-25)/5) + ((Weapon->Delay * ((GetLevel()-50) + levelint))/40) + delayint + BasicBonus);
}
}

renoofturks1
09-16-2008, 10:27 PM
Note: The formula for delay's UNDER 42 and ABOVE 28 is off. I will work on this one next

trevius
09-16-2008, 11:13 PM
in eq_constants.h

/*
** Item types
**
*/
enum ItemClass
{
ItemClassCommon = 0,
ItemClassContainer = 1,
ItemClassBook = 2
};

So, ItemClassCommon is just checking to verify that the item is a normal item. I think your 1hs check should probably work fine to replace it. But, if you wanted to keep it in there just be be sure (since it was there before), it probably wouldn't hurt. I think you could just do something like this maybe:

if ((Weapon->ItemClass == ItemClassCommon) && ((Weapon->ItemType == ItemType1HS) || (Weapon->ItemType == ItemTypePierce) || (Weapon->ItemType == ItemType1HB)))
return BasicBonus;

That way you are checking for both things. I am no coder, but it makes sense that this should work to me.

renoofturks1
09-17-2008, 09:11 AM
The problem was with the fact that, no matter what weapon I was wielding.


if (Weapon->ItemClass == ItemClassCommon)
return BasicBonus;


Was always returning true, and never allowing anything but BasicBonus to be returned. Adding it as you stated should solve that problem. Thank you.

renoofturks1
09-17-2008, 06:31 PM
This is a working tested version. It isn't perfect yet, but, this works for level 60+ accurately, and becomes less and less accurate as level decreases. Weapon's under 42 delay is still off, but closer. I'll work on it some more but if anyone cares to try it, or use it.

zone/attack.cpp - Replacing lines 1935 through 1971
int Mob::GetWeaponDamageBonus(const Item_Struct* Weapon)
{
// Kaiyodo - Calculate the damage bonus for a weapon on the main hand
if (GetLevel() < 28)
return(0);

// Check we're on of the classes that gets a damage bonus
if (!IsWarriorClass())
return 0;

int BasicBonus = ((GetLevel() - 25) / 3);

if(!Weapon)
return(BasicBonus);

// If we have no weapon, or only a single handed weapon, just return the default
// damage bonus of (Level - 25) / 3
//if (Weapon->ItemClass == ItemClassCommon)
//return BasicBonus;

if ((Weapon->ItemType == ItemType1HS) || (Weapon->ItemType == ItemTypePierce) || (Weapon->ItemType == ItemType1HB))
return BasicBonus;

if (Weapon->Delay <= 27)
return (BasicBonus + 1);
if (Weapon->Delay <= 39)
return (BasicBonus + ((GetLevel()-25) / 5));
if (Weapon->Delay <= 41)
return (BasicBonus + ((GetLevel()-25) / 5) + 1);
if (Weapon->Delay >= 42)
{
int levelint = 0;
int delayint = 0;
if (GetLevel() > 54)
levelint++;
if (GetLevel() > 56)
levelint++;
if (GetLevel() > 56)
levelint++;
if (GetLevel() > 58)
levelint++;
if (GetLevel() > 59)
levelint++;
if (GetLevel() > 66)
levelint++;
if (GetLevel() > 71)
levelint++;
if (Weapon->Delay > 42)
delayint++;
if (Weapon->Delay > 44)
delayint++;
return (((Weapon->Delay-37)/3) + ((GetLevel()-25)/5) + ((Weapon->Delay * ((GetLevel()-50) + levelint))/40) + BasicBonus);
}
}

renoofturks1
09-21-2008, 06:49 PM
Final version coming soon.....