Fixed random base poinst part calculation

0 - unused, 1 -> always +1, other in ranges (rand...1) or (1..rand)
This commit is contained in:
VladimirMangos 2010-04-06 18:49:53 +04:00
parent 8a98fb8846
commit 8d97ad06b2

View file

@ -11308,15 +11308,20 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, SpellEffectIndex
int32 randomPoints = int32(spellProto->EffectDieSides[effect_index]); int32 randomPoints = int32(spellProto->EffectDieSides[effect_index]);
float comboDamage = spellProto->EffectPointsPerComboPoint[effect_index]; float comboDamage = spellProto->EffectPointsPerComboPoint[effect_index];
if(randomPoints != 0) switch(randomPoints)
{ {
// range can have positive and negative values, so order its for irand case 0: break; // not used
int32 randvalue = (0 > randomPoints) case 1: basePoints += 1; break; // range 1..1
? irand(randomPoints, 0) default:
: irand(0, randomPoints); // 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; int32 value = basePoints;