Core/Spells: Fixed crash with m_delayMoment calculation for reflected spells

This commit is contained in:
Shauren
2018-03-20 23:52:52 +01:00
parent 5734788c02
commit 2e47bceafd

View File

@@ -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);
}