aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authorn0n4m3 <none@none>2010-04-11 11:23:32 +0400
committern0n4m3 <none@none>2010-04-11 11:23:32 +0400
commitcdec48b9efab92c0af3bb1b96de0b4e8566f5a35 (patch)
treeb76ddc7ab80476156f77008d786fe344c9375feb /src/game/Unit.cpp
parent7ffc9ef40bd8a832bf14e0202b8da0ec98516725 (diff)
Some fixes for quests/basePoints calculation, realm server.
--HG-- branch : trunk
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)