Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
GrowSystemTree.cs
Go to the documentation of this file.
1using UnityEngine;
2
4{
5 public static int[] shadows = new int[8] { 31, 31, 32, 33, 34, 1, 1, 1 };
6
8
9 public override int Step => 3;
10
11 public override int StageLength => 6;
12
13 public override float MtpProgress
14 {
15 get
16 {
17 if (!Bud && !Baby)
18 {
19 if (!Grown)
20 {
21 if (!Mature)
22 {
23 return 1f;
24 }
25 return 3f;
26 }
27 return 2f;
28 }
29 return 0.5f;
30 }
31 }
32
33 public override int HarvestStage => 4;
34
35 protected override bool DrawHarvestOnTop => true;
36
37 public override bool IsMature
38 {
39 get
40 {
41 if (!Grown)
42 {
43 return Mature;
44 }
45 return true;
46 }
47 }
48
49 public override bool IsTree => true;
50
51 public override int ShadowStage => 0;
52
53 public bool Bud => base.stage.idx == 0;
54
55 public bool Baby => base.stage.idx == 1;
56
57 public bool Young => base.stage.idx == 2;
58
59 public bool Grown => base.stage.idx == 3;
60
61 public bool Mature => base.stage.idx == 4;
62
63 public bool Withered => base.stage.idx == 5;
64
65 public bool IsPalulu => source.id == 17;
66
67 public bool IsBamboo => source.id == 103;
68
69 protected override bool UseGenericFirstStageTile => false;
70
71 public override bool BlockPass(Cell cell)
72 {
73 return cell.objVal / 30 > 1;
74 }
75
76 public override bool BlockSight(Cell cell)
77 {
78 return cell.objVal / 30 > 2;
79 }
80
81 public override int GetShadow(int index)
82 {
83 if (source.id == 103)
84 {
85 return source.pref.shadow;
86 }
87 return shadows[index];
88 }
89
90 public override void SetGenericFirstStageTile(Stage s)
91 {
92 s.renderData = EClass.core.refs.renderers.objS_flat;
93 s.SetTile(0, 103);
94 }
95
96 public override void SetStageTile(Stage s)
97 {
98 s.renderData = source.renderData;
99 s.SetTile(s.idx + ((s.idx != 0) ? (-1) : 0), baseTiles);
100 }
101
102 public override void OnHitFail(Chara c)
103 {
104 if (c != null && (Young || Grown || Mature || Withered))
105 {
106 Chara chara = CharaGen.Create("putty");
107 EClass._zone.AddCard(chara, GrowSystem.cell.GetPoint().GetNearestPoint(allowBlock: false, allowChara: false));
108 chara.renderer.PlayAnime(AnimeID.Fall, force: true);
109 c.Say("mobFromTree", chara);
110 }
111 }
112
113 public override int GetHp()
114 {
115 if (base.stage.idx > HarvestStage)
116 {
117 return (int)((float)base.GetHp() * 1.5f);
118 }
119 return (int)((float)base.GetHp() * 0.5f);
120 }
121
122 public int GetPlantBonus(PlantData plant)
123 {
124 if (plant == null || plant.seed == null || EClass._zone.IsUserZone)
125 {
126 return 0;
127 }
128 int num = plant.seed.encLV / 10;
129 if (EClass.rnd(10) > plant.seed.encLV % 10)
130 {
131 num++;
132 }
133 return Mathf.Min(EClass.rnd(num + 1), 4);
134 }
135
136 public override void OnMineObj(Chara c = null)
137 {
138 Point point = GrowSystem.cell.GetPoint();
139 int id = GrowSystem.cell.matObj_fixed.id;
141 if (Bud || Baby)
142 {
143 if (EClass.rnd(2) == 0 || IsPalulu)
144 {
145 TryPick(GrowSystem.cell, IsPalulu ? "leaf_palulu" : "leaf");
146 }
147 if (IsBamboo)
148 {
149 PopHarvest(c, "bamboo_shoot");
150 }
151 TryPick(GrowSystem.cell, "branch", id, 1 + PlantBonus());
152 return;
153 }
154 if (Young)
155 {
156 if (IsBamboo)
157 {
158 PopHarvest(c, "bamboo_shoot");
159 }
160 TryPick(GrowSystem.cell, "branch", id, 2 + PlantBonus());
161 if (IsPalulu)
162 {
163 TryPick(GrowSystem.cell, "leaf_palulu");
164 }
165 TryPick(GrowSystem.cell, "log", id, EClass.rnd(2) + PlantBonus() / 2, applySeed: true);
166 return;
167 }
168 if (Grown || Mature)
169 {
170 TryPick(GrowSystem.cell, IsPalulu ? "leaf_palulu" : "bark", -1, 1 + PlantBonus() / 2);
171 TryPick(GrowSystem.cell, "log", id, 1 + EClass.rnd(3) + PlantBonus(), applySeed: true);
172 TryPick(GrowSystem.cell, "resin", -1, 1 + PlantBonus() / 2);
174 {
175 if (EClass.rnd(500) == 0)
176 {
177 TryPick(GrowSystem.cell, "throw_putit");
178 }
179 if (point.IsFarmField)
180 {
182 }
183 }
184 return;
185 }
186 TryPick(GrowSystem.cell, "bark", -1, EClass.rnd(3) + PlantBonus());
187 TryPick(GrowSystem.cell, "resin", -1, 1 + PlantBonus() / 2);
189 {
191 if (EClass.rnd(100) == 0)
192 {
193 TryPick(GrowSystem.cell, "throw_putit");
194 }
195 }
196 int PlantBonus()
197 {
198 return GetPlantBonus(plant);
199 }
200 }
201}
AnimeID
Definition: AnimeID.cs:2
void PlayAnime(AnimeID id, bool force)
Thing SetNum(int a)
Definition: Card.cs:3242
int encLV
Definition: Card.cs:310
CardRenderer renderer
Definition: Card.cs:57
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6046
Definition: Cell.cs:7
SourceObj.Row sourceObj
Definition: Cell.cs:1072
Point GetPoint()
Definition: Cell.cs:1101
SourceMaterial.Row matObj_fixed
Definition: Cell.cs:1039
static Chara Create(string id, int lv=-1)
Definition: CharaGen.cs:17
Definition: Chara.cs:10
RenderData objL_harvest
Definition: CoreRef.cs:300
RenderData objS_flat
Definition: CoreRef.cs:298
Renderers renderers
Definition: CoreRef.cs:341
CoreRef refs
Definition: Core.cs:51
Definition: EClass.cs:5
static int rnd(int a)
Definition: EClass.cs:50
static Core core
Definition: EClass.cs:6
static Zone _zone
Definition: EClass.cs:20
static Map _map
Definition: EClass.cs:18
static Player player
Definition: EClass.cs:12
override RenderData RenderHarvest
override bool IsTree
override int ShadowStage
override bool BlockPass(Cell cell)
override void SetGenericFirstStageTile(Stage s)
override int GetHp()
override bool UseGenericFirstStageTile
override int HarvestStage
override void SetStageTile(Stage s)
static int[] shadows
override int Step
override int GetShadow(int index)
override bool IsMature
int GetPlantBonus(PlantData plant)
override float MtpProgress
override bool DrawHarvestOnTop
override int StageLength
override void OnHitFail(Chara c)
override void OnMineObj(Chara c=null)
override bool BlockSight(Cell cell)
void SetTile(int _tile)
Definition: GrowSystem.cs:17
void TryPick(Cell cell, Thing t, Chara c, bool applySeed=false)
Definition: GrowSystem.cs:528
int[] baseTiles
Definition: GrowSystem.cs:53
SourceObj.Row source
Definition: GrowSystem.cs:49
void PopHarvest(Chara c, string idThing, int num=-1)
Definition: GrowSystem.cs:606
static Cell cell
Definition: GrowSystem.cs:45
PlantData TryGetPlant(Point p)
Definition: Map.cs:1920
Thing seed
Definition: PlantData.cs:6
bool isAutoFarming
Definition: Player.cs:982
Definition: Point.cs:9
bool IsFarmField
Definition: Point.cs:127
SourceObj.Row sourceObj
Definition: Point.cs:69
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false)
Definition: Point.cs:595
static Thing MakeSeed(SourceObj.Row obj, PlantData plant=null)
Definition: TraitSeed.cs:77
virtual bool IsUserZone
Definition: Zone.cs:264
Card AddCard(Card t, Point point)
Definition: Zone.cs:1893