mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
Fixed random base poinst part calculation
0 - unused, 1 -> always +1, other in ranges (rand...1) or (1..rand)
This commit is contained in:
parent
8a98fb8846
commit
8d97ad06b2
1 changed files with 11 additions and 6 deletions
|
|
@ -11308,16 +11308,21 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, SpellEffectIndex
|
|||
int32 randomPoints = int32(spellProto->EffectDieSides[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
|
||||
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;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
int32 value = basePoints;
|
||||
|
||||
// random damage
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue