Jump to content

Clarifying spell_bonus_data ?!


Darkknight900

Recommended Posts

Hi folks,

after there are many problems with the balance and dps at my server i just searched for reasons and found this table 'spell_bonus_data'....

Now my question is : How this this table work.

i found after searching a while in the code some functions for reading this table no prob and then going further to calculating with the values provided in the table:

int32 Unit::SpellBonusWithCoeffs(SpellEntry const *spellProto, int32 total, int32 benefit, int32 ap_benefit,  DamageEffectType damagetype, bool donePart, float defCoeffMod)
{
   // Distribute Damage over multiple effects, reduce by AoE
   float coeff;

   // Not apply this to creature casted spells
   if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->IsPet())
       coeff = 1.0f;
   // Check for table values
   else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id))
   {
       coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage;

       // apply ap bonus at done part calculation only (it flat total mod so common with taken)
       if (donePart && (bonus->ap_bonus || bonus->ap_dot_bonus))
       {
           float ap_bonus = damagetype == DOT ? bonus->ap_dot_bonus : bonus->ap_bonus;

           // Impurity
           if (GetTypeId() == TYPEID_PLAYER && spellProto->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT)
           {
               if (SpellEntry const* spell = ((Player*)this)->GetKnownTalentRankById(2005))
                   ap_bonus += ((spell->CalculateSimpleValue(EFFECT_INDEX_0) * ap_bonus) / 100.0f);
           }

           total += int32(ap_bonus * (GetTotalAttackPowerValue(IsSpellRequiresRangedAP(spellProto) ? RANGED_ATTACK : BASE_ATTACK) + ap_benefit));
       }
   }
   // Default calculation
   else if (benefit)
       coeff = CalculateDefaultCoefficient(spellProto, damagetype) * defCoeffMod;

   if (benefit)
   {
       float LvlPenalty = CalculateLevelPenalty(spellProto);

       // Spellmod SpellDamage
       if(Player* modOwner = GetSpellModOwner())
       {
           coeff *= 100.0f;
           modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE, coeff);
           coeff /= 100.0f;
       }

       total += int32(benefit * coeff * LvlPenalty);
   }

   return total;
};

I think this is a key part of this apply of the bonus, but someway this is confusing:

else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id))
   {
       /*>>>>>*/coeff/*<<<<<<*/ = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage;

       // apply ap bonus at done part calculation only (it flat total mod so common with taken)
       if (donePart && (bonus->ap_bonus || bonus->ap_dot_bonus))
       {
           float ap_bonus = damagetype == DOT ? bonus->ap_dot_bonus : bonus->ap_bonus;

           // Impurity
           if (GetTypeId() == TYPEID_PLAYER && spellProto->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT)
           {
               if (SpellEntry const* spell = ((Player*)this)->GetKnownTalentRankById(2005))
                   ap_bonus += ((spell->CalculateSimpleValue(EFFECT_INDEX_0) * ap_bonus) / 100.0f);
           }

           total += int32(ap_bonus * (GetTotalAttackPowerValue(IsSpellRequiresRangedAP(spellProto) ? RANGED_ATTACK : BASE_ATTACK) + ap_benefit));

this /*>>>>>*/coeff/*<<<<<<*/ isn't used anymore in this tree...

also i wanna know more of the calculating if this. I see many many functions in there and also many i already read but i don't have a clue how this spell_bonus_data work exactly.

Link to comment
Share on other sites

ok yeah got it, so this is clear i will looking more into the code.

btw. i tested know on my local server with clean core the spell 'Wrath' and 'Healing Touch'

Both got just a direct_bonus but this just seem to do nothing.

there was an entry for wrath with 0.5714 thought, i just tested it out decreasing it to 0.0001, did both reloaded spell_bonus_data ingame and restarted server but i didn't see any difference. Same with an increasing value to 5000 or just to 5 or 10.

Tested also just rank 1 which is given in the db and also rank 12 (probably that isn't related cause this is handled in core with different ranks).

So the same thing with Healing Touch no effect i could see....

Would like to hear if i make something wrong or maybe i've got something wrong in my mind :x

*Tested on clean mangos with psmdb

*Tested also on public server of me with some patches and so on but no difference

Link to comment
Share on other sites

I not undersatnd what you do and have in sources, but i specail after your post test step by step in debug apply spell_bonus_data coeff for Healing Touch and it work fine for me.

You must understand this this is _spell_power_ coeff. It set how many affect spellpower bonus to spell damage/heal

If your character not have spellpower then this coef will not affect anything. It not affect base raw spell damage/heal.

Link to comment
Share on other sites

You must understand this this is _spell_power_ coeff. It set how many affect spellpower bonus to spell damage/heal

If your character not have spellpower then this coef will not affect anything. It not affect base raw spell damage/heal.

Yeah this was my prob thought this coeff is giving a bonus without looking at the spellpower how i said was just a wrong thought.

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