mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 16:37:00 +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
|
// Calculate hit result
|
||||||
target.missCondition = m_caster->SpellHitResult(pVictim, m_spellInfo, m_canReflect);
|
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
|
// 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
|
// 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;
|
if (dist < 5.0f)
|
||||||
|
dist = 5.0f;
|
||||||
target.timeDelay = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);
|
target.timeDelay = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);
|
||||||
|
|
||||||
// Calculate minimum incoming time
|
// Calculate minimum incoming time
|
||||||
|
|
@ -888,11 +892,14 @@ void Spell::AddGOTarget(GameObject* pVictim, SpellEffectIndex effIndex)
|
||||||
target.effectMask = (1 << effIndex);
|
target.effectMask = (1 << effIndex);
|
||||||
target.processed = false; // Effects not apply on target
|
target.processed = false; // Effects not apply on target
|
||||||
|
|
||||||
|
// spell fly from visual cast object
|
||||||
|
WorldObject* affectiveObject = GetAffectiveCasterObject();
|
||||||
|
|
||||||
// Spell have speed - need calculate incoming time
|
// 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
|
// 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)
|
if (dist < 5.0f)
|
||||||
dist = 5.0f;
|
dist = 5.0f;
|
||||||
target.timeDelay = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);
|
target.timeDelay = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10546"
|
#define REVISION_NR "10547"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue