github
2058 of 3728 branches covered (55.2%)
Branch coverage included in aggregate %.
5 of 33 new or added lines in 2 files covered. (15.15%)
1925 existing lines in 247 files now uncovered.8568 of 12829 relevant lines covered (66.79%)
126110.59 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 |
{ |
19,372✔ |
15 |
if (map is null)
|
|
UNCOV
16
|
{ |
× |
17 |
throw new System.ArgumentNullException(nameof(map)); |
× |
18 |
} |
|
19 |
|
|
20 |
var distance = map.DistanceBetween(node, target); |
19,372✔ |
21 |
var isInSignRange = distance <= SIGN_RANGE; |
19,372✔ |
22 |
if (!isInSignRange)
|
|
23 |
{ |
19,165✔ |
24 |
return false; |
19,165✔ |
25 |
} |
|
26 |
|
|
27 |
var isVisible = map.TargetIsOnLine(node, target); |
207✔ |
28 |
if (!isVisible)
|
|
29 |
{ |
23✔ |
30 |
return false; |
23✔ |
31 |
} |
|
32 |
|
|
33 |
return true; |
184✔ |
34 |
} |
19,372✔ |
35 |
} |
|
36 |
} |