diff options
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 5660f8a561b..a095083d4ae 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -420,12 +420,20 @@ bool Unit::IsWithinCombatDist(Unit *obj, float dist2compare) const float dz = GetPositionZ() - obj->GetPositionZ(); float distsq = dx*dx + dy*dy + dz*dz; //not sure here, or combatreach + combatreach? - float sizefactor = GetObjectSize() + obj->GetFloatValue(UNIT_FIELD_COMBATREACH); + float sizefactor = GetFloatValue(UNIT_FIELD_COMBATREACH) + obj->GetFloatValue(UNIT_FIELD_COMBATREACH); float maxdist = dist2compare + sizefactor; return distsq < maxdist * maxdist; } +void Unit::GetRandomContactPoint( const Unit* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax ) const +{ + uint32 attacker_number = getAttackers().size(); + if(attacker_number > 0) --attacker_number; + GetNearPoint(obj,x,y,z,obj->GetFloatValue(UNIT_FIELD_COMBATREACH),distance2dMin+(distance2dMax-distance2dMin)*rand_norm() + , GetAngle(obj) + (attacker_number ? (M_PI/2 - M_PI * rand_norm()) * (float)attacker_number / GetFloatValue(UNIT_FIELD_COMBATREACH) / 3 : 0)); +} + void Unit::RemoveSpellsCausingAura(AuraType auraType) { if (auraType >= TOTAL_AURAS) return; |