aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 043dc8cc179..c2c139fcc78 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -12243,18 +12243,22 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_inde
int32 basePoints = int32(effBasePoints + level * basePointsPerLevel);
int32 randomPoints = int32(spellProto->EffectDieSides[effect_index]);
- int32 value = basePoints;
-
- if (randomPoints != 0)
+ switch(randomPoints)
{
- // range can have positive and negative values, so order its for irand
- int32 randvalue = (0 > randomPoints)
- ? irand(randomPoints, 0)
- : irand(0, randomPoints);
+ case 0: break; // not used
+ case 1: basePoints += 1; break; // range 1..1
+ default:
+ // range can have positive (1..rand) and negative (rand..1) values, so order its for irand
+ int32 randvalue = (randomPoints >= 1)
+ ? irand(1, randomPoints)
+ : irand(randomPoints, 1);
- basePoints += randvalue;
+ basePoints += randvalue;
+ break;
}
-
+
+ int32 value = basePoints;
+
// random damage
//if (comboDamage != 0 && unitPlayer /*&& target && (target->GetGUID() == unitPlayer->GetComboTarget())*/)
if (m_movedPlayer)