mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-26 03:42:37 +01:00
Core/Spells: Fixed crash with m_delayMoment calculation for reflected spells
This commit is contained in:
@@ -2182,10 +2182,6 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*=
|
||||
targetInfo.timeDelay = uint64(std::floor(dist / m_spellInfo->Speed * 1000.0f));
|
||||
else
|
||||
targetInfo.timeDelay = uint64(m_spellInfo->Speed * 1000.0f);
|
||||
|
||||
// Calculate minimum incoming time
|
||||
if (!m_delayMoment || m_delayMoment > targetInfo.timeDelay)
|
||||
m_delayMoment = targetInfo.timeDelay;
|
||||
}
|
||||
else
|
||||
targetInfo.timeDelay = 0ULL;
|
||||
@@ -2205,6 +2201,10 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*=
|
||||
else
|
||||
targetInfo.reflectResult = SPELL_MISS_NONE;
|
||||
|
||||
// Calculate minimum incoming time
|
||||
if (targetInfo.timeDelay && (!m_delayMoment || m_delayMoment > targetInfo.timeDelay))
|
||||
m_delayMoment = targetInfo.timeDelay;
|
||||
|
||||
// Add target to list
|
||||
m_UniqueTargetInfo.push_back(targetInfo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user