Core/Auras: added support for SPELL_AURA_MOD_RANGED_HASTE stacking rules

This commit is contained in:
Ovahlord
2024-11-29 16:03:43 +01:00
parent a299b14838
commit 74c0889d64

View File

@@ -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);
}
/********************************/