diff options
author | Shauren <shauren.trinity@gmail.com> | 2016-05-17 17:23:40 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2016-05-17 17:23:40 +0200 |
commit | 22dc8b6871cea5c1fb49f88dc61b0adeccd39abf (patch) | |
tree | b4e89ea5bf951e29d565edc921bed5b93dfe9287 | |
parent | 17118f4832d527f160dc300a52db7ba6c255bce2 (diff) |
Core/Spells: Fixed spell mod application order
Closes #10250
-rw-r--r-- | src/server/game/Entities/Player/Player.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index a2a7c7794cd..5ff09881eb3 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -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 |