Elin Decompiled Documentation EA 23.350.1 Nightly
Loading...
Searching...
No Matches
GrowSystem Class Reference
Inheritance diagram for GrowSystem:
EClass GrowSystemCrop GrowSystemDeco GrowSystemKinoko GrowSystemPlant GrowSystemTree GrowSystemWeed GrowSystemBerry GrowSystemCactus GrowSystemCha GrowSystemWheat GrowSystemFlower GrowSystemHerb GrowSystemTreeFeywood GrowSystemTreeSingle

Classes

class  Stage
 

Public Member Functions

bool IsLastStage ()
 
virtual bool CanRotate ()
 
virtual bool BlockSight (Cell cell)
 
virtual bool BlockPass (Cell cell)
 
virtual string GetSoundProgress ()
 
virtual Stage CreateStage ()
 
void Init (SourceObj.Row _row)
 
virtual void SetGenericFirstStageTile (Stage s)
 
virtual void SetStageTile (Stage s)
 
virtual int GetStageTile ()
 
virtual int GetShadow (int index)
 
virtual void OnRenderTileMap (RenderParam p, bool drawShadow=true)
 
void SetRandomStage ()
 
void SetDefaultStage ()
 
virtual void OnSetObj ()
 
bool CanGrow (VirtualDate date)
 
void TryGrow (VirtualDate date)
 
void EqualizePlants (Point pos)
 
void Grow (int mtp=1)
 
virtual void OnReachNextStage ()
 
virtual void OnExceedLastStage ()
 
void SetStage (int idx, bool renewHarvest=false)
 
virtual void OnSetStage (int idx)
 
bool HaltGrowth ()
 
void Perish ()
 
bool IsWithered ()
 
bool CanHarvest ()
 
virtual bool CanReapSeed ()
 
virtual void OnHit (Chara c)
 
virtual void OnHitFail (Chara c)
 
void OnProgressComplete (Chara c)
 
void PopMineObj (Chara c=null)
 
virtual void OnMineObj (Chara c=null)
 
void TryPick (Cell cell, Thing t, Chara c, bool applySeed=false)
 
void TryPick (Cell cell, string idThing, int idMat=-1, int num=1, bool applySeed=false)
 
Thing TryPopSeed (Chara c)
 
void Harvest (Chara c)
 
void PopHarvest (Chara c, string idThing, int num=-1)
 
void PopHarvest (Chara c, Thing t=null, int num=-1)
 
void ApplySeed (Thing t)
 
virtual int GetHp ()
 

Public Attributes

SourceObj.Row source
 
Stage[] stages
 
int[] baseTiles
 
int harvestTile
 
int afterHarvestTile
 
string idHarvestThing
 

Static Public Attributes

const int DivStage = 30
 
static Cell cell
 
static Stage currentStage
 
- Static Public Attributes inherited from EClass
static Core core
 

Protected Member Functions

virtual bool IsHarvestStage (int idx)
 

Properties

static SourceObj.Row[] SourceSnowTree [get]
 
virtual RenderData RenderHarvest [get]
 
virtual int Step [get]
 
virtual int StageLength [get]
 
virtual int DefaultStage [get]
 
virtual int HarvestStage [get]
 
virtual int AutoMineStage [get]
 
virtual int HaltStage [get]
 
virtual bool DrawHarvestOnTop [get]
 
virtual bool UseGenericFirstStageTile [get]
 
virtual bool WitherOnLastStage [get]
 
virtual bool CanRegrow [get]
 
virtual bool CanLevelSeed [get]
 
virtual int ShadowStage [get]
 
virtual bool IsTree [get]
 
virtual bool IsCrimeToHarvest [get]
 
virtual float MtpProgress [get]
 
virtual bool NeedSunlight [get]
 
virtual bool GrowOnLand [get]
 
virtual bool GrowUndersea [get]
 
virtual AnimeID AnimeProgress [get]
 
Stage stage [get]
 
virtual bool IsMature [get]
 
- 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]
 

Static Private Attributes

static SourceObj.Row[] _sourceSnowTree
 

Additional Inherited Members

- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
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)
 

Detailed Description

Definition at line 3 of file GrowSystem.cs.

Member Function Documentation

◆ ApplySeed()

void GrowSystem.ApplySeed ( Thing  t)
inline

Definition at line 706 of file GrowSystem.cs.

707 {
710 {
711 thing = null;
712 }
713 if (thing == null)
714 {
715 return;
716 }
717 int encLv = thing.encLV / 10 + ((thing.encLV > 0) ? 1 : 0);
718 bool flag = t.IsFood || t.Evalue(10) > 0 || t.id == "grass";
719 foreach (Element value in thing.elements.dict.Values)
720 {
721 if ((!value.IsFoodTrait || flag) && (value.IsFoodTrait || value.id == 2))
722 {
723 t.elements.ModBase(value.id, value.Value / 10 * 10);
724 }
725 }
726 t.SetEncLv(encLv);
727 t.c_refText = thing.c_refText;
728 t.isCrafted = true;
729 if (thing.isDyed)
730 {
731 t.Dye(thing.DyeMat);
732 }
733 }
ElementContainerCard elements
Definition: Card.cs:42
SourceMaterial.Row DyeMat
Definition: Card.cs:1992
string c_refText
Definition: Card.cs:1669
void Dye(string idMat)
Definition: Card.cs:6478
void SetEncLv(int a)
Definition: Card.cs:4045
bool isDyed
Definition: Card.cs:461
int Evalue(int ele)
Definition: Card.cs:2704
Definition: EClass.cs:6
static Zone _zone
Definition: EClass.cs:21
static Map _map
Definition: EClass.cs:19
Dictionary< int, Element > dict
Element ModBase(int ele, int v)
int id
Definition: ELEMENT.cs:259
int Value
Definition: ELEMENT.cs:301
bool IsFoodTrait
Definition: ELEMENT.cs:373
static Cell cell
Definition: GrowSystem.cs:41
PlantData TryGetPlant(Point p)
Definition: Map.cs:2082
Thing seed
Definition: PlantData.cs:6
Definition: Thing.cs:8
virtual bool IsUserZone
Definition: Zone.cs:278

References EClass._map, EClass._zone, cell, Card.Evalue(), Element.id, Element.IsFoodTrait, Zone.IsUserZone, PlantData.seed, Map.TryGetPlant(), and Element.Value.

Referenced by PopHarvest(), and TryPick().

◆ BlockPass()

virtual bool GrowSystem.BlockPass ( Cell  cell)
inlinevirtual

Reimplemented in GrowSystemTree, and GrowSystemTreeCoralwood.

Definition at line 139 of file GrowSystem.cs.

140 {
141 return false;
142 }

◆ BlockSight()

virtual bool GrowSystem.BlockSight ( Cell  cell)
inlinevirtual

Reimplemented in GrowSystemTree, and GrowSystemTreeCoralwood.

Definition at line 134 of file GrowSystem.cs.

135 {
136 return false;
137 }

Referenced by Cell.Refresh().

◆ CanGrow()

bool GrowSystem.CanGrow ( VirtualDate  date)
inline

Definition at line 292 of file GrowSystem.cs.

293 {
294 if (source.id == 0)
295 {
296 return false;
297 }
298 if (cell.HasBlock && !cell.sourceBlock.tileType.IsFence)
299 {
300 return false;
301 }
302 if (GrowUndersea)
303 {
304 if (EClass._zone.IsUnderwater || cell.sourceSurface.tileType.IsDeepWater)
305 {
306 return true;
307 }
308 }
309 else if (EClass._zone.IsUnderwater)
310 {
311 return false;
312 }
313 if (!GrowOnLand)
314 {
315 return false;
316 }
317 if (NeedSunlight)
318 {
319 if (date.sunMap == null)
320 {
321 date.BuildSunMap();
322 }
323 if ((cell.HasRoof || date.IsWinter || EClass._map.IsIndoor) && !date.sunMap.Contains(cell.index))
324 {
325 return false;
326 }
327 }
328 return true;
329 }
SourceBlock.Row sourceBlock
Definition: Cell.cs:1090
bool HasBlock
Definition: Cell.cs:679
bool HasRoof
Definition: Cell.cs:684
int index
Definition: Cell.cs:136
SourceFloor.Row sourceSurface
Definition: Cell.cs:1097
bool IsWinter
Definition: Date.cs:192
SourceObj.Row source
Definition: GrowSystem.cs:45
virtual bool GrowOnLand
Definition: GrowSystem.cs:109
virtual bool NeedSunlight
Definition: GrowSystem.cs:107
virtual bool GrowUndersea
Definition: GrowSystem.cs:111
bool IsIndoor
Definition: Map.cs:136
void BuildSunMap()
Definition: VirtualDate.cs:54
HashSet< int > sunMap
Definition: VirtualDate.cs:9
virtual bool IsUnderwater
Definition: Zone.cs:276

References EClass._map, EClass._zone, VirtualDate.BuildSunMap(), cell, GrowOnLand, GrowUndersea, Cell.HasBlock, Cell.HasRoof, Cell.index, Map.IsIndoor, Zone.IsUnderwater, Date.IsWinter, NeedSunlight, source, Cell.sourceBlock, Cell.sourceSurface, and VirtualDate.sunMap.

Referenced by Zone.GrowPlants(), and TryGrow().

◆ CanHarvest()

bool GrowSystem.CanHarvest ( )
inline

Definition at line 525 of file GrowSystem.cs.

526 {
528 {
529 return false;
530 }
531 return true;
532 }
bool isHarvested
Definition: Cell.cs:342
Stage stage
Definition: GrowSystem.cs:115

References cell, GrowSystem.Stage.harvest, Cell.isHarvested, and stage.

Referenced by Cell.CanHarvest(), CanReapSeed(), Grow(), TaskHarvest.OnCreateProgress(), and Perish().

◆ CanReapSeed()

virtual bool GrowSystem.CanReapSeed ( )
inlinevirtual

Reimplemented in GrowSystemCha, GrowSystemDeco, GrowSystemFlower, GrowSystemHerb, GrowSystemKinoko, GrowSystemPasture, GrowSystemSeaweed, and GrowSystemWeed.

Definition at line 534 of file GrowSystem.cs.

535 {
536 return CanHarvest();
537 }
bool CanHarvest()
Definition: GrowSystem.cs:525

References CanHarvest().

Referenced by Cell.CanReapSeed().

◆ CanRotate()

virtual bool GrowSystem.CanRotate ( )
inlinevirtual

Reimplemented in GrowSystemRose.

Definition at line 129 of file GrowSystem.cs.

130 {
131 return false;
132 }

Referenced by Cell.RotateAll().

◆ CreateStage()

virtual Stage GrowSystem.CreateStage ( )
inlinevirtual

Definition at line 149 of file GrowSystem.cs.

150 {
151 return new Stage();
152 }

Referenced by Init().

◆ EqualizePlants()

void GrowSystem.EqualizePlants ( Point  pos)
inline

Definition at line 339 of file GrowSystem.cs.

340 {
342 if (p1 == null || p1.seed == null)
343 {
344 return;
345 }
346 pos.ForeachNeighbor(delegate(Point point)
347 {
348 Thing thing = EClass._map.TryGetPlant(point)?.seed;
349 if (thing == null)
350 {
351 Thing installed = point.Installed;
352 if (installed != null && installed.id == p1.seed.id)
353 {
354 thing = installed;
355 }
356 }
357 if (thing != null && p1.seed.refVal == thing.refVal && thing.encLV >= p1.seed.encLV)
358 {
359 p1.seed = thing;
360 }
361 }, diagonal: false);
362 }
@ seed
string id
Definition: Card.cs:36
int refVal
Definition: Card.cs:209
int encLV
Definition: Card.cs:329
Definition: Point.cs:9
Thing Installed
Definition: Point.cs:327
void ForeachNeighbor(Action< Point > action, bool diagonal=true)
Definition: Point.cs:1403

