aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOvahlord <dreadkiller@gmx.de>2024-11-29 16:03:43 +0100
committerOvahlord <dreadkiller@gmx.de>2024-11-29 16:03:43 +0100
commit74c0889d64e0fc3bc5bdc32f3af83825c2fe8939 (patch)
treee33a3fefd8f0a5cd8317a11727c5109b3bdaa2d7
parenta299b14838b40f964ca8c5ead292be24b650c1af (diff)
Core/Auras: added support for SPELL_AURA_MOD_RANGED_HASTE stacking rules
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 237c1071c3f..f6e90b2c6ad 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -4467,10 +4467,23 @@ void AuraEffect::HandleAuraModRangedHaste(AuraApplication const* aurApp, uint8 m
if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
- //! ToDo: Haste auras with the same handler _CAN'T_ stack together
Unit* target = aurApp->GetTarget();
+ int32 spellGroupVal = target->GetHighestExclusiveSameEffectSpellGroupValue(this, GetAuraType());
+ bool applyHasteRegenMod = GetAuraType() == SPELL_AURA_MOD_RANGED_HASTE;
- target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
+ if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
+ return;
+
+ if (spellGroupVal)
+ {
+ target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(spellGroupVal), !apply);
+ if (applyHasteRegenMod)
+ target->ApplyHasteRegenMod(float(spellGroupVal), !apply);
+ }
+ target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply);
+
+ if (applyHasteRegenMod)
+ target->ApplyHasteRegenMod(float(GetAmount()), apply);
}
/********************************/