mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[6975] Fixed spell damage calculation for negative EffectDieSides.
Thanks to NoFantasy for testing. Also small code style apply to random generation functions.
This commit is contained in:
parent
02cc37bcd0
commit
c5976f93da
3 changed files with 11 additions and 8 deletions
|
|
@ -8757,8 +8757,11 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_inde
|
|||
int32 randomPoints = int32(spellProto->EffectDieSides[effect_index] + level * randomPointsPerLevel);
|
||||
float comboDamage = spellProto->EffectPointsPerComboPoint[effect_index];
|
||||
|
||||
// prevent random generator from getting confused by spells casted with Unit::CastCustomSpell
|
||||
int32 randvalue = spellProto->EffectBaseDice[effect_index] >= randomPoints ? spellProto->EffectBaseDice[effect_index]:irand(spellProto->EffectBaseDice[effect_index], randomPoints);
|
||||
// range can have possitive and negative values, so order its for irand
|
||||
int32 randvalue = int32(spellProto->EffectBaseDice[effect_index]) >= randomPoints
|
||||
? irand(randomPoints, int32(spellProto->EffectBaseDice[effect_index]))
|
||||
: irand(int32(spellProto->EffectBaseDice[effect_index]), randomPoints);
|
||||
|
||||
int32 value = basePoints + randvalue;
|
||||
//random damage
|
||||
if(comboDamage != 0 && unitPlayer && target && (target->GetGUID() == unitPlayer->GetComboTarget()))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "6974"
|
||||
#define REVISION_NR "6975"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue