Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
LogicalFire.cs
Go to the documentation of this file.
2{
3 public int fireAmount => base.cell.effect?.FireAmount ?? 0;
4
6
7 public override void Update()
8 {
9 manager.refreshList.Add(this);
10 bool flag = false;
11 XY[] surrounds = Point.Surrounds;
12 for (int i = 0; i < surrounds.Length; i++)
13 {
14 XY xY = surrounds[i];
15 Point.shared.Set(x + xY.x, z + xY.y);
16 if (!Point.shared.IsValid)
17 {
18 continue;
19 }
22 {
23 continue;
24 }
26 {
28 continue;
29 }
30 if (fireAmount <= 0)
31 {
32 base.cell.effect = null;
33 continue;
34 }
35 byte b = (byte)(fireAmount - cell.fireAmount);
36 if (cell.fireAmount == 0)
37 {
38 if (fireAmount >= 2 && b >= 2)
39 {
40 if (EClass.rnd(2) == 0)
41 {
43 }
44 ModFire(-1);
45 flag = true;
46 }
47 }
48 else if (b == 1)
49 {
50 if (life < 2)
51 {
52 ModFire(-1);
53 }
54 else if (EClass.rnd(3) == 0)
55 {
57 ModFire(1);
58 flag = true;
59 }
60 }
61 else
62 {
63 if (b > 6)
64 {
65 b = 6;
66 }
67 Transfer(Point.shared, (byte)(b - 1));
68 flag = true;
69 }
70 }
71 if (fireAmount == 0)
72 {
73 base.cell.effect = null;
74 }
75 else
76 {
77 EClass._map.Burn(x, z);
78 }
79 if (!flag)
80 {
81 life--;
82 }
83 if (life < 0)
84 {
85 Kill();
86 }
87 }
88
89 public void Transfer(Point p, byte amount = 1)
90 {
91 ModFire(-amount);
92 if (!p.cell.HasFire)
93 {
94 SE.Play("fire");
95 }
96 p.ModFire(amount);
97 }
98}
Definition: Cell.cs:7
bool HasFire
Definition: Cell.cs:676
int fireAmount
Definition: Cell.cs:957
Definition: EClass.cs:5
static int rnd(int a)
Definition: EClass.cs:50
static Map _map
Definition: EClass.cs:18
override void Update()
Definition: LogicalFire.cs:7
override LogicalPointManager manager
Definition: LogicalFire.cs:5
void Transfer(Point p, byte amount=1)
Definition: LogicalFire.cs:89
int fireAmount
Definition: LogicalFire.cs:3
HashSet< Point > refreshList
LogicalPoint GetOrCreate(Point point)
virtual void Kill()
Definition: LogicalPoint.cs:22
void Burn(int x, int z, bool instant=false)
Definition: Map.cs:1396
CellEffectManager effectManager
Definition: Map.cs:89
Definition: Point.cs:9
static Point shared
Definition: Point.cs:20
Point Set(int _x, int _z)
Definition: Point.cs:479
int x
Definition: Point.cs:36
void ModFire(int value, bool extinguish=false)
Definition: Point.cs:897
int z
Definition: Point.cs:39
bool IsValid
Definition: Point.cs:88
static readonly XY[] Surrounds
Definition: Point.cs:10
Cell cell
Definition: Point.cs:51
static Map map
Definition: Point.cs:26
Definition: XY.cs:2
int y
Definition: XY.cs:5
int x
Definition: XY.cs:3