From cdb3b259168002868e17b2eff9da2e3804f3975b Mon Sep 17 00:00:00 2001 From: joschiwald Date: Sun, 23 Oct 2016 14:45:31 +0200 Subject: Core/Spells: Fixed SpellEffects selection depending on Difficulty --- src/server/game/Spells/SpellInfo.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 3707aedf45f..45756a36ba1 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -3346,13 +3346,7 @@ SpellEffectInfoVector SpellInfo::GetEffectsForDifficulty(uint32 difficulty) cons { SpellEffectInfoVector effList; - // DIFFICULTY_NONE effects are the default effects, always active if current difficulty's effects don't overwrite - SpellEffectInfoMap::const_iterator itr = _effects.find(DIFFICULTY_NONE); - if (itr != _effects.end()) - effList = itr->second; - // downscale difficulty if original was not found - // DIFFICULTY_NONE is already in our list DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(difficulty); while (difficultyEntry) { @@ -3361,7 +3355,6 @@ SpellEffectInfoVector SpellInfo::GetEffectsForDifficulty(uint32 difficulty) cons { for (SpellEffectInfo const* effect : effectItr->second) { - // overwrite any existing effect from DIFFICULTY_NONE if (effect) { if (effect->EffectIndex >= effList.size()) @@ -3376,6 +3369,23 @@ SpellEffectInfoVector SpellInfo::GetEffectsForDifficulty(uint32 difficulty) cons difficultyEntry = sDifficultyStore.LookupEntry(difficultyEntry->FallbackDifficultyID); } + // DIFFICULTY_NONE effects are the default effects, always active if current difficulty's effects don't overwrite + SpellEffectInfoMap::const_iterator itr = _effects.find(DIFFICULTY_NONE); + if (itr != _effects.end()) + { + for (SpellEffectInfo const* effect : itr->second) + { + if (effect) + { + if (effect->EffectIndex >= effList.size()) + effList.resize(effect->EffectIndex + 1); + + if (!effList[effect->EffectIndex]) + effList[effect->EffectIndex] = effect; + } + } + } + return effList; } -- cgit v1.2.3