From 55c25d894ed0eb53b7aac6b15bdddf0927565165 Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 25 Oct 2008 15:46:52 -0500 Subject: [svn] Add SpellExtraInfoMap. Currently support: Limited-number-of-players spell; shared damage spell; target-in-line cone spell (e.g. dark glare). Change angle of cone spells from 120 degree to 60 degree. --HG-- branch : trunk --- src/game/Unit.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/game/Unit.cpp') diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index a601a51d4fb..3b39fdefaf5 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3448,6 +3448,15 @@ bool Unit::isInBack(Unit const* target, float distance, float arc) const return IsWithinDistInMap(target, distance) && !HasInArc( 2 * M_PI - arc, target ); } +bool Unit::isInLine(Unit const* target, float distance) const +{ + if(!HasInArc(M_PI, target) || !IsWithinDistInMap(target, distance)) return false; + float width = (GetObjectSize() / 2 + target->GetObjectSize()) / 2; + float angle = GetAngle(target); + angle -= GetOrientation(); + return abs(sin(angle)) * distance < width; +} + bool Unit::isInAccessablePlaceFor(Creature const* c) const { if(IsInWater()) -- cgit v1.2.3