Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Los Class Reference
Inheritance diagram for Los:
EClass

Static Public Member Functions

static int MAX (int a, int b)
 
static int ABS (int a)
 
static int ZSGN (int a)
 
static List< PointListVisible (Point p1, Point p2, int radius, Action< Point, bool > _onVisit=null)
 
static Point GetNearestNeighbor (Point p1, Point p2)
 
static Point GetRushPoint (Point p1, Point dest)
 
static bool IsVisible (Point p1, Point p2, Action< Point, bool > _onVisit=null)
 
static bool IsVisible (Card c1, Card c2)
 
static bool IsVisible (int x1, int x2, int z1, int z2, Action< Point, bool > _onVisit=null, bool returnOnBlock=true)
 
- Static Public Member Functions inherited from EClass
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Static Public Attributes

static Point p = new Point()
 
static Point originalP = new Point()
 
static Action< Point, bool > onVisit
 
- Static Public Attributes inherited from EClass
static Core core
 

Static Private Member Functions

static bool IsBlocked (int x, int z, int sx, int sz)
 

Additional Inherited Members

- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 4 of file Los.cs.

Member Function Documentation

◆ ABS()

static int Los.ABS ( int  a)
inlinestatic

Definition at line 21 of file Los.cs.

22 {
23 if (a >= 0)
24 {
25 return a;
26 }
27 return -a;
28 }

◆ GetNearestNeighbor()

static Point Los.GetNearestNeighbor ( Point  p1,
Point  p2 
)
inlinestatic

Definition at line 129 of file Los.cs.

130 {
131 Point dest = null;
132 IsVisible(p1, p2, delegate(Point p, bool blocked)
133 {
134 if (!blocked && dest == null && p2.Distance(p) == 1 && !p.HasChara)
135 {
136 dest = new Point(p);
137 }
138 });
139 return dest;
140 }
static Point p
Definition: Los.cs:6
static bool IsVisible(Point p1, Point p2, Action< Point, bool > _onVisit=null)
Definition: Los.cs:167
Definition: Point.cs:9
int Distance(Point p)
Definition: Point.cs:953
bool HasChara
Definition: Point.cs:226

References Point.Distance(), Point.HasChara, IsVisible(), and p.

◆ GetRushPoint()

static Point Los.GetRushPoint ( Point  p1,
Point  dest 
)
inlinestatic

Definition at line 142 of file Los.cs.

143 {
144 Point rushPos = null;
145 bool valid = true;
146 IsVisible(p1, dest, delegate(Point p, bool blocked)
147 {
148 if (!p.Equals(dest) && !p.Equals(p1))
149 {
150 if (blocked || p.HasChara || p.IsBlocked)
151 {
152 valid = false;
153 }
154 if (p.Distance(dest) == 1)
155 {
156 rushPos = p.Copy();
157 }
158 }
159 });
160 if (!valid)
161 {
162 return null;
163 }
164 return rushPos;
165 }
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
bool Equals(int _x, int _z)
Definition: Point.cs:924

References Point.Distance(), Point.Equals(), if(), IsVisible(), and p.

Referenced by ActRush.CanPerform(), and ActRush.Perform().

◆ IsBlocked()

static bool Los.IsBlocked ( int  x,
int  z,
int  sx,
int  sz 
)
inlinestaticprivate

Definition at line 43 of file Los.cs.

44 {
45 bool flag = false;
46 if (x < 0 || z < 0 || x >= EClass._map.Size || z >= EClass._map.Size)
47 {
48 flag = true;
49 }
50 else
51 {
52 Cell cell = EClass._map.cells[x, z];
53 byte[] weights = EClass._map.cells[x, z].weights;
54 if ((sz == -1 && weights[0] == 0) || (sz == 1 && weights[2] == 0) || (sx == 1 && weights[1] == 0) || (sx == -1 && weights[3] == 0))
55 {
56 flag = true;
57 }
58 if (!flag && sx != 0 && sz != 0)
59 {
60 if (x + sx < 0 || z + sz < 0 || x + sx >= EClass._map.Size || z + sz >= EClass._map.Size)
61 {
62 flag = true;
63 }
64 else
65 {
66 byte[] weights2 = EClass._map.cells[x + sx, z + sz].weights;
67 if ((sz < 0 && weights2[2] == 0) || (sx > 0 && weights2[3] == 0))
68 {
69 flag = true;
70 }
71 if ((sz > 0 && weights2[0] == 0) || (sx < 0 && weights2[1] == 0))
72 {
73 flag = true;
74 }
75 }
76 }
77 if (cell.blockSight)
78 {
79 flag = true;
80 }
81 }
82 p.Set(x, z);
83 if (onVisit != null)
84 {
85 onVisit(p, flag);
86 }
87 return flag;
88 }
Definition: Cell.cs:7
bool blockSight
Definition: Cell.cs:318
Definition: EClass.cs:5
static Map _map
Definition: EClass.cs:18
static Action< Point, bool > onVisit
Definition: Los.cs:10
int Size
Definition: MapBounds.cs:20
Cell[,] cells
Definition: Map.cs:85
Point Set(int _x, int _z)
Definition: Point.cs:479

References EClass._map, Cell.blockSight, Map.cells, onVisit, p, Point.Set(), MapBounds.Size, and Algorithms.WeightCell.weights.

◆ IsVisible() [1/3]

static bool Los.IsVisible ( Card  c1,
Card  c2 
)
inlinestatic

Definition at line 172 of file Los.cs.

173 {
174 return IsVisible(c1.pos.x, c2.pos.x, c1.pos.z, c2.pos.z);
175 }
Point pos
Definition: Card.cs:55
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39

References Card.pos, Point.x, and Point.z.

◆ IsVisible() [2/3]

static bool Los.IsVisible ( int  x1,
int  x2,
int  z1,
int  z2,
Action< Point, bool >  _onVisit = null,
bool  returnOnBlock = true 
)
inlinestatic

Definition at line 177 of file Los.cs.

178 {
179 onVisit = _onVisit;
180 p.Set(x1, z1);
181 originalP.Set(x1, z1);
182 int a = x2 - x1;
183 int a2 = z2 - z1;
184 int num = ABS(a) << 1;
185 int num2 = ABS(a2) << 1;
186 int num3 = ZSGN(a);
187 int num4 = ZSGN(a2);
188 int num5 = x1;
189 int num6 = z1;
190 if (num >= num2)
191 {
192 int num7 = num2 - (num >> 1);
193 while (true)
194 {
195 if (num5 == x2)
196 {
197 p.Set(num5, num6);
198 if (onVisit != null)
199 {
200 onVisit(p, arg2: false);
201 }
202 return true;
203 }
204 if (IsBlocked(num5, num6, num3, (num7 >= 0) ? num4 : 0) && returnOnBlock)
205 {
206 break;
207 }
208 if (num7 >= 0)
209 {
210 num6 += num4;
211 num7 -= num;
212 }
213 num5 += num3;
214 num7 += num2;
215 }
216 return false;
217 }
218 if (num2 >= num)
219 {
220 int num8 = num - (num2 >> 1);
221 while (true)
222 {
223 if (num6 == z2)
224 {
225 p.Set(num5, num6);
226 if (onVisit != null)
227 {
228 onVisit(p, arg2: false);
229 }
230 return true;
231 }
232 if (IsBlocked(num5, num6, (num8 >= 0) ? num3 : 0, num4) && returnOnBlock)
233 {
234 break;
235 }
236 if (num8 >= 0)
237 {
238 num5 += num3;
239 num8 -= num2;
240 }
241 num6 += num4;
242 num8 += num;
243 }
244 return false;
245 }
246 return false;
247 }
static bool IsBlocked(int x, int z, int sx, int sz)
Definition: Los.cs:43
static int ZSGN(int a)
Definition: Los.cs:30
static Point originalP
Definition: Los.cs:8
static int ABS(int a)
Definition: Los.cs:21

References Point.Set().

◆ IsVisible() [3/3]

static bool Los.IsVisible ( Point  p1,
Point  p2,
Action< Point, bool >  _onVisit = null 
)
inlinestatic

◆ ListVisible()

static List< Point > Los.ListVisible ( Point  p1,
Point  p2,
int  radius,
Action< Point, bool >  _onVisit = null 
)
inlinestatic

Definition at line 90 of file Los.cs.

91 {
92 List<Point> list = new List<Point>();
93 List<Point> vecs = new List<Point>();
94 Point lastPoint = p1.Copy();
95 IsVisible(p1.x, p2.x, p1.z, p2.z, delegate(Point p, bool blocked)
96 {
97 Point point3 = new Point(p.x - lastPoint.x, p.z - lastPoint.z);
98 if (point3.x != 0 || point3.z != 0)
99 {
100 vecs.Add(point3);
101 }
102 lastPoint.Set(p);
103 }, returnOnBlock: false);
104 if (vecs.Count == 0)
105 {
106 return list;
107 }
108 Point point = p1.Copy();
109 for (int i = 0; i < radius; i++)
110 {
111 Point point2 = vecs[i % vecs.Count];
112 point.x += point2.x;
113 point.z += point2.z;
114 }
115 IsVisible(p1.x, point.x, p1.z, point.z, delegate(Point p, bool blocked)
116 {
117 if (!blocked)
118 {
119 list.Add(p.Copy());
120 }
121 if (_onVisit != null)
122 {
123 _onVisit(p, blocked);
124 }
125 });
126 return list;
127 }
Point Copy()
Definition: Point.cs:467

References Point.Copy(), IsVisible(), p, Point.Set(), Point.x, and Point.z.

Referenced by Map.ListPointsInLine().

◆ MAX()

static int Los.MAX ( int  a,
int  b 
)
inlinestatic

Definition at line 12 of file Los.cs.

13 {
14 if (a <= b)
15 {
16 return b;
17 }
18 return a;
19 }

◆ ZSGN()

static int Los.ZSGN ( int  a)
inlinestatic

Definition at line 30 of file Los.cs.

31 {
32 if (a >= 0)
33 {
34 if (a <= 0)
35 {
36 return 0;
37 }
38 return 1;
39 }
40 return -1;
41 }

Member Data Documentation

◆ onVisit

Action<Point, bool> Los.onVisit
static

Definition at line 10 of file Los.cs.

Referenced by IsBlocked().

◆ originalP

Point Los.originalP = new Point()
static

Definition at line 8 of file Los.cs.

◆ p

Point Los.p = new Point()
static

Definition at line 6 of file Los.cs.

Referenced by GetNearestNeighbor(), GetRushPoint(), IsBlocked(), and ListVisible().


The documentation for this class was generated from the following file: