aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2016-05-17 17:23:40 +0200
committerShauren <shauren.trinity@gmail.com>2016-05-17 17:25:28 +0200
commit804bfb1f10b316409cf0c97f6532c8fc8a00c857 (patch)
tree4f01bb3f009c13a9a075aadaf54799269a3fc1c0 /src
parentab2466ac011dde5d728d2a75983c292eaebff4cd (diff)
Core/Spells: Fixed spell mod application order
Closes #10250 (cherry picked from commit 22dc8b6871cea5c1fb49f88dc61b0adeccd39abf)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.h14
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 372a49b4f9d..6a38cd3b9fe 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1596,7 +1596,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);
@@ -2604,11 +2605,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;
@@ -2644,9 +2647,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