aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDDuarte <dnpd.dd@gmail.com>2014-09-05 23:10:17 +0100
committerDDuarte <dnpd.dd@gmail.com>2014-09-05 23:10:17 +0100
commit9a4f062b266315c99d5d2f018abc5161b890f81f (patch)
tree7250aec1577539ec63eae8216d1f971964a6d4f3 /src
parentbbe58b2862d6bcbeadaf19687f704270d95d12c2 (diff)
Core/Players: Restore haste related code
Fixes haste rating Thanks to @roc13x (#13018) for the fix Closes #13018 Fixes #12395
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp52
1 files changed, 28 insertions, 24 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 563993fa3d8..a94b58868ee 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -5848,31 +5848,35 @@ float Player::OCTRegenMPPerSpirit()
void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply)
{
- m_baseRatingValue[cr] += (apply ? value : -value);
-
+ float oldRating = m_baseRatingValue[cr];
+ m_baseRatingValue[cr]+=(apply ? value : -value);
// explicit affected values
- float const mult = GetRatingMultiplier(cr);
- float const oldVal = m_baseRatingValue[cr] * mult;
- float const newVal = m_baseRatingValue[cr] * mult;
-
- switch (cr)
- {
- case CR_HASTE_MELEE:
- ApplyAttackTimePercentMod(BASE_ATTACK, oldVal, false);
- ApplyAttackTimePercentMod(OFF_ATTACK, oldVal, false);
- ApplyAttackTimePercentMod(BASE_ATTACK, newVal, true);
- ApplyAttackTimePercentMod(OFF_ATTACK, newVal, true);
- break;
- case CR_HASTE_RANGED:
- ApplyAttackTimePercentMod(RANGED_ATTACK, oldVal, false);
- ApplyAttackTimePercentMod(RANGED_ATTACK, newVal, true);
- break;
- case CR_HASTE_SPELL:
- ApplyCastTimePercentMod(oldVal, false);
- ApplyCastTimePercentMod(newVal, true);
- break;
- default: // shut up compiler warnings
- break;
+ if (cr == CR_HASTE_MELEE || cr == CR_HASTE_RANGED || cr == CR_HASTE_SPELL)
+ {
+ float const mult = GetRatingMultiplier(cr);
+ float const oldVal = oldRating * mult;
+ float const newVal = m_baseRatingValue[cr] * mult;
+ switch (cr)
+ {
+ case CR_HASTE_MELEE:
+ ApplyAttackTimePercentMod(BASE_ATTACK, oldVal, false);
+ ApplyAttackTimePercentMod(OFF_ATTACK, oldVal, false);
+ ApplyAttackTimePercentMod(BASE_ATTACK, newVal, true);
+ ApplyAttackTimePercentMod(OFF_ATTACK, newVal, true);
+ if (getClass() == CLASS_DEATH_KNIGHT)
+ UpdateAllRunesRegen();
+ break;
+ case CR_HASTE_RANGED:
+ ApplyAttackTimePercentMod(RANGED_ATTACK, oldVal, false);
+ ApplyAttackTimePercentMod(RANGED_ATTACK, newVal, true);
+ break;
+ case CR_HASTE_SPELL:
+ ApplyCastTimePercentMod(oldVal, false);
+ ApplyCastTimePercentMod(newVal, true);
+ break;
+ default: // shut up compiler warnings
+ break;
+ }
}
UpdateRating(cr);