View Full Version : [SOLVED] Change the formulas of crit,hit,dodge,expertise and others.

08-18-2014, 11:39 AM
Hello, i used search in forum and found only this :

OK, the idea and the reason why i'm created this post is i wanna change formulas of stats like for example in old formulas we had 1 agility adds 2 attack power and x dodge. then that x dodge converting to percentage and it's scales to much with my items .
ok what i wanna do i wanna make the stats rating percentage 10x bigger, that means

x dodge for 1 percent = x dodge for 0.1 percent.

That means i wanna increase the requirements of stats to convert them into percentage rating.

Now i think i need edit that in player.cpp which i linked out, but i don't get how exactly to make that edits.

Hope you understand about what i'm talking about ... It's hard to explain...

08-18-2014, 03:46 PM
I'm doing this for Maruum at this moment too.
The positions of the calculations are very different, some are in Player.cpp, some in Unit.cpp, some in StatSystem.cpp and so on..
These are the two i already changed:

Crit calculation:
Function: Player::UpdateCritPercentage
File: StatSystem.cpp

Spellcrit calculation:
Function: Player::UpdateSpellCritChance
File: StatSystem.cpp

(I'm working on haste atm, so maybe i could be wrong)
Function: Player::ApplyRatingMod
File: Player.cpp
Function: Unit::ApplyAttackTimePercentMod

Tip: If you want to work with critical rating instead of critical chance, you need to use m_baseRatingValue[CR_CRIT_MELEE]. I've searched very long for the critical rating.. :P

08-18-2014, 08:01 PM
Thank you mate, but still have one prob, don't get how to edit them correctly ! :?

Here i edited "armor" value.

void Player::UpdateArmor()
UnitMods unitMod = UNIT_MOD_ARMOR;

float value = GetModifierValue(unitMod, BASE_VALUE); // base armor (from items)
value *= GetModifierValue(unitMod, BASE_PCT); // armor percent from items
value += GetStat(STAT_AGILITY) * 1.2f; // armor bonus from stats
value += GetModifierValue(unitMod, TOTAL_VALUE);

//add dynamic flat mods
AuraEffectList const& mResbyIntellect = GetAuraEffectsByType(SPELL_AURA_MOD_RESISTANCE_OF_ STAT_PERCENT);
for (AuraEffectList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
value += CalculatePct(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount());

value *= GetModifierValue(unitMod, TOTAL_PCT) / 10.0f;


Pet* pet = GetPet();
if (pet)

UpdateAttackPowerAndDamage(); // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR

It is good or not?

And Critical

void Player::UpdateAllCritPercentages()
float value = GetMeleeCritFromAgility();

SetBaseModValue(CRIT_PERCENTAGE, PCT_MOD, value / 10.0f);
SetBaseModValue(OFFHAND_CRIT_PERCENTAGE, PCT_MOD, value / 10.0f);
SetBaseModValue(RANGED_CRIT_PERCENTAGE, PCT_MOD, value / 10.0f);


Sorry i'm weak at c++...

08-19-2014, 05:53 AM
You should describe what you want to change and you also should highlight every edited line, so i can see the changes without compare every line with the original.. :P
And always test yourself if it works, i don't do that for you. :P

08-19-2014, 07:26 AM
I tested, i got working all what i wan't thank you for navigate me to right files and functions. :)
Can be mark as solved ! :)
You are best ;)

all i want to do is / 10 all percentage of ratings ! :)
and its done now. i have haste,armor penetration, armor,hit, expertise,critical chance,dodge formulas edited. :) :determination:

08-19-2014, 04:16 PM
Great! Marking as solved. :3