aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2008-10-31 21:42:00 -0500
committermegamage <none@none>2008-10-31 21:42:00 -0500
commite2eb694c57885e49f37c328b899d802e1ff4ea90 (patch)
tree7259333552fadf2bd67414c70e85b3cf3bd797c0 /src/game/Unit.cpp
parent1c3d4c40c3fef1eec9d1c8438254e97cdcef063a (diff)
[svn] Improve TargetedMovement (TODO: let mob find "near angle" rather than "random angle").
Delete a repeated check in instance canenter(). Fix some spell targets. Add some sunwell spell sql. Fix Magtheridons earthquake. (TODO: need to find out why soul transfer has no effect when casted by mobs) Let Brutallus dual wield. Enable burn (still no script effect). Quick fix for shadowmoon valley illidan quest crash (wait for author's fix). --HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp10
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;