Jump to content

Critical Strike Calculation


killsakiller

Recommended Posts

Now please be a little patient with me as I am only a novice when it comes to programming. I have been playing around with mangos for a little bit now and I am trying to get a server balanced for players to be able to solo Instances if need be. So of course one of the first things I did was adjust the player stats so they are much higher than what UDB had for stats. Now the question arises. I have noticed that the crit chance on my characters is all messed up so I have been looking at the code for calculating Critical Strike. Like I said I am a novice with programming so I am looking at the code for getting the crit rate from Agility.

float Player::GetMeleeCritFromAgility()

{

uint32 level = getLevel();

uint32 pclass = getClass();

if (level>GT_MAX_LEVEL) level = GT_MAX_LEVEL;

GtChanceToMeleeCritBaseEntry const *critBase = sGtChanceToMeleeCritBaseStore.LookupEntry(pclass-1);

GtChanceToMeleeCritEntry const *critRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1);

if (critBase==NULL || critRatio==NULL)

return 0.0f;

float crit=critBase->base + GetStat(STAT_AGILITY)*critRatio->ratio;

return crit*100.0f;

}

So I guess I am totally lost at the point where it is pulling the data from. Simply put I cant figure out which table it is accessing for the base and ratio with the LookupEntry() function. I would appreciate any help anyone could offer. Thanks

Link to comment
Share on other sites

Maybe you should try doxygen, answers such questions in seconds...

click variable, go through "referenced by" list and you'll see it's filled in LoadDBCStores.

gtChanceToMeleeCritBase.dbc => sGtChanceToMeleeCritBaseStore

gtChanceToMeleeCrit.dbc => sGtChanceToMeleeCritStore

So, no database entries...

Link to comment
Share on other sites

This goes to show my ignorance of the language and this code. I was looking at that when i did a referenced by search (using VS2008). I just assumed that DB in DBCSTORE meant database. Now that I feel the fool I could use a little point in the right direction with trying to figure out how this is calculated. The problem I am having is that as a hunter I am hitting 75 agi @ lvl 11. At that point my crit starts to drop from 10.40% at lvl 10 then at 11 it is 10.17% and as I lvl it continues to go down.

I am starting to slowly understand more of this code as I am looking at it, but the line in StatSystem.cpp I dont understand is

float value = GetTotalPercentageModValue(modGroup) + GetRatingBonusValue(cr);

in the function

void Player::UpdateCritPercentage(WeaponAttackType attType)

I have looked at both of those function Definitions and I am having trouble putting together how the values are stored and referanced for this calculation. the *.LookupEntry(); is seriously messing with me.

Back to Player.cpp

GtChanceToMeleeCritBaseEntry const *critBase = sGtChanceToMeleeCritBaseStore.LookupEntry(pclass-1);

GtChanceToMeleeCritEntry const *critRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1);

those lines are messing with me. I am just having a hard time grasping how the whole calculation is done. I have been trying to keep notes as I go, but more time I spend looking around at this code the more I just keep erasing and getting confused and running around in the same circles.

Link to comment
Share on other sites

Oh, so you were not lazy after all :)

Hm i can't really say i'm an expert when it comes to MaNGOS code, but i'll try to summarize what i understand of it.

Generally, in WoW the conversion of agility and crit rating (and pretty much any other rating) depends on player level. The higher your level, the more you need for one percent critical strike chance. Additionally, player classes may benefit differently from stats, i think crit rating is same for all classes, but agility is definitely not.

For calculating the chance, the core needs these conversion tables which are read from the .dbc files extracted from the WoW client .mpq files.

With these values, critical strike chance is calculated from agility, critical strike rating, talent and other auras.

Editing .dbc is pretty much a taboo...legality issues aside, this would often have unwanted side effects if not all players edit their client files too, because client behaviour depends on those files too (why would they otherwise be part of it) so that's impractical IMHO.

Bending the game mechanics will not be all that easy, it's a very fragile balance that gets tweaked by blizzard ever so often, with varying success...the usefulness of gear will also be heavily impacted. Also most caster spells will not scale with base stats at all but their bonus comes entirely from talents and gear with spellpower...

For soloing instances I'd suggest to look into player bots, different mob stats etc. first before trying to modify basic game mechanics. The only way i see this could work is scaling the values as late as possible, like, increase final damage/healing by factor X, increase health granted per stamina by factor Y etc and leave the base stats and conversions alone.

Link to comment
Share on other sites

Ok thank you so much for the advice and the information! This is very helpful to me and I think I will go way more the route you are suggesting. Although I dont know If I really like the Idea of Running bots, it is something I will allow my players to decide. As for the Stats I think I will tone them down to something more resonable then What I have them at which is 5*Blizzard. I will also play around with reducing HP and Damage of Elites if the players dont want to go the way of Bots, I personally dont want to, but I think they will want to. I have AHbot running on my server ATM, so from what I have read it can be tricky setting up the bots for that. I wont go on and on here about what all I am going to do as I have too much already. Thank you for all the help and your time.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use