This commit is contained in:
tomrus88 2010-03-24 12:43:09 +03:00
parent 247cf8e9b2
commit 4234c685b8

View file

@ -1129,13 +1129,13 @@ void Unit::CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const
Spell *spell = new Spell(this, spellInfo, triggered, originalCaster); Spell *spell = new Spell(this, spellInfo, triggered, originalCaster);
if(bp0) if(bp0)
spell->m_currentBasePoints[EFFECT_INDEX_0] = *bp0-int32(1); spell->m_currentBasePoints[EFFECT_INDEX_0] = *bp0;
if(bp1) if(bp1)
spell->m_currentBasePoints[EFFECT_INDEX_1] = *bp1-int32(1); spell->m_currentBasePoints[EFFECT_INDEX_1] = *bp1;
if(bp2) if(bp2)
spell->m_currentBasePoints[EFFECT_INDEX_2] = *bp2-int32(1); spell->m_currentBasePoints[EFFECT_INDEX_2] = *bp2;
SpellCastTargets targets; SpellCastTargets targets;
targets.setUnitTarget( Victim ); targets.setUnitTarget( Victim );
@ -11246,34 +11246,28 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, SpellEffectIndex
level-= (int32)spellProto->spellLevel; level-= (int32)spellProto->spellLevel;
float basePointsPerLevel = spellProto->EffectRealPointsPerLevel[effect_index]; float basePointsPerLevel = spellProto->EffectRealPointsPerLevel[effect_index];
float randomPointsPerLevel = 1;
int32 basePoints = int32(effBasePoints + level * basePointsPerLevel); int32 basePoints = int32(effBasePoints + level * basePointsPerLevel);
int32 randomPoints = int32(spellProto->EffectDieSides[effect_index] + level * randomPointsPerLevel); int32 randomPoints = int32(spellProto->EffectDieSides[effect_index]);
float comboDamage = spellProto->EffectPointsPerComboPoint[effect_index]; float comboDamage = spellProto->EffectPointsPerComboPoint[effect_index];
// range can have possitive and negative values, so order its for irand int32 value = basePoints + 1;
int32 randvalue = int32(1) >= randomPoints
? irand(randomPoints, int32(1))
: irand(int32(1), randomPoints);
int32 value = basePoints + randvalue;
//random damage //random damage
if(comboDamage != 0 && unitPlayer && target && (target->GetGUID() == unitPlayer->GetComboTarget())) if(comboDamage != 0 && unitPlayer && target && (target->GetGUID() == unitPlayer->GetComboTarget()))
value += (int32)(comboDamage * comboPoints); value += (int32)(comboDamage * comboPoints);
if(Player* modOwner = GetSpellModOwner()) if(Player* modOwner = GetSpellModOwner())
{ {
modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_ALL_EFFECTS, value); modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_ALL_EFFECTS, value);
switch(effect_index) switch(effect_index)
{ {
case 0: case 0:
modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_EFFECT1, value); modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT1, value);
break; break;
case 1: case 1:
modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_EFFECT2, value); modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT2, value);
break; break;
case 2: case 2:
modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_EFFECT3, value); modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT3, value);
break; break;
} }
} }