diff options
| author | megamage <none@none> | 2008-10-25 15:46:52 -0500 |
|---|---|---|
| committer | megamage <none@none> | 2008-10-25 15:46:52 -0500 |
| commit | 55c25d894ed0eb53b7aac6b15bdddf0927565165 (patch) | |
| tree | e82dd51823ea72e46ec10a3f27d2b2a2cac5216d /src/game/Unit.cpp | |
| parent | 6fc23ef45ee2702dd3bba8fdd114e6535e773112 (diff) | |
[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
Diffstat (limited to 'src/game/Unit.cpp')
| -rw-r--r-- | src/game/Unit.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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()) |
