mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[10547] More correctly check delay time for spell with speed.
This commit is contained in:
parent
b236e83e70
commit
958c3ac04c
2 changed files with 13 additions and 6 deletions
|
|
@ -823,12 +823,16 @@ void Spell::AddUnitTarget(Unit* pVictim, SpellEffectIndex effIndex)
|
|||
// Calculate hit result
|
||||
target.missCondition = m_caster->SpellHitResult(pVictim, m_spellInfo, m_canReflect);
|
||||
|
||||
// spell fly from visual cast object
|
||||
WorldObject* affectiveObject = GetAffectiveCasterObject();
|
||||
|
||||
// Spell have speed - need calculate incoming time
|
||||
if (m_spellInfo->speed > 0.0f)
|
||||
if (m_spellInfo->speed > 0.0f && affectiveObject && pVictim != affectiveObject)
|
||||
{
|
||||
// calculate spell incoming interval
|
||||
float dist = m_caster->GetDistance(pVictim->GetPositionX(), pVictim->GetPositionY(), pVictim->GetPositionZ());
|
||||
if (dist < 5.0f) dist = 5.0f;
|
||||
float dist = affectiveObject->GetDistance(pVictim->GetPositionX(), pVictim->GetPositionY(), pVictim->GetPositionZ());
|
||||
if (dist < 5.0f)
|
||||
dist = 5.0f;
|
||||
target.timeDelay = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);
|
||||
|
||||
// Calculate minimum incoming time
|
||||
|
|
@ -888,11 +892,14 @@ void Spell::AddGOTarget(GameObject* pVictim, SpellEffectIndex effIndex)
|
|||
target.effectMask = (1 << effIndex);
|
||||
target.processed = false; // Effects not apply on target
|
||||
|
||||
// spell fly from visual cast object
|
||||
WorldObject* affectiveObject = GetAffectiveCasterObject();
|
||||
|
||||
// Spell have speed - need calculate incoming time
|
||||
if (m_spellInfo->speed > 0.0f)
|
||||
if (m_spellInfo->speed > 0.0f && affectiveObject && pVictim != affectiveObject)
|
||||
{
|
||||
// calculate spell incoming interval
|
||||
float dist = m_caster->GetDistance(pVictim->GetPositionX(), pVictim->GetPositionY(), pVictim->GetPositionZ());
|
||||
float dist = affectiveObject->GetDistance(pVictim->GetPositionX(), pVictim->GetPositionY(), pVictim->GetPositionZ());
|
||||
if (dist < 5.0f)
|
||||
dist = 5.0f;
|
||||
target.timeDelay = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue