mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +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
|
|
@ -7372,6 +7372,16 @@ Unit* Unit::GetCharm() const
|
|||
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)
|
||||
{
|
||||
SetUInt64Value(UNIT_FIELD_SUMMON, pet ? pet->GetGUID() : 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue