Core/Spells: Fixed spell mod application order

Closes #10250
This commit is contained in:
Shauren
2016-05-17 17:23:40 +02:00
parent 17118f4832
commit 22dc8b6871

View File

@@ -1806,7 +1806,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void AddSpellMod(SpellModifier* mod, bool apply);
bool IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod, Spell* spell = nullptr) const;
template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell = nullptr);
template <class T>
void ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* spell = nullptr);
void RemoveSpellMods(Spell* spell);
void RestoreSpellMods(Spell* spell, uint32 ownerAuraId = 0, Aura* aura = nullptr);
void RestoreAllSpellMods(uint32 ownerAuraId = 0, Aura* aura = nullptr);
@@ -2845,11 +2846,13 @@ TC_GAME_API void AddItemsSetItem(Player* player, Item* item);
TC_GAME_API void RemoveItemsSetItem(Player* player, ItemTemplate const* proto);
// "the bodies of template functions must be made available in a header file"
template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell)
template <class T>
void Player::ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* spell /*= nullptr*/)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
return 0;
return;
float totalmul = 1.0f;
int32 totalflat = 0;
@@ -2885,9 +2888,8 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas
DropModCharge(mod, spell);
}
float diff = (float)basevalue * (totalmul - 1.0f) + (float)totalflat;
basevalue = T((float)basevalue + diff);
return T(diff);
basevalue = T(float(basevalue + totalflat) * totalmul);
}
#endif