References EClass._map, Card.encLV, Point.ForeachNeighbor(), Card.id, installed, Point.Installed, Card.refVal, seed, PlantData.seed, and Map.TryGetPlant().

Referenced by Grow().

◆ GetHp()

virtual int GrowSystem.GetHp ( )
inlinevirtual

Reimplemented in GrowSystemTree.

Definition at line 735 of file GrowSystem.cs.

736 {
737 return source.hp;
738 }

References source.

◆ GetShadow()

virtual int GrowSystem.GetShadow ( int  index)
inlinevirtual

Reimplemented in GrowSystemTree, GrowSystemTreeCoralwood, and GrowSystemTreeSingle.

Definition at line 207 of file GrowSystem.cs.

208 {
209 return -1;
210 }

Referenced by OnRenderTileMap().

◆ GetSoundProgress()

virtual string GrowSystem.GetSoundProgress ( )
inlinevirtual

Reimplemented in GrowSystemWheat.

Definition at line 144 of file GrowSystem.cs.

145 {
146 return "Material/grass";
147 }

Referenced by TaskHarvest.OnCreateProgress().

◆ GetStageTile()

virtual int GrowSystem.GetStageTile ( )
inlinevirtual

Reimplemented in GrowSystemDeco, GrowSystemRose, GrowSystemTreeCoralwood, GrowSystemWeed, and GrowSystemWheat.

Definition at line 202 of file GrowSystem.cs.

203 {
204 return currentStage.tiles[cell.objDir % currentStage.tiles.Length];
205 }
static Stage currentStage
Definition: GrowSystem.cs:43

References currentStage, and GrowSystem.Stage.tiles.

Referenced by OnRenderTileMap().

◆ Grow()

void GrowSystem.Grow ( int  mtp = 1)
inline

Definition at line 364 of file GrowSystem.cs.

365 {
366 bool flag = cell.isWatered || (cell.IsTopWater && (source.tag.Contains("flood") || source.tag.Contains("undersea")));
367 PlantData plantData = EClass._map.TryGetPlant(cell);
368 if (plantData != null && flag)
369 {
370 plantData.water++;
371 }
372 int num = Step * mtp * ((!flag) ? 1 : 2);
373 int num2 = cell.objVal / 30;
374 int num3 = (cell.objVal + num) / 30;
375 if (num2 != num3)
376 {
378 {
379 PopHarvest(null);
380 }
382 {
383 Point point = cell.GetPoint();
384 EqualizePlants(point);
385 Thing thing = TryPopSeed(null);
386 PopMineObj();
387 if (thing != null)
388 {
389 point.SetObj();
390 EClass._zone.AddCard(thing, point).Install();
391 }
392 }
393 else if (num2 == StageLength - 1)
394 {
396 {
397 Point point2 = cell.GetPoint();
398 EqualizePlants(point2);
399 Thing thing2 = TryPopSeed(null);
400 if (thing2 != null)
401 {
402 point2.SetObj();
403 EClass._zone.AddCard(thing2, point2).Install();
404 }
405 }
406 else
407 {
409 }
410 }
411 else
412 {
414 }
415 }
416 else
417 {
418 cell.objVal += (byte)num;
419 }
420 cell.Refresh();
422 }
Card Install()
Definition: Card.cs:3922
void Refresh()
Definition: Cell.cs:1192
byte z
Definition: Cell.cs:78
byte x
Definition: Cell.cs:76
Point GetPoint()
Definition: Cell.cs:1141
static Player player
Definition: EClass.cs:13
virtual int StageLength
Definition: GrowSystem.cs:79
virtual void OnReachNextStage()
Definition: GrowSystem.cs:424
virtual int AutoMineStage
Definition: GrowSystem.cs:85
virtual int HarvestStage
Definition: GrowSystem.cs:83
void PopMineObj(Chara c=null)
Definition: GrowSystem.cs:552
void EqualizePlants(Point pos)
Definition: GrowSystem.cs:339
virtual int Step
Definition: GrowSystem.cs:77
virtual void OnExceedLastStage()
Definition: GrowSystem.cs:429
void PopHarvest(Chara c, string idThing, int num=-1)
Definition: GrowSystem.cs:649
Thing TryPopSeed(Chara c)
Definition: GrowSystem.cs:609
void RefreshFOV(int x, int z, int radius=6, bool recalculate=false)
Definition: Map.cs:1035
int water
Definition: PlantData.cs:9
bool isAutoFarming
Definition: Player.cs:1254
void SetObj(int id=0, int value=1, int dir=0)
Definition: Point.cs:934
Card AddCard(Card t, Point point)
Definition: Zone.cs:2151

References EClass._map, EClass._zone, Zone.AddCard(), AutoMineStage, CanHarvest(), cell, EqualizePlants(), Cell.GetPoint(), HarvestStage, Card.Install(), Player.isAutoFarming, OnExceedLastStage(), OnReachNextStage(), EClass.player, PopHarvest(), PopMineObj(), Cell.Refresh(), Map.RefreshFOV(), Point.SetObj(), source, StageLength, Step, Map.TryGetPlant(), TryPopSeed(), PlantData.water, Cell.x, and Cell.z.

Referenced by ActionMode.RotateUnderMouse(), and TryGrow().

◆ HaltGrowth()

bool GrowSystem.HaltGrowth ( )
inline

Definition at line 479 of file GrowSystem.cs.

480 {
481 return stage.idx == HarvestStage;
482 }

References HarvestStage.

◆ Harvest()

void GrowSystem.Harvest ( Chara  c)
inline

Definition at line 642 of file GrowSystem.cs.

643 {
644 cell.isHarvested = true;
645 cell.gatherCount = 0;
646 PopHarvest(c);
647 }

References PopHarvest().

Referenced by TaskHarvest.OnCreateProgress().

◆ Init()

void GrowSystem.Init ( SourceObj::Row  _row)
inline

Definition at line 154 of file GrowSystem.cs.

155 {
156 source = _row;
157 stages = new Stage[StageLength];
158 string[] growth = _row._growth;
159 string[] array = growth[1].Split('/');
160 baseTiles = new int[array.Length];
161 for (int i = 0; i < array.Length; i++)
162 {
163 baseTiles[i] = array[i].ToInt();
164 }
165 if (growth.Length > 2)
166 {
167 harvestTile = RenderHarvest.ConvertTile(growth[2].ToInt());
168 idHarvestThing = growth[3];
169 }
170 for (int j = 0; j < StageLength; j++)
171 {
172 Stage stage = CreateStage();
173 stages[j] = stage;
174 stage.idx = j;
175 if (j == 0 && UseGenericFirstStageTile)
176 {
178 }
179 else
180 {
182 }
183 if (harvestTile != 0 && IsHarvestStage(j))
184 {
185 stage.harvest = true;
186 }
187 }
188 }
virtual bool IsHarvestStage(int idx)
Definition: GrowSystem.cs:124
int[] baseTiles
Definition: GrowSystem.cs:49
string idHarvestThing
Definition: GrowSystem.cs:55
virtual RenderData RenderHarvest
Definition: GrowSystem.cs:75
virtual Stage CreateStage()
Definition: GrowSystem.cs:149
virtual void SetStageTile(Stage s)
Definition: GrowSystem.cs:196
virtual bool UseGenericFirstStageTile
Definition: GrowSystem.cs:91
Stage[] stages
Definition: GrowSystem.cs:47
virtual void SetGenericFirstStageTile(Stage s)
Definition: GrowSystem.cs:190
int harvestTile
Definition: GrowSystem.cs:51
int ConvertTile(int tile)
Definition: RenderData.cs:111
string[] _growth
Definition: SourceObj.cs:10

References baseTiles, RenderData.ConvertTile(), CreateStage(), harvestTile, idHarvestThing, IsHarvestStage(), RenderHarvest, SetGenericFirstStageTile(), SetStageTile(), source, stage, StageLength, stages, and UseGenericFirstStageTile.

Referenced by SourceObj.Row.OnInit().

◆ IsHarvestStage()

virtual bool GrowSystem.IsHarvestStage ( int  idx)
inlineprotectedvirtual

Definition at line 124 of file GrowSystem.cs.

125 {
126 return idx == HarvestStage;
127 }

References HarvestStage.

Referenced by Init(), and GrowSystemWheat.OnMineObj().

◆ IsLastStage()

bool GrowSystem.IsLastStage ( )
inline

Definition at line 119 of file GrowSystem.cs.

120 {
121 return stage.idx == StageLength - 1;
122 }

References StageLength.

Referenced by Cell.CanMakeStraw().

◆ IsWithered()

bool GrowSystem.IsWithered ( )
inline

Definition at line 516 of file GrowSystem.cs.

517 {
519 {
520 return true;
521 }
522 return false;
523 }
virtual bool WitherOnLastStage
Definition: GrowSystem.cs:93

References GrowSystem.Stage.idx, stage, StageLength, and WitherOnLastStage.

Referenced by OnMineObj(), GrowSystemPasture.OnMineObj(), GrowSystemSeaweed.OnMineObj(), GrowSystemWheat.OnMineObj(), and TryPopSeed().

◆ OnExceedLastStage()

virtual void GrowSystem.OnExceedLastStage ( )
inlinevirtual

Reimplemented in GrowSystemDeco, and GrowSystemKinoko.

Definition at line 429 of file GrowSystem.cs.

430 {
431 cell.objVal = (byte)(stages.Length * 30 - 1);
432 if (!CanRegrow || Rand.rnd(2) != 0)
433 {
434 return;
435 }
436 Point point = cell.GetPoint();
437 if (point.IsFarmField)
438 {
439 return;
440 }
441 if (Rand.rnd(2) == 0)
442 {
443 Point randomNeighbor = point.GetRandomNeighbor();
444 if (randomNeighbor.cell.CanGrowWeed)
445 {
446 randomNeighbor.SetObj(cell.obj);
447 point.SetObj();
448 return;
449 }
450 }
451 cell.objVal = 0;
452 cell.isHarvested = false;
453 cell.isWatered = cell.HasLiquid;
454 }
int obj
Definition: Cell.cs:50
bool HasLiquid
Definition: Cell.cs:709
bool CanGrowWeed
Definition: Cell.cs:778
virtual bool CanRegrow
Definition: GrowSystem.cs:95
bool IsFarmField
Definition: Point.cs:127
Cell cell
Definition: Point.cs:51
Point GetRandomNeighbor()
Definition: Point.cs:764
Definition: Rand.cs:4
static int rnd(int max)
Definition: Rand.cs:59

References Cell.CanGrowWeed, CanRegrow, cell, Point.cell, Cell.GetPoint(), Point.GetRandomNeighbor(), Cell.HasLiquid, Point.IsFarmField, Cell.obj, Rand.rnd(), Point.SetObj(), and stages.

Referenced by Grow().

◆ OnHit()

virtual void GrowSystem.OnHit ( Chara  c)
inlinevirtual

Definition at line 539 of file GrowSystem.cs.

540 {
541 }

◆ OnHitFail()

virtual void GrowSystem.OnHitFail ( Chara  c)
inlinevirtual

Reimplemented in GrowSystemTree.

Definition at line 543 of file GrowSystem.cs.

544 {
545 }

Referenced by TaskHarvest.OnCreateProgress().

◆ OnMineObj()

virtual void GrowSystem.OnMineObj ( Chara  c = null)
inlinevirtual

Reimplemented in GrowSystemBerry, GrowSystemCactus, GrowSystemCha, GrowSystemCrop, GrowSystemFlower, GrowSystemHerb, GrowSystemKinoko, GrowSystemPasture, GrowSystemPlant, GrowSystemSeaweed, GrowSystemTree, GrowSystemWeed, and GrowSystemWheat.

Definition at line 561 of file GrowSystem.cs.

562 {
563 if (!IsWithered())
564 {
565 int num = cell.sourceObj.components.Length - 1;
566 Thing t = ThingGen.Create(cell.sourceObj.components[num].Split('/')[0], cell.matObj_fixed.alias);
567 TryPick(cell, t, c);
568 }
569 }
SourceObj.Row sourceObj
Definition: Cell.cs:1112
SourceMaterial.Row matObj_fixed
Definition: Cell.cs:1077
void TryPick(Cell cell, Thing t, Chara c, bool applySeed=false)
Definition: GrowSystem.cs:571
bool IsWithered()
Definition: GrowSystem.cs:516
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53

References cell, ThingGen.Create(), IsWithered(), Cell.matObj_fixed, Cell.sourceObj, and TryPick().

Referenced by PopMineObj().

◆ OnProgressComplete()

void GrowSystem.OnProgressComplete ( Chara  c)
inline

Definition at line 547 of file GrowSystem.cs.

548 {
549 EClass._map.MineObj(cell.GetPoint(), null, c);
550 }
void MineObj(Point point, Task task=null, Chara c=null)
Definition: Map.cs:1980

References EClass._map, cell, Cell.GetPoint(), and Map.MineObj().

Referenced by TaskHarvest.OnCreateProgress().

◆ OnReachNextStage()

virtual void GrowSystem.OnReachNextStage ( )
inlinevirtual

Definition at line 424 of file GrowSystem.cs.

425 {
426 SetStage(cell.objVal / 30 + 1);
427 }
byte objVal
Definition: Cell.cs:68
void SetStage(int idx, bool renewHarvest=false)
Definition: GrowSystem.cs:456

References cell, Cell.objVal, and SetStage().

Referenced by Grow().

◆ OnRenderTileMap()

virtual void GrowSystem.OnRenderTileMap ( RenderParam  p,
bool  drawShadow = true 
)
inlinevirtual

Definition at line 212 of file GrowSystem.cs.

213 {
214 int num = cell.objVal / 30;
215 currentStage = stages[num];
216 SourceObj.Row row = source;
217 float y = p.y;
218 float z = p.z;
219 if (num != 0 || !UseGenericFirstStageTile)
220 {
221 p.y += row.pref.y;
222 p.z += row.pref.z;
223 }
225 {
226 if (cell.isHarvested || harvestTile == 0)
227 {
228 p.tile = ((afterHarvestTile != 0) ? afterHarvestTile : GetStageTile());
230 }
231 else
232 {
234 {
235 p.tile = GetStageTile();
237 p.liquidLv = 0;
238 }
239 p.tile = harvestTile;
241 }
242 }
243 else
244 {
245 p.tile = GetStageTile();
247 }
248 p.y = y;
249 p.z = z;
250 if (cell.obj == 118 && Core.fixedFrame % 10f == 0f && IsMature)
251 {
252 EClass.scene.psFey.transform.position = new Vector3(p.x, p.y, p.z - 2f);
253 EClass.scene.psFey.Emit(1);
254 }
255 if (drawShadow && num >= ShadowStage)
256 {
257 int shadow = GetShadow(num);
258 if (shadow == -1)
259 {
260 shadow = row.pref.shadow;
261 }
262 if (shadow > 1 && !cell.ignoreObjShadow)
263 {
265 }
266 }
267 }
BaseTileMap tileMap
MeshPass passShadow
Definition: BaseTileMap.cs:133
bool ignoreObjShadow
Definition: Cell.cs:390
Definition: Core.cs:14
static float fixedFrame
Definition: Core.cs:25
static Scene scene
Definition: EClass.cs:31
static BaseGameScreen screen
Definition: EClass.cs:33
RenderData renderData
Definition: GrowSystem.cs:13
virtual int GetStageTile()
Definition: GrowSystem.cs:202
int afterHarvestTile
Definition: GrowSystem.cs:53
virtual int GetShadow(int index)
Definition: GrowSystem.cs:207
virtual bool IsMature
Definition: GrowSystem.cs:117
virtual bool DrawHarvestOnTop
Definition: GrowSystem.cs:89
virtual int ShadowStage
Definition: GrowSystem.cs:99
void AddShadow(MeshPassParam p, ref Vector3 fix)
Definition: MeshPass.cs:195
void Draw(RenderParam p, int tile)
Definition: RenderData.cs:129
Vector3 offsetShadow
Definition: RenderData.cs:23
RenderData renderData
Definition: RenderRow.cs:71
SourcePref pref
Definition: RenderRow.cs:68
ParticleSystem psFey
Definition: Scene.cs:119
List< Item > items
Definition: ShadowData.cs:101
static ShadowData Instance
Definition: ShadowData.cs:99
int shadow
Definition: SourcePref.cs:41

References MeshPass.AddShadow(), afterHarvestTile, cell, currentStage, RenderData.Draw(), DrawHarvestOnTop, Core.fixedFrame, GetShadow(), GetStageTile(), GrowSystem.Stage.harvest, harvestTile, Cell.ignoreObjShadow, ShadowData.Instance, Cell.isHarvested, IsMature, ShadowData.items, Cell.obj, RenderData.offsetShadow, BaseTileMap.passShadow, RenderRow.pref, Scene.psFey, GrowSystem.Stage.renderData, RenderRow.renderData, RenderHarvest, EClass.scene, EClass.screen, SourcePref.shadow, ShadowStage, MeshPassParam.snow, source, stages, BaseGameScreen.tileMap, UseGenericFirstStageTile, MeshPassParam.x, MeshPassParam.y, SourcePref.y, MeshPassParam.z, and SourcePref.z.

Referenced by CardRenderer.Draw(), BaseTileMap.DrawTile(), and TileMapElona.DrawTile().

◆ OnSetObj()

virtual void GrowSystem.OnSetObj ( )
inlinevirtual

Reimplemented in GrowSystemFlower, GrowSystemTreeCoralwood, and GrowSystemWeed.

Definition at line 288 of file GrowSystem.cs.

289 {
290 }

Referenced by Map.SetObj().

◆ OnSetStage()

virtual void GrowSystem.OnSetStage ( int  idx)
inlinevirtual

Definition at line 475 of file GrowSystem.cs.

476 {
477 }

Referenced by SetStage().

◆ Perish()

void GrowSystem.Perish ( )
inline

Definition at line 484 of file GrowSystem.cs.

485 {
487 {
488 if (CanHarvest())
489 {
490 PopHarvest(null);
491 }
492 Thing thing = TryPopSeed(null);
493 if (thing != null)
494 {
496 }
498 return;
499 }
501 {
503 return;
504 }
505 if (EClass.rnd(3) == 0)
506 {
507 Thing thing2 = TryPopSeed(null);
508 if (thing2 != null)
509 {
511 }
512 }
514 }
static int rnd(long a)
Definition: EClass.cs:59
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
Definition: Map.cs:1675

References EClass._map, EClass._zone, Zone.AddCard(), CanHarvest(), cell, Cell.GetPoint(), GrowSystem.Stage.idx, Card.Install(), Player.isAutoFarming, EClass.player, PopHarvest(), EClass.rnd(), Map.SetObj(), SetStage(), stage, StageLength, TryPopSeed(), WitherOnLastStage, Cell.x, and Cell.z.

◆ PopHarvest() [1/2]

◆ PopHarvest() [2/2]

void GrowSystem.PopHarvest ( Chara  c,
Thing  t = null,
int  num = -1 
)
inline

Definition at line 654 of file GrowSystem.cs.

655 {
656 if (t == null)
657 {
658 t = ((!idHarvestThing.StartsWith('#')) ? ThingGen.Create(idHarvestThing.IsEmpty("apple")) : ThingGen.CreateFromCategory(idHarvestThing.Replace("#", "")));
659 }
660 ApplySeed(t);
661 if (cell.isObjDyed && source.ContainsTag("dyeable"))
662 {
663 t.Dye(cell.matObj);
664 }
665 PlantData plantData = EClass._map.TryGetPlant(cell);
666 bool flag = false;
667 if (plantData != null && plantData.size > 0)
668 {
669 t.c_weight = t.SelfWeight * (80 + plantData.size * plantData.size * 100) / 100;
670 t.SetBool(115, enable: true);
671 t.isWeightChanged = true;
672 flag = true;
673 }
675 if (source._growth.Length > 4)
676 {
677 int num2 = EClass.rnd(source._growth[4].ToInt()) + 1;
678 int soilCost = EClass._zone.GetSoilCost();
679 int maxSoil = EClass._zone.MaxSoil;
680 if (soilCost > maxSoil && EClass.player.stats.days >= 5)
681 {
682 num2 -= EClass.rnd(2 + (soilCost - maxSoil) / 20);
683 }
684 if (num2 <= 0)
685 {
687 {
688 c?.Say("cropSpoiled", c, cell.GetObjName());
689 }
690 return;
691 }
692 t.SetNum(num2);
693 }
694 if (num > 0)
695 {
696 t.SetNum(num);
697 }
698 int num3 = t.Num;
699 TryPick(cell, t, c);
700 if (flag)
701 {
702 c.ModExpParty(207, Mathf.Min(t.c_weight * num3 / 125, 500));
703 }
704 }
BlessedState
Definition: BlessedState.cs:2
int c_weight
Definition: Card.cs:1417
Thing SetNum(int a)
Definition: Card.cs:3676
virtual void SetBlessedState(BlessedState s)
Definition: Card.cs:4076
void ModExpParty(int ele, int a)
Definition: Card.cs:2794
int Num
Definition: Card.cs:161
void SetBool(string id, bool enable)
Definition: Card.cs:2562
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7324
SourceMaterial.Row matObj
Definition: Cell.cs:1074
string GetObjName()
Definition: Cell.cs:1676
bool isObjDyed
Definition: Cell.cs:630
void ApplySeed(Thing t)
Definition: GrowSystem.cs:706
int size
Definition: PlantData.cs:15
int days
Definition: Player.cs:75
Stats stats
Definition: Player.cs:1086
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
virtual int MaxSoil
Definition: Zone.cs:523
int GetSoilCost()
Definition: Zone.cs:4041

References EClass._map, EClass._zone, ApplySeed(), cell, ThingGen.Create(), ThingGen.CreateFromCategory(), Player.Stats.days, Cell.GetObjName(), Zone.GetSoilCost(), idHarvestThing, Player.isAutoFarming, Cell.isObjDyed, Cell.matObj, Zone.MaxSoil, Card.ModExpParty(), EClass.player, EClass.rnd(), Card.Say(), PlantData.size, source, Player.stats, Map.TryGetPlant(), and TryPick().

◆ PopMineObj()

void GrowSystem.PopMineObj ( Chara  c = null)
inline

Definition at line 552 of file GrowSystem.cs.

553 {
555 {
556 OnMineObj(c);
557 TryPopSeed(c);
558 }
559 }
static Game game
Definition: EClass.cs:9
bool disableUsermapBenefit
GamePrincipal principal
Definition: Game.cs:225
virtual void OnMineObj(Chara c=null)
Definition: GrowSystem.cs:561

References EClass._zone, GamePrincipal.disableUsermapBenefit, EClass.game, Zone.IsUserZone, OnMineObj(), Game.principal, and TryPopSeed().

Referenced by Grow(), and Map.MineObj().

◆ SetDefaultStage()

void GrowSystem.SetDefaultStage ( )
inline

Definition at line 283 of file GrowSystem.cs.

284 {
285 cell.objVal = (byte)(DefaultStage * 30);
286 }
virtual int DefaultStage
Definition: GrowSystem.cs:81

References DefaultStage.

Referenced by Recipe.Build().

◆ SetGenericFirstStageTile()

virtual void GrowSystem.SetGenericFirstStageTile ( Stage  s)
inlinevirtual

Reimplemented in GrowSystemTree.

Definition at line 190 of file GrowSystem.cs.

191 {
192 s.renderData = EClass.core.refs.renderers.objS_flat;
193 s.SetTile(0, 100, 101, 102);
194 }
RenderData objS_flat
Definition: CoreRef.cs:307
Renderers renderers
Definition: CoreRef.cs:360
CoreRef refs
Definition: Core.cs:51
static Core core
Definition: EClass.cs:7

References EClass.core, CoreRef.Renderers.objS_flat, Core.refs, CoreRef.renderers, and GrowSystem.Stage.SetTile().

Referenced by Init().

◆ SetRandomStage()

void GrowSystem.SetRandomStage ( )
inline

Definition at line 269 of file GrowSystem.cs.

270 {
271 int num = Rand.rnd(stages.Length);
272 if (num == 0 && EClass.rnd(5) != 0 && stages.Length >= 2)
273 {
274 num++;
275 }
276 else if (num == stages.Length - 1 && EClass.rnd(5) != 0 && stages.Length >= 2)
277 {
278 num--;
279 }
280 cell.objVal = (byte)(num * 30);
281 }

References Rand.rnd(), EClass.rnd(), and stages.

Referenced by BiomeProfile.ClusterObj.TryCreate().

◆ SetStage()

void GrowSystem.SetStage ( int  idx,
bool  renewHarvest = false 
)
inline

Definition at line 456 of file GrowSystem.cs.

457 {
458 cell.objVal = (byte)(idx * 30);
459 cell.gatherCount = 0;
460 if (cell.HasLiquid)
461 {
462 cell.isWatered = true;
463 }
464 if (renewHarvest)
465 {
466 cell.isHarvested = true;
467 }
468 if (cell.sourceObj.id == 118)
469 {
470 EClass._zone.dirtyElectricity = true;
471 }
472 OnSetStage(idx);
473 }
virtual void OnSetStage(int idx)
Definition: GrowSystem.cs:475

References cell, Cell.HasLiquid, OnSetStage(), and Cell.sourceObj.

Referenced by Zone.Generate(), GrowSystemDeco.OnExceedLastStage(), GrowSystemKinoko.OnExceedLastStage(), OnReachNextStage(), and Perish().

◆ SetStageTile()

virtual void GrowSystem.SetStageTile ( Stage  s)
inlinevirtual

Reimplemented in GrowSystemTree, and GrowSystemTreeSingle.

Definition at line 196 of file GrowSystem.cs.

197 {
198 s.renderData = source.renderData;
199 s.SetTile(s.idx + (UseGenericFirstStageTile ? (-1) : 0), baseTiles);
200 }

References baseTiles, GrowSystem.Stage.idx, GrowSystem.Stage.SetTile(), source, and UseGenericFirstStageTile.

Referenced by Init().

◆ TryGrow()

void GrowSystem.TryGrow ( VirtualDate  date)
inline

Definition at line 331 of file GrowSystem.cs.

332 {
333 if (CanGrow(date))
334 {
335 Grow();
336 }
337 }
void Grow(int mtp=1)
Definition: GrowSystem.cs:364
bool CanGrow(VirtualDate date)
Definition: GrowSystem.cs:292

References CanGrow(), and Grow().

Referenced by TraitFertilizer.OnSimulateHour(), and Cell.TryGrow().

◆ TryPick() [1/2]

void GrowSystem.TryPick ( Cell  cell,
string  idThing,
int  idMat = -1,
int  num = 1,
bool  applySeed = false 
)
inline

Definition at line 601 of file GrowSystem.cs.

602 {
603 if (num > 0)
604 {
605 TryPick(cell, ThingGen.Create(idThing, idMat).SetNum(num), EClass.pc, applySeed);
606 }
607 }
static Chara pc
Definition: EClass.cs:15

References cell, ThingGen.Create(), EClass.pc, Card.SetNum(), and TryPick().

◆ TryPick() [2/2]

void GrowSystem.TryPick ( Cell  cell,
Thing  t,
Chara  c,
bool  applySeed = false 
)
inline

Definition at line 571 of file GrowSystem.cs.

572 {
573 if (applySeed)
574 {
575 ApplySeed(t);
576 }
578 {
579 if (EClass.rnd(4) != 0)
580 {
581 if (t.Num > 1)
582 {
583 t.SetNum(t.Num / 2);
584 }
585 else if (EClass.rnd(2) == 0)
586 {
587 return;
588 }
590 {
592 }
593 }
594 }
595 else
596 {
598 }
599 }
Thing container_shipping
Definition: CardManager.cs:52
Card AddCard(Card c)
Definition: Card.cs:3266
CardManager cards
Definition: Game.cs:156
void TrySmoothPick(Cell cell, Thing t, Chara c)
Definition: Map.cs:1944
bool TryAddThingInSharedContainer(Thing t, List< Thing > containers=null, bool add=true, bool msg=false, Chara chara=null, bool sharedOnly=true)
Definition: Zone.cs:2308

References EClass._map, EClass._zone, Card.AddCard(), ApplySeed(), Game.cards, cell, CardManager.container_shipping, EClass.game, Player.isAutoFarming, Card.Num, EClass.player, EClass.rnd(), Card.SetNum(), Zone.TryAddThingInSharedContainer(), and Map.TrySmoothPick().

Referenced by OnMineObj(), GrowSystemBerry.OnMineObj(), GrowSystemCactus.OnMineObj(), GrowSystemCha.OnMineObj(), GrowSystemCrop.OnMineObj(), GrowSystemFlower.OnMineObj(), GrowSystemHerb.OnMineObj(), GrowSystemPlant.OnMineObj(), GrowSystemTree.OnMineObj(), GrowSystemWheat.OnMineObj(), PopHarvest(), TryPick(), and TryPopSeed().

◆ TryPopSeed()

Thing GrowSystem.TryPopSeed ( Chara  c)
inline

Definition at line 609 of file GrowSystem.cs.

610 {
611 if (source.HasTag(CTAG.seed))
612 {
614 {
615 return null;
616 }
618 {
619 return TraitSeed.MakeSeed(cell);
620 }
621 int num = (cell.IsFarmField ? 400 : 1000);
622 int soilCost = EClass._zone.GetSoilCost();
623 int maxSoil = EClass._zone.MaxSoil;
624 if (soilCost > maxSoil)
625 {
626 num += (soilCost - maxSoil) * 10;
627 }
628 if (IsWithered())
629 {
630 num /= 5;
631 }
632 if (EClass.rnd(num) < EClass.rnd(source.chance))
633 {
634 Thing thing = TraitSeed.MakeSeed(cell);
635 TryPick(cell, thing, c);
636 return thing;
637 }
638 }
639 return null;
640 }
CTAG
Definition: CTAG.cs:2
static Thing MakeSeed(string idSource)
Definition: TraitSeed.cs:105

References EClass._zone, cell, GamePrincipal.disableUsermapBenefit, EClass.game, Zone.GetSoilCost(), Player.isAutoFarming, Zone.IsUserZone, IsWithered(), TraitSeed.MakeSeed(), Zone.MaxSoil, EClass.player, Game.principal, EClass.rnd(), source, and TryPick().

Referenced by Grow(), Perish(), and PopMineObj().

Member Data Documentation

◆ _sourceSnowTree

SourceObj.Row [] GrowSystem._sourceSnowTree
staticprivate

Definition at line 37 of file GrowSystem.cs.

◆ afterHarvestTile

int GrowSystem.afterHarvestTile

Definition at line 53 of file GrowSystem.cs.

Referenced by OnRenderTileMap().

◆ baseTiles

int [] GrowSystem.baseTiles

◆ cell

◆ currentStage

Stage GrowSystem.currentStage
static

Definition at line 43 of file GrowSystem.cs.

Referenced by GetStageTile(), GrowSystemWheat.GetStageTile(), and OnRenderTileMap().

◆ DivStage

const int GrowSystem.DivStage = 30
static

Definition at line 39 of file GrowSystem.cs.

◆ harvestTile

int GrowSystem.harvestTile

Definition at line 51 of file GrowSystem.cs.

Referenced by GrowSystemWheat.GetStageTile(), Init(), and OnRenderTileMap().

◆ idHarvestThing

string GrowSystem.idHarvestThing

◆ source

◆ stages

Stage [] GrowSystem.stages

Definition at line 47 of file GrowSystem.cs.

Referenced by Init(), OnExceedLastStage(), OnRenderTileMap(), and SetRandomStage().

Property Documentation

◆ AnimeProgress

virtual AnimeID GrowSystem.AnimeProgress
get

Definition at line 113 of file GrowSystem.cs.

Referenced by TaskHarvest.OnCreateProgress().

◆ AutoMineStage

virtual int GrowSystem.AutoMineStage
get

Definition at line 85 of file GrowSystem.cs.

Referenced by Grow().

◆ CanLevelSeed

virtual bool GrowSystem.CanLevelSeed
get

Definition at line 97 of file GrowSystem.cs.

◆ CanRegrow

virtual bool GrowSystem.CanRegrow
getprotected

Definition at line 95 of file GrowSystem.cs.

Referenced by OnExceedLastStage().

◆ DefaultStage

virtual int GrowSystem.DefaultStage
get

Definition at line 81 of file GrowSystem.cs.

Referenced by SetDefaultStage().

◆ DrawHarvestOnTop

virtual bool GrowSystem.DrawHarvestOnTop
getprotected

Definition at line 89 of file GrowSystem.cs.

Referenced by OnRenderTileMap().

◆ GrowOnLand

virtual bool GrowSystem.GrowOnLand
get

Definition at line 109 of file GrowSystem.cs.

Referenced by CanGrow().

◆ GrowUndersea

virtual bool GrowSystem.GrowUndersea
get

Definition at line 111 of file GrowSystem.cs.

Referenced by CanGrow().

◆ HaltStage

virtual int GrowSystem.HaltStage
getprotected

Definition at line 87 of file GrowSystem.cs.

◆ HarvestStage

virtual int GrowSystem.HarvestStage
get

Definition at line 83 of file GrowSystem.cs.

Referenced by Grow(), HaltGrowth(), and IsHarvestStage().

◆ IsCrimeToHarvest

virtual bool GrowSystem.IsCrimeToHarvest
get

Definition at line 103 of file GrowSystem.cs.

◆ IsMature

virtual bool GrowSystem.IsMature
get

◆ IsTree

◆ MtpProgress

virtual float GrowSystem.MtpProgress
get

Definition at line 105 of file GrowSystem.cs.

◆ NeedSunlight

virtual bool GrowSystem.NeedSunlight
get

Definition at line 107 of file GrowSystem.cs.

Referenced by CanGrow(), and Zone.GrowPlants().

◆ RenderHarvest

virtual RenderData GrowSystem.RenderHarvest
get

Definition at line 75 of file GrowSystem.cs.

Referenced by Init(), and OnRenderTileMap().

◆ ShadowStage

virtual int GrowSystem.ShadowStage
get

Definition at line 99 of file GrowSystem.cs.

Referenced by OnRenderTileMap().

◆ SourceSnowTree

SourceObj.Row [] GrowSystem.SourceSnowTree
staticget

Definition at line 57 of file GrowSystem.cs.

58 {
59 get
60 {
61 object obj = _sourceSnowTree;
62 if (obj == null)
63 {
64 obj = new SourceObj.Row[2]
65 {
68 };
70 }
71 return (SourceObj.Row[])obj;
72 }
73 }
static SourceManager sources
Definition: EClass.cs:43
static SourceObj.Row[] _sourceSnowTree
Definition: GrowSystem.cs:37
SourceObj objs

◆ stage

Stage GrowSystem.stage
get

Definition at line 115 of file GrowSystem.cs.

Referenced by CanHarvest(), Zone.GrowPlants(), Init(), IsWithered(), and Perish().

◆ StageLength

virtual int GrowSystem.StageLength
get

◆ Step

virtual int GrowSystem.Step
get

Definition at line 77 of file GrowSystem.cs.

Referenced by Grow().

◆ UseGenericFirstStageTile

virtual bool GrowSystem.UseGenericFirstStageTile
getprotected

Definition at line 91 of file GrowSystem.cs.

Referenced by Init(), OnRenderTileMap(), and SetStageTile().

◆ WitherOnLastStage

virtual bool GrowSystem.WitherOnLastStage
getprotected

Definition at line 93 of file GrowSystem.cs.

Referenced by IsWithered(), and Perish().


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