*Fix amount calculation for spell effect with EffectDieSides set to 0.

--HG--
branch : trunk
This commit is contained in:
QAston
2010-07-22 12:21:11 +02:00
parent 50e459b5c5
commit 13a2a1afc6
5 changed files with 16 additions and 8 deletions
+1 -1
View File
@@ -7916,7 +7916,7 @@ void Player::CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 c
Spell *spell = new Spell(this, spellInfo,false);
spell->m_CastItem = item;
spell->m_cast_count = cast_count; //set count of casts
spell->m_currentBasePoints[0] = SpellMgr::CalculateSpellEffectBaseAmount(learning_spell_id);
spell->m_currentBasePoints[0] = SpellMgr::CalculateSpellEffectBaseAmount(learning_spell_id, spellInfo, 0);
spell->prepare(&targets);
return;
}
+3 -3
View File
@@ -6921,15 +6921,15 @@ void Spell::SetSpellValue(SpellValueMod mod, int32 value)
switch(mod)
{
case SPELLVALUE_BASE_POINT0:
m_spellValue->EffectBasePoints[0] = SpellMgr::CalculateSpellEffectBaseAmount(value);
m_spellValue->EffectBasePoints[0] = SpellMgr::CalculateSpellEffectBaseAmount(value, m_spellInfo, 0);
m_currentBasePoints[0] = m_spellValue->EffectBasePoints[0]; //this should be removed in the future
break;
case SPELLVALUE_BASE_POINT1:
m_spellValue->EffectBasePoints[1] = SpellMgr::CalculateSpellEffectBaseAmount(value);
m_spellValue->EffectBasePoints[1] = SpellMgr::CalculateSpellEffectBaseAmount(value, m_spellInfo, 1);
m_currentBasePoints[1] = m_spellValue->EffectBasePoints[1];
break;
case SPELLVALUE_BASE_POINT2:
m_spellValue->EffectBasePoints[2] = SpellMgr::CalculateSpellEffectBaseAmount(value);
m_spellValue->EffectBasePoints[2] = SpellMgr::CalculateSpellEffectBaseAmount(value, m_spellInfo, 2);
m_currentBasePoints[2] = m_spellValue->EffectBasePoints[2];
break;
case SPELLVALUE_RADIUS_MOD:
+2 -2
View File
@@ -521,7 +521,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
damage += pdamage * aura->GetTotalTicks() * pct_dir / 100;
uint32 pct_dot = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effect_idx + 2)) / 3;
m_currentBasePoints[1] = SpellMgr::CalculateSpellEffectBaseAmount(pdamage * aura->GetTotalTicks() * pct_dot / 100);
m_currentBasePoints[1] = SpellMgr::CalculateSpellEffectBaseAmount(pdamage * aura->GetTotalTicks() * pct_dot / 100, m_spellInfo, 1);
apply_direct_bonus = false;
// Glyph of Conflagrate
@@ -2214,7 +2214,7 @@ void Spell::EffectDummy(uint32 i)
targets.setUnitTarget(unitTarget);
Spell* spell = new Spell(m_caster, spellInfo, triggered, m_originalCasterGUID, NULL, true);
if (bp) spell->m_currentBasePoints[0] = SpellMgr::CalculateSpellEffectBaseAmount(bp);
if (bp) spell->m_currentBasePoints[0] = SpellMgr::CalculateSpellEffectBaseAmount(bp, spellInfo, 0);
spell->prepare(&targets);
}
+9 -1
View File
@@ -1845,7 +1845,7 @@ int32 SpellMgr::CalculateSpellEffectAmount(SpellEntry const * spellEntry, uint8
// roll in a range <1;EffectDieSides> as of patch 3.3.3
switch(randomPoints)
{
case 0: // not used
case 0: break;
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
@@ -1886,6 +1886,14 @@ int32 SpellMgr::CalculateSpellEffectAmount(SpellEntry const * spellEntry, uint8
return value;
}
int32 SpellMgr::CalculateSpellEffectBaseAmount(int32 value, SpellEntry const * spellEntry, uint8 effIndex)
{
if (spellEntry->EffectDieSides[effIndex] == 0)
return value;
else
return value - 1;
}
SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spellInfo, uint32 playerLevel) const
{
// ignore passive spells
+1 -1
View File
@@ -1222,7 +1222,7 @@ class SpellMgr
bool IsSkillBonusSpell(uint32 spellId) const;
bool IsSkillTypeSpell(uint32 spellId, SkillType type) const;
static int32 CalculateSpellEffectAmount(SpellEntry const * spellEntry, uint8 effIndex, Unit const * caster = NULL, int32 const * basePoints = NULL, Unit const * target = NULL);
static int32 CalculateSpellEffectBaseAmount(int32 value) {return value-1;};
static int32 CalculateSpellEffectBaseAmount(int32 value, SpellEntry const * spellEntry, uint8 effIndex);
// Spell correctess for client using
static bool IsSpellValid(SpellEntry const * spellInfo, Player* pl = NULL, bool msg = true);