mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
fix(Core/Spells): Periodic ticks number should not exceed the max one. (#10999)
Fixes #10876
This commit is contained in:
@@ -892,9 +892,16 @@ void AuraEffect::Update(uint32 diff, Unit* caster)
|
||||
{
|
||||
if (m_isPeriodic && (GetBase()->GetDuration() >= 0 || GetBase()->IsPassive() || GetBase()->IsPermanent()))
|
||||
{
|
||||
uint32 totalTicks = GetTotalTicks();
|
||||
|
||||
m_periodicTimer -= int32(diff);
|
||||
while (m_periodicTimer <= 0)
|
||||
{
|
||||
if (!GetBase()->IsPermanent() && (m_tickNumber + 1) > totalTicks)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
++m_tickNumber;
|
||||
|
||||
// update before tick (aura can be removed in TriggerSpell or PeriodicTick calls)
|
||||
@@ -6993,3 +7000,19 @@ void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurA
|
||||
LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: Triggering spell {} from aura {} proc", triggerSpellId, GetId());
|
||||
target->CastCustomSpell(target, triggerSpellId, &value, nullptr, nullptr, true, nullptr, this, GetCasterGUID());
|
||||
}
|
||||
|
||||
int32 AuraEffect::GetTotalTicks() const
|
||||
{
|
||||
uint32 totalTicks = 1;
|
||||
if (m_amplitude)
|
||||
{
|
||||
totalTicks = GetBase()->GetMaxDuration() / m_amplitude;
|
||||
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR5_EXTRA_INITIAL_PERIOD))
|
||||
{
|
||||
++totalTicks;
|
||||
}
|
||||
}
|
||||
|
||||
return totalTicks;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
void UpdatePeriodic(Unit* caster);
|
||||
|
||||
uint32 GetTickNumber() const { return m_tickNumber; }
|
||||
int32 GetTotalTicks() const { return m_amplitude ? (GetBase()->GetMaxDuration() / m_amplitude) : 1;}
|
||||
int32 GetTotalTicks() const;
|
||||
void ResetPeriodic(bool resetPeriodicTimer = false) { if (resetPeriodicTimer) m_periodicTimer = m_amplitude; m_tickNumber = 0;}
|
||||
void ResetTicks() { m_tickNumber = 0; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user