diff options
author | ariel- <ariel-@users.noreply.github.com> | 2017-12-15 03:40:36 -0300 |
---|---|---|
committer | ariel- <ariel-@users.noreply.github.com> | 2017-12-15 03:40:36 -0300 |
commit | 7dff0e3246f68c39e122e6ccb93b18c29f6df130 (patch) | |
tree | 116622e1b3855f425919d4158020d50507408c40 /src/server/game/Spells/SpellInfo.cpp | |
parent | 2d07d4f7b350035be50ccc39aba1ffdad09ad0b2 (diff) |
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
Diffstat (limited to 'src/server/game/Spells/SpellInfo.cpp')
-rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index e2946dbb45e..1f4cc10b4fd 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -3100,17 +3100,13 @@ uint32 SpellInfo::CalcCastTime(Spell* spell /*= nullptr*/) const uint32 SpellInfo::GetMaxTicks() const { + uint32 totalTicks = 0; int32 DotDuration = GetDuration(); - if (DotDuration == 0) - return 1; - - // 200% limit - if (DotDuration > 30000) - DotDuration = 30000; - for (uint8 x = 0; x < MAX_SPELL_EFFECTS; x++) + for (uint8 x = 0; x < MAX_SPELL_EFFECTS; ++x) { if (Effects[x].Effect == SPELL_EFFECT_APPLY_AURA) + { switch (Effects[x].ApplyAuraName) { case SPELL_AURA_PERIODIC_DAMAGE: @@ -3127,13 +3123,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 (Effects[x].Amplitude != 0) - return DotDuration / Effects[x].Amplitude; + // skip infinite periodics + if (Effects[x].Amplitude > 0 && DotDuration > 0) + { + totalTicks = static_cast<uint32>(DotDuration) / Effects[x].Amplitude; + if (HasAttribute(SPELL_ATTR5_START_PERIODIC_AT_APPLY)) + ++totalTicks; + } break; } + } } - return 6; + return totalTicks; } uint32 SpellInfo::GetRecoveryTime() const |