Core/Auras: Fix a crash in Unit::RemoveAurasDueToSpellBySteal
This commit is contained in:
@@ -3797,30 +3797,28 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit
|
||||
newAura->SetCharges(maxCharges < newCharges ? maxCharges : newCharges);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8 newStacks = newAura->GetStackAmount() + 1;
|
||||
uint8 maxStacks = newAura->GetSpellProto()->StackAmount;
|
||||
newAura->SetStackAmount(maxStacks < newStacks ? maxStacks : newStacks);
|
||||
}
|
||||
newAura->ModStackAmount(1);
|
||||
newAura->SetDuration(dur);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isSingleTarget = aura->IsSingleTarget() && caster;
|
||||
if (isSingleTarget)
|
||||
// single target state must be removed before aura creation to preserve existing single target aura
|
||||
if (aura->IsSingleTarget())
|
||||
aura->UnregisterSingleTarget();
|
||||
newAura = Aura::TryCreate(aura->GetSpellProto(), effMask, stealer, NULL, &baseDamage[0], NULL, aura->GetCasterGUID());
|
||||
// strange but intended behaviour: Stolen single target auras won't be treated as single targeted
|
||||
if (newAura && isSingleTarget)
|
||||
|
||||
if (newAura = Aura::TryCreate(aura->GetSpellProto(), effMask, stealer, NULL, &baseDamage[0], NULL, aura->GetCasterGUID()))
|
||||
{
|
||||
aura->SetIsSingleTarget(true);
|
||||
caster->GetSingleCastAuras().push_back(aura);
|
||||
newAura->UnregisterSingleTarget();
|
||||
// created aura must not be single target aura,, so stealer won't loose it on recast
|
||||
if (newAura->IsSingleTarget())
|
||||
{
|
||||
newAura->UnregisterSingleTarget();
|
||||
// bring back single target aura status to the old aura
|
||||
aura->SetIsSingleTarget(true);
|
||||
caster->GetSingleCastAuras().push_back(aura);
|
||||
}
|
||||
newAura->SetLoadedState(dur, dur, stealCharge ? 1 : aura->GetCharges(), 1, recalculateMask, &damage[0]);
|
||||
newAura->ApplyForTargets();
|
||||
}
|
||||
if (!newAura)
|
||||
return;
|
||||
newAura->SetLoadedState(dur, dur, stealCharge ? 1 : aura->GetCharges(), 1, recalculateMask, &damage[0]);
|
||||
newAura->ApplyForTargets();
|
||||
}
|
||||
|
||||
if (stealCharge)
|
||||
|
||||
Reference in New Issue
Block a user