aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp6
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp98
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.h21
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp5
-rw-r--r--src/server/game/Spells/SpellMgr.cpp53
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp2
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp2
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp9
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp5
11 files changed, 146 insertions, 59 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index e8e48e60729..7796a767cd8 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -14204,11 +14204,11 @@ uint32 Unit::GetRemainingPeriodicAmount(ObjectGuid caster, uint32 spellId, AuraT
{
uint32 amount = 0;
AuraEffectList const& periodicAuras = GetAuraEffectsByType(auraType);
- for (AuraEffectList::const_iterator i = periodicAuras.begin(); i != periodicAuras.end(); ++i)
+ for (AuraEffect const* aurEff : periodicAuras)
{
- if ((*i)->GetCasterGUID() != caster || (*i)->GetId() != spellId || (*i)->GetEffIndex() != effectIndex || !(*i)->GetTotalTicks())
+ if (aurEff->GetCasterGUID() != caster || aurEff->GetId() != spellId || aurEff->GetEffIndex() != effectIndex || !aurEff->GetTotalTicks())
continue;
- amount += uint32(((*i)->GetAmount() * std::max<int32>((*i)->GetTotalTicks() - int32((*i)->GetTickNumber()), 0)) / (*i)->GetTotalTicks());
+ amount += uint32((aurEff->GetAmount() * static_cast<int32>(aurEff->GetRemainingTicks())) / aurEff->GetTotalTicks());
break;
}
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 80565e1b464..5c48daa7941 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -383,7 +383,7 @@ AuraEffect::AuraEffect(Aura* base, uint8 effIndex, int32 *baseAmount, Unit* cast
m_base(base), m_spellInfo(base->GetSpellInfo()),
m_baseAmount(baseAmount ? *baseAmount : m_spellInfo->Effects[effIndex].BasePoints),
m_bonusAmount(0), m_critChance(0.0f), m_donePct(1.0f),
-m_spellmod(nullptr), m_periodicTimer(0), m_tickNumber(0), m_effIndex(effIndex),
+m_spellmod(nullptr), _periodicTimer(0), _amplitude(0), _ticksDone(0), m_effIndex(effIndex),
m_canBeRecalculated(true), m_isPeriodic(false)
{
CalculatePeriodic(caster, true, false);
@@ -499,17 +499,26 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
return amount;
}
+void AuraEffect::ResetPeriodic(bool resetPeriodicTimer /*= false*/)
+{
+ _ticksDone = 0;
+ if (resetPeriodicTimer)
+ {
+ _periodicTimer = _amplitude;
+ // Start periodic on next tick or at aura apply
+ if (!m_spellInfo->HasAttribute(SPELL_ATTR5_START_PERIODIC_AT_APPLY))
+ _periodicTimer = 0;
+ }
+}
+
void AuraEffect::CalculatePeriodic(Unit* caster, bool resetPeriodicTimer /*= true*/, bool load /*= false*/)
{
- m_amplitude = m_spellInfo->Effects[m_effIndex].Amplitude;
+ _amplitude = m_spellInfo->Effects[m_effIndex].Amplitude;
// prepare periodics
switch (GetAuraType())
{
case SPELL_AURA_OBS_MOD_POWER:
- // 3 spells have no amplitude set
- if (!m_amplitude)
- m_amplitude = 1 * IN_MILLISECONDS;
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_OBS_MOD_HEALTH:
@@ -528,50 +537,49 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool resetPeriodicTimer /*= tru
break;
}
- GetBase()->CallScriptEffectCalcPeriodicHandlers(this, m_isPeriodic, m_amplitude);
+ GetBase()->CallScriptEffectCalcPeriodicHandlers(this, m_isPeriodic, _amplitude);
if (!m_isPeriodic)
return;
Player* modOwner = caster ? caster->GetSpellModOwner() : nullptr;
// Apply casting time mods
- if (m_amplitude)
+ if (_amplitude)
{
// Apply periodic time mod
if (modOwner)
- modOwner->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME, m_amplitude);
+ modOwner->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME, _amplitude);
if (caster)
{
// Haste modifies periodic time of channeled spells
if (m_spellInfo->IsChanneled())
- caster->ModSpellDurationTime(m_spellInfo, m_amplitude);
+ caster->ModSpellDurationTime(m_spellInfo, _amplitude);
// and periodic time of auras affected by SPELL_AURA_PERIODIC_HASTE
else if (caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellInfo) || m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION))
- m_amplitude = int32(m_amplitude * caster->GetFloatValue(UNIT_MOD_CAST_SPEED));
+ _amplitude = int32(_amplitude * caster->GetFloatValue(UNIT_MOD_CAST_SPEED));
}
}
+ else // prevent infinite loop on Update
+ m_isPeriodic = false;
if (load) // aura loaded from db
{
- m_tickNumber = m_amplitude ? GetBase()->GetDuration() / m_amplitude : 0;
- m_periodicTimer = m_amplitude ? GetBase()->GetDuration() % m_amplitude : 0;
+ if (_amplitude && !GetBase()->IsPermanent())
+ {
+ uint32 elapsedTime = GetBase()->GetMaxDuration() - GetBase()->GetDuration();
+ _ticksDone = elapsedTime / uint32(_amplitude);
+ _periodicTimer = elapsedTime % uint32(_amplitude);
+ }
+
if (m_spellInfo->HasAttribute(SPELL_ATTR5_START_PERIODIC_AT_APPLY))
- ++m_tickNumber;
+ ++_ticksDone;
}
else // aura just created or reapplied
{
- m_tickNumber = 0;
-
// reset periodic timer on aura create or reapply
// we don't reset periodic timers when aura is triggered by proc
- if (resetPeriodicTimer)
- {
- m_periodicTimer = 0;
- // Start periodic on next tick or at aura apply
- if (m_amplitude && !m_spellInfo->HasAttribute(SPELL_ATTR5_START_PERIODIC_AT_APPLY))
- m_periodicTimer += m_amplitude;
- }
+ ResetPeriodic(resetPeriodicTimer);
}
}
@@ -721,7 +729,7 @@ void AuraEffect::ApplySpellMod(Unit* target, bool apply)
{
if (GetMiscValue() == SPELLMOD_ALL_EFFECTS)
{
- for (uint8 i = 0; i<MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (AuraEffect* aurEff = aura->GetEffect(i))
aurEff->RecalculateAmount();
@@ -729,17 +737,17 @@ void AuraEffect::ApplySpellMod(Unit* target, bool apply)
}
else if (GetMiscValue() == SPELLMOD_EFFECT1)
{
- if (AuraEffect* aurEff = aura->GetEffect(0))
+ if (AuraEffect* aurEff = aura->GetEffect(0))
aurEff->RecalculateAmount();
}
else if (GetMiscValue() == SPELLMOD_EFFECT2)
{
- if (AuraEffect* aurEff = aura->GetEffect(1))
+ if (AuraEffect* aurEff = aura->GetEffect(1))
aurEff->RecalculateAmount();
}
else //if (modOp == SPELLMOD_EFFECT3)
{
- if (AuraEffect* aurEff = aura->GetEffect(2))
+ if (AuraEffect* aurEff = aura->GetEffect(2))
aurEff->RecalculateAmount();
}
}
@@ -752,16 +760,18 @@ void AuraEffect::ApplySpellMod(Unit* target, bool apply)
void AuraEffect::Update(uint32 diff, Unit* caster)
{
- if (m_isPeriodic && (GetBase()->GetDuration() >=0 || GetBase()->IsPassive() || GetBase()->IsPermanent()))
+ if (m_isPeriodic && (GetBase()->GetDuration() >= 0 || GetBase()->IsPassive() || GetBase()->IsPermanent()))
{
- if (m_periodicTimer > int32(diff))
- m_periodicTimer -= diff;
- else // tick also at m_periodicTimer == 0 to prevent lost last tick in case max m_duration == (max m_periodicTimer)*N
+ _periodicTimer += diff;
+ while (_periodicTimer >= _amplitude)
{
- ++m_tickNumber;
+ _periodicTimer -= _amplitude;
+
+ if (!GetBase()->IsPermanent() && (_ticksDone + 1) > GetTotalTicks())
+ break;
+
+ ++_ticksDone;
- // update before tick (aura can be removed in TriggerSpell or PeriodicTick calls)
- m_periodicTimer += m_amplitude - diff;
UpdatePeriodic(caster);
std::vector<AuraApplication*> effectApplications;
@@ -831,7 +841,7 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
// on 2 tick - 133% (handled in 6 second)
// Apply bonus for 1 - 4 tick
- switch (m_tickNumber)
+ switch (_ticksDone)
{
case 1: // 0%
aurEff->ChangeAmount(0);
@@ -869,7 +879,7 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
if (GetSpellInfo()->SpellFamilyFlags[1] & 0x00004000)
{
// Get 0 effect aura
- if (AuraEffect* slow = GetBase()->GetEffect(0))
+ if (AuraEffect* slow = GetBase()->GetEffect(EFFECT_0))
{
int32 newAmount = slow->GetAmount() + GetAmount();
if (newAmount > 0)
@@ -919,7 +929,7 @@ void AuraEffect::SendTickImmune(Unit* target, Unit* caster) const
caster->SendSpellDamageImmune(target, m_spellInfo->Id);
}
-void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit* caster) const
+void AuraEffect::PeriodicTick(AuraApplication* aurApp, Unit* caster) const
{
bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(this, aurApp);
if (prevented)
@@ -5456,11 +5466,11 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
return;
// Negative Energy Periodic
case 46284:
- target->CastCustomSpell(triggerSpellId, SPELLVALUE_MAX_TARGETS, m_tickNumber / 10 + 1, nullptr, true, nullptr, this);
+ target->CastCustomSpell(triggerSpellId, SPELLVALUE_MAX_TARGETS, _ticksDone / 10 + 1, nullptr, true, nullptr, this);
return;
// Slime Pool (Dreadscale & Acidmaw)
case 66882:
- target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)((((float)m_tickNumber / 60) * 0.9f + 0.1f) * 10000 * 2 / 3), nullptr, true, nullptr, this);
+ target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, static_cast<int32>(((_ticksDone / 60.f) * 0.9f + 0.1f) * 10000.f * 2.f / 3.f), nullptr, true, nullptr, this);
return;
// Beacon of Light
case 53563:
@@ -5608,13 +5618,13 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
// Curse of Agony damage-per-tick calculation
if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x400) && GetSpellInfo()->SpellIconID == 544)
{
- uint32 totalTick = GetTotalTicks();
+ uint32 totalTicks = GetTotalTicks();
// 1..4 ticks, 1/2 from normal tick damage
- if (m_tickNumber <= totalTick / 3)
- damage = damage/2;
+ if (_ticksDone <= totalTicks / 3)
+ damage = damage / 2;
// 9..12 ticks, 3/2 from normal tick damage
- else if (m_tickNumber > totalTick * 2 / 3)
- damage += (damage+1)/2; // +1 prevent 0.5 damage possible lost at 1..4 ticks
+ else if (_ticksDone > totalTicks * 2 / 3)
+ damage += (damage + 1) / 2; // +1 prevent 0.5 damage possible lost at 1..4 ticks
// 5..8 ticks have normal tick damage
}
// There is a Chance to make a Soul Shard when Drain soul does damage
@@ -5640,7 +5650,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
case 72854: // Unbound Plague
case 72855: // Unbound Plague
case 72856: // Unbound Plague
- damage *= uint32(pow(1.25f, int32(m_tickNumber)));
+ damage *= uint32(pow(1.25f, int32(_ticksDone)));
break;
default:
break;
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h
index 731ad8c68ee..65d1f46d155 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.h
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.h
@@ -50,7 +50,7 @@ class TC_GAME_API AuraEffect
uint32 GetId() const { return m_spellInfo->Id; }
uint32 GetEffIndex() const { return m_effIndex; }
int32 GetBaseAmount() const { return m_baseAmount; }
- int32 GetAmplitude() const { return m_amplitude; }
+ int32 GetAmplitude() const { return _amplitude; }
int32 GetMiscValueB() const { return m_spellInfo->Effects[m_effIndex].MiscValueB; }
int32 GetMiscValue() const { return m_spellInfo->Effects[m_effIndex].MiscValue; }
@@ -58,8 +58,8 @@ class TC_GAME_API AuraEffect
int32 GetAmount() const { return m_amount; }
void SetAmount(int32 amount) { m_amount = amount; m_canBeRecalculated = false;}
- int32 GetPeriodicTimer() const { return m_periodicTimer; }
- void SetPeriodicTimer(int32 periodicTimer) { m_periodicTimer = periodicTimer; }
+ int32 GetPeriodicTimer() const { return _periodicTimer; }
+ void SetPeriodicTimer(int32 periodicTimer) { _periodicTimer = periodicTimer; }
int32 CalculateAmount(Unit* caster);
void CalculatePeriodic(Unit* caster, bool resetPeriodicTimer = true, bool load = false);
@@ -83,9 +83,11 @@ class TC_GAME_API AuraEffect
void Update(uint32 diff, Unit* caster);
void UpdatePeriodic(Unit* caster);
- uint32 GetTickNumber() const { return m_tickNumber; }
- int32 GetTotalTicks() const { return m_amplitude ? (GetBase()->GetMaxDuration() / m_amplitude) : 1;}
- void ResetPeriodic(bool resetPeriodicTimer = false) { if (resetPeriodicTimer) m_periodicTimer = m_amplitude; m_tickNumber = 0;}
+ void ResetTicks() { _ticksDone = 0; }
+ uint32 GetTickNumber() const { return _ticksDone; }
+ uint32 GetRemainingTicks() const { return GetTotalTicks() - _ticksDone; }
+ uint32 GetTotalTicks() const { return (_amplitude && !GetBase()->IsPermanent()) ? uint32(GetBase()->GetMaxDuration() / _amplitude) : uint32(0); }
+ void ResetPeriodic(bool resetPeriodicTimer = false);
bool IsPeriodic() const { return m_isPeriodic; }
void SetPeriodic(bool isPeriodic) { m_isPeriodic = isPeriodic; }
@@ -115,9 +117,10 @@ class TC_GAME_API AuraEffect
SpellModifier* m_spellmod;
- int32 m_periodicTimer;
- int32 m_amplitude;
- uint32 m_tickNumber;
+ // periodic stuff
+ int32 _periodicTimer;
+ int32 _amplitude; // time between consecutive ticks
+ uint32 _ticksDone; // ticks counter
uint8 const m_effIndex;
bool m_canBeRecalculated;
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 7c1cdc56de0..42c129899fb 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -769,6 +769,11 @@ void Aura::RefreshDuration(bool withMods)
if (m_spellInfo->ManaPerSecond || m_spellInfo->ManaPerSecondPerLevel)
m_timeCla = 1 * IN_MILLISECONDS;
+
+ // also reset periodic counters
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ if (AuraEffect* aurEff = m_effects[i])
+ aurEff->ResetTicks();
}
void Aura::RefreshTimers(bool resetPeriodicTimer)
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 26638ca7c2d..4ae414a3838 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -2885,6 +2885,59 @@ void SpellMgr::LoadSpellInfoCorrections()
{
uint32 oldMSTime = getMSTime();
+ // Some spells have no amplitude set
+ {
+ ApplySpellFix({
+ 6727, // Poison Mushroom
+ 7288, // Immolate Cumulative (TEST) (Rank 1)
+ 7291, // Food (TEST)
+ 7331, // Healing Aura (TEST) (Rank 1)
+ /*
+ 30400, // Nether Beam - Perseverance
+ Blizzlike to have it disabled? DBC says:
+ "This is currently turned off to increase performance. Enable this to make it fire more frequently."
+ */
+ 34589, // Dangerous Water
+ 52562, // Arthas Zombie Catcher
+ 57550, // Tirion Aggro
+ 65755
+ }, [](SpellInfo* spellInfo)
+ {
+ spellInfo->Effects[EFFECT_0].Amplitude = 1 * IN_MILLISECONDS;
+ });
+
+ ApplySpellFix({
+ 24707, // Food
+ 26263, // Dim Sum
+ 29055, // Refreshing Red Apple
+ 37504 // Karazhan - Chess NPC AI, action timer
+ }, [](SpellInfo* spellInfo)
+ {
+ // first effect has correct amplitude
+ spellInfo->Effects[EFFECT_1].Amplitude = spellInfo->Effects[EFFECT_0].Amplitude;
+ });
+
+ // Vomit
+ ApplySpellFix({ 43327 }, [](SpellInfo* spellInfo)
+ {
+ spellInfo->Effects[EFFECT_1].Amplitude = 1 * IN_MILLISECONDS;
+ });
+
+ // Strider Presence
+ ApplySpellFix({ 4312 }, [](SpellInfo* spellInfo)
+ {
+ spellInfo->Effects[EFFECT_0].Amplitude = 1 * IN_MILLISECONDS;
+ spellInfo->Effects[EFFECT_1].Amplitude = 1 * IN_MILLISECONDS;
+ });
+
+ // Food
+ ApplySpellFix({ 64345 }, [](SpellInfo* spellInfo)
+ {
+ spellInfo->Effects[EFFECT_0].Amplitude = 1 * IN_MILLISECONDS;
+ spellInfo->Effects[EFFECT_2].Amplitude = 1 * IN_MILLISECONDS;
+ });
+ }
+
// Spell Reflection
ApplySpellFix({ 57643 }, [](SpellInfo* spellInfo)
{
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
index 00b9392eab8..9f38ef11339 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
@@ -149,7 +149,7 @@ class spell_marwyn_shared_suffering : public SpellScriptLoader
if (Unit* caster = GetCaster())
{
- int32 remainingDamage = aurEff->GetAmount() * (aurEff->GetTotalTicks() - aurEff->GetTickNumber());
+ int32 remainingDamage = aurEff->GetAmount() * aurEff->GetRemainingTicks();
if (remainingDamage > 0)
caster->CastCustomSpell(SPELL_SHARED_SUFFERING_DISPEL, SPELLVALUE_BASE_POINT1, remainingDamage, GetTarget(), TRIGGERED_FULL_MASK);
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
index 863637ca90b..d76f9ec6990 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
@@ -197,6 +197,8 @@ class spell_grobbulus_poison_cloud : public SpellScriptLoader
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
+ if (!aurEff->GetTotalTicks())
+ return;
uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
int32 mod = int32(((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 10000 * 2 / 3);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
index 8b618c8b271..a18572992e9 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
@@ -995,7 +995,7 @@ struct npc_thorim_trashAI : public ScriptedAI
uint32 heal = 0;
Unit::AuraEffectList const& auras = target->GetAuraEffectsByType(SPELL_AURA_PERIODIC_HEAL);
for (AuraEffect const* aurEff : auras)
- heal += aurEff->GetAmount() * (aurEff->GetTotalTicks() - aurEff->GetTickNumber());
+ heal += aurEff->GetAmount() * aurEff->GetRemainingTicks();
return heal;
}
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
index 8b6785b60a8..e35db1add89 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
@@ -177,6 +177,8 @@ class spell_broggok_poison_cloud : public SpellScriptLoader
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
+ if (!aurEff->GetTotalTicks())
+ return;
uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
int32 mod = int32(((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 10000 * 2 / 3);
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index 0a4b7ae303e..1fda9d3ebf2 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -825,6 +825,12 @@ class spell_dru_innervate : public SpellScriptLoader
void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
{
+ if (!aurEff->GetTotalTicks())
+ {
+ amount = 0;
+ return;
+ }
+
if (Unit* caster = GetCaster())
amount = int32(CalculatePct(caster->GetCreatePowers(POWER_MANA), amount) / aurEff->GetTotalTicks());
else
@@ -855,6 +861,9 @@ class spell_dru_insect_swarm : public SpellScriptLoader
void CalculateAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
+ if (!aurEff->GetTotalTicks())
+ return;
+
if (Unit* caster = GetCaster())
if (AuraEffect const* relicAurEff = caster->GetAuraEffect(SPELL_DRUID_ITEM_T8_BALANCE_RELIC, EFFECT_0))
amount += relicAurEff->GetAmount() / aurEff->GetTotalTicks();
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 1b06b8c3a4a..4a95c19c628 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -1339,7 +1339,7 @@ class spell_gen_gift_of_naaru : public AuraScript
void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
{
- if (!GetCaster())
+ if (!GetCaster() || !aurEff->GetTotalTicks())
return;
float heal = 0.0f;
@@ -1410,6 +1410,9 @@ class spell_gen_lifeblood : public AuraScript
void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
{
+ if (!aurEff->GetTotalTicks())
+ return;
+
if (Unit* owner = GetUnitOwner())
amount += int32(CalculatePct(owner->GetMaxHealth(), 1.5f / aurEff->GetTotalTicks()));
}