mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[7576] Fixed spell range check for spells with minimal distances
This commit is contained in:
parent
e65dc5747f
commit
5dd3ce31bc
5 changed files with 15 additions and 12 deletions
|
|
@ -1587,10 +1587,7 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
|
||||||
float range = GetSpellMaxRange(srange);
|
float range = GetSpellMaxRange(srange);
|
||||||
float minrange = GetSpellMinRange(srange);
|
float minrange = GetSpellMinRange(srange);
|
||||||
|
|
||||||
// DasMy: respect victims dimensions
|
float dist = GetCombatDistance(pVictim);
|
||||||
float dist = GetDistance(pVictim) - pVictim->GetFloatValue(UNIT_FIELD_COMBATREACH) - GetFloatValue(UNIT_FIELD_COMBATREACH);
|
|
||||||
if (dist < 0.0f)
|
|
||||||
dist = 0.0f;
|
|
||||||
|
|
||||||
//if(!isInFront( pVictim, range ) && spellInfo->AttributesEx )
|
//if(!isInFront( pVictim, range ) && spellInfo->AttributesEx )
|
||||||
// continue;
|
// continue;
|
||||||
|
|
@ -1638,10 +1635,7 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
|
||||||
float range = GetSpellMaxRange(srange);
|
float range = GetSpellMaxRange(srange);
|
||||||
float minrange = GetSpellMinRange(srange);
|
float minrange = GetSpellMinRange(srange);
|
||||||
|
|
||||||
// DasMy: respect victims dimensions
|
float dist = GetCombatDistance(pVictim);
|
||||||
float dist = GetDistance(pVictim) - pVictim->GetFloatValue(UNIT_FIELD_COMBATREACH) - GetFloatValue(UNIT_FIELD_COMBATREACH);
|
|
||||||
if (dist < 0.0f)
|
|
||||||
dist = 0.0f;
|
|
||||||
|
|
||||||
//if(!isInFront( pVictim, range ) && spellInfo->AttributesEx )
|
//if(!isInFront( pVictim, range ) && spellInfo->AttributesEx )
|
||||||
// continue;
|
// continue;
|
||||||
|
|
|
||||||
|
|
@ -4750,9 +4750,7 @@ SpellCastResult Spell::CheckRange(bool strict)
|
||||||
if(target && target != m_caster)
|
if(target && target != m_caster)
|
||||||
{
|
{
|
||||||
// distance from target in checks
|
// distance from target in checks
|
||||||
float dist = m_caster->GetDistance(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ()) - target->GetFloatValue(UNIT_FIELD_COMBATREACH) - m_caster->GetFloatValue(UNIT_FIELD_COMBATREACH); // DasMy: respect victims dimension
|
float dist = m_caster->GetCombatDistance(target);
|
||||||
if (dist < 0.0f)
|
|
||||||
dist = 0.0f;
|
|
||||||
|
|
||||||
if(dist > max_range)
|
if(dist > max_range)
|
||||||
return SPELL_FAILED_OUT_OF_RANGE; //0x5A;
|
return SPELL_FAILED_OUT_OF_RANGE; //0x5A;
|
||||||
|
|
|
||||||
|
|
@ -7372,6 +7372,16 @@ Unit* Unit::GetCharm() const
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Unit::GetCombatDistance( const Unit* target ) const
|
||||||
|
{
|
||||||
|
float radius = target->GetFloatValue(UNIT_FIELD_COMBATREACH) + GetFloatValue(UNIT_FIELD_COMBATREACH);
|
||||||
|
float dx = GetPositionX() - target->GetPositionX();
|
||||||
|
float dy = GetPositionY() - target->GetPositionY();
|
||||||
|
float dz = GetPositionZ() - target->GetPositionZ();
|
||||||
|
float dist = sqrt((dx*dx) + (dy*dy) + (dz*dz)) - radius;
|
||||||
|
return ( dist > 0 ? dist : 0);
|
||||||
|
}
|
||||||
|
|
||||||
void Unit::SetPet(Pet* pet)
|
void Unit::SetPet(Pet* pet)
|
||||||
{
|
{
|
||||||
SetUInt64Value(UNIT_FIELD_SUMMON, pet ? pet->GetGUID() : 0);
|
SetUInt64Value(UNIT_FIELD_SUMMON, pet ? pet->GetGUID() : 0);
|
||||||
|
|
|
||||||
|
|
@ -1113,6 +1113,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
Player* GetCharmerOrOwnerPlayerOrPlayerItself();
|
Player* GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||||
|
float GetCombatDistance( const Unit* target ) const;
|
||||||
|
|
||||||
void SetPet(Pet* pet);
|
void SetPet(Pet* pet);
|
||||||
void SetCharm(Unit* pet);
|
void SetCharm(Unit* pet);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7575"
|
#define REVISION_NR "7576"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue