From 794a3e43887d3fea4bb9b1ec77a98ab596eea0be Mon Sep 17 00:00:00 2001 From: ariel- Date: Fri, 15 Dec 2017 03:40:36 -0300 Subject: Core/Auras: fixed off by one error in counting SPELL_ATTR5_START_PERIODIC_AT_APPLY ticks - Made SpellInfo::GetMaxTicks and AuraEffect::GetTotalTicks return the same number without mods (dumped arbitrary default return value of 6 and arbitrary 30 sec limit) - They should be streamlined whenever SPELL_AURA_48 is implemented (cherry picked from commit 7dff0e3246f68c39e122e6ccb93b18c29f6df130) --- src/server/game/Spells/SpellInfo.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/server/game/Spells/SpellInfo.cpp') diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 53a732c1390..38ec721e822 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -3722,13 +3722,13 @@ uint32 SpellInfo::CalcCastTime(Spell* spell /*= nullptr*/) const uint32 SpellInfo::GetMaxTicks() const { + uint32 totalTicks = 0; int32 DotDuration = GetDuration(); - if (DotDuration == 0) - return 1; for (SpellEffectInfo const* effect : _effects) { if (effect && effect->Effect == SPELL_EFFECT_APPLY_AURA) + { switch (effect->ApplyAuraName) { case SPELL_AURA_PERIODIC_DAMAGE: @@ -3745,13 +3745,19 @@ uint32 SpellInfo::GetMaxTicks() const case SPELL_AURA_PERIODIC_TRIGGER_SPELL: case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE: case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: - if (effect->ApplyAuraPeriod != 0) - return DotDuration / effect->ApplyAuraPeriod; + // skip infinite periodics + if (effect->ApplyAuraPeriod > 0 && DotDuration > 0) + { + totalTicks = static_cast(DotDuration) / effect->ApplyAuraPeriod; + if (HasAttribute(SPELL_ATTR5_START_PERIODIC_AT_APPLY)) + ++totalTicks; + } break; } + } } - return 6; + return totalTicks; } uint32 SpellInfo::GetRecoveryTime() const -- cgit v1.2.3