Core/Spells: Corrected aura SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK handling for auras with very high values

Port From (https://github.com/TrinityCore/TrinityCore/commit/9842ca3f4a843e97815512e84e9860737ab5db21)
This commit is contained in:
hondacrx
2020-05-19 14:07:41 -04:00
parent 4c422b2a6a
commit d8558a57ef
3 changed files with 33 additions and 1 deletions
+28
View File
@@ -3777,6 +3777,34 @@ namespace Game.Spells
Unit target = aurApp.GetTarget();
// Do not apply such auras in normal way
if (GetAmount() >= 1000)
{
if (apply)
target.SetInstantCast(true);
else
{
// only SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK can have this high amount
// it's some rare case that you have 2 auras like that, but just in case ;)
bool remove = true;
var castingSpeedNotStack = target.GetAuraEffectsByType(AuraType.ModCastingSpeedNotStack);
foreach (AuraEffect aurEff in castingSpeedNotStack)
{
if (aurEff != this && aurEff.GetAmount() >= 1000)
{
remove = false;
break;
}
}
if (remove)
target.SetInstantCast(false);
}
return;
}
target.ApplyCastTimePercentMod(GetAmount(), apply);
}