github
2073 of 3728 branches covered (55.61%)
Branch coverage included in aggregate %.
5 of 33 new or added lines in 2 files covered. (15.15%)
1893 existing lines in 244 files now uncovered.8612 of 12814 relevant lines covered (67.21%)
294447.88 hits per line
1 |
using Zilon.Core.Graphs; |
|
2 |
using Zilon.Core.Tactics.Spatial;
|
|
3 |
|
|
4 |
namespace Zilon.Bot.Players
|
|
5 |
{ |
|
6 |
public static class LogicHelper |
|
7 |
{ |
|
8 |
/// <summary>
|
|
9 |
/// Радиус обхора персонажа.
|
|
10 |
/// </summary>
|
|
11 |
private const int SIGN_RANGE = 5; |
|
12 |
|
|
13 |
public static bool CheckTargetVisible(ISectorMap map, IGraphNode node, IGraphNode target) |
|
14 |
{ |
35,274✔ |
15 |
if (map is null)
|
|
UNCOV
16
|
{ |
× |
17 |
throw new System.ArgumentNullException(nameof(map)); |
× |
18 |
} |
|
19 |
|
|
20 |
var distance = map.DistanceBetween(node, target); |
35,274✔ |
21 |
var isInSignRange = distance <= SIGN_RANGE; |
35,274✔ |
22 |
if (!isInSignRange)
|
|
23 |
{ |
34,778✔ |
24 |
return false; |
34,778✔ |
25 |
} |
|
26 |
|
|
27 |
var isVisible = map.TargetIsOnLine(node, target); |
496✔ |
28 |
if (!isVisible)
|
|
29 |
{ |
331✔ |
30 |
return false; |
331✔ |
31 |
} |
|
32 |
|
|
33 |
return true; |
165✔ |
34 |
} |
35,274✔ |
35 |
} |
|
36 |
} |