Hello out there ,
I tried to apply your patch, but had to find out, that SPELL_ATTR_EX2_CANT_REFLECTED is now being used in several places in code. Hence removing it is not that simple.
I would propose a solution like http://paste2.org/p/520649.
Using mSpellChainMapNext, that is already being initialized on spell-chain load (but afaik used nowhere until now in mangos-0.12), it is checked, whether a higher-rank spell exists. If this is not the case, downranking is prevented. -- Hopefully, I understood things correctly with mSpellChainMapNext :lol:
I am looking forward to your comments.
DasMy
Here again for a quick look:
fadc0020a4696443d1e995303e1b6d201f18a4fb
src/game/SpellMgr.h | 10 ++++++++++
src/game/Unit.cpp | 3 +++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index fd5bca1..c5b1d24 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -740,6 +740,16 @@ class SpellMgr
return false;
}
+ uint8 IsHighestRankOfSpell(uint32 spell) const
+ {
+ SpellChainMapNext::const_iterator itr = mSpellChainsNext.find(spell);
+
+ if (!(itr == mSpellChainsNext.end()) && (itr->second)) // the spell is in the chain list and a higher-rank spell is available
+ return false;
+ else
+ return true;
+ }
+
bool IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const;
static bool canStackSpellRanks(SpellEntry const *spellInfo);
bool IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) const;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 017a9be..de7eef4 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -2594,6 +2594,9 @@ float Unit::CalculateLevelPenalty(SpellEntry const* spellProto) const
if(spellProto->spellLevel <= 0)
return 1.0f;
+ if (sSpellMgr.IsHighestRankOfSpell(spellProto->Id))
+ return 1.0f;
+
float LvlPenalty = 0.0f;
if(spellProto->spellLevel < 20)