15 return EClass.sources.objs.map[this.owner.refVal];
21 public override bool CanExtendBuild
31 public override bool CanName
41 public override int DefaultStock
50 public override void OnCreate(
int lv)
53 this.owner.c_seed =
EClass.rnd(10000);
57 public override void SetName(ref
string s)
59 s =
"_of".lang(this.row.GetName(), s,
null,
null,
null);
63 public override void WriteNote(UINote n,
bool identified)
65 base.WriteNote(n, identified);
67 if (!this.row._growth.IsEmpty() &&
this.row._growth.Length >= 4)
69 if (this.row._growth.Length >= 5)
71 num = this.row._growth[4].ToInt();
73 n.AddText(
"isHarvestCrop".lang(num.ToString() ??
"",
null,
null,
null,
null), FontColor.DontChange);
75 n.AddText(
"isConsumeFertility".lang((0.1f * (
float)this.row.costSoil).ToString() ??
"",
null,
null,
null,
null), FontColor.DontChange);
76 if (this.row.tag.Contains(
"flood"))
78 n.AddText(
"isWaterCrop", FontColor.DontChange);
80 if (this.row.growth !=
null &&
this.row.growth.NeedSunlight)
82 n.AddText(
"isNeedSun", FontColor.DontChange);
87 public void TrySprout(
bool force =
false,
bool sucker =
false,
VirtualDate date =
null)
89 Point pos = this.owner.pos;
90 if (!pos.HasObj && pos.cell.CanGrow(
this.row, date ??
new VirtualDate(0)))
92 pos.SetObj(this.row.id, 1, 0);
93 EClass._map.AddPlant(pos, this.owner.Thing);
96 Zone.Suckers.Add(this.owner.Thing);
106 Thing thing = (plant !=
null) ? plant.seed :
null;
107 if (
EClass._zone.IsUserZone)
115 foreach (
Element element
in thing.elements.dict.Values)
117 if (element.IsFoodTrait)
119 thing2.elements.SetTo(element.id, element.Value);
122 thing2.SetEncLv(thing.encLV);
123 thing2.elements.SetBase(2,
EClass.curve(thing2.encLV, 50, 10, 80), 0);
124 thing2.c_refText = thing.c_refText;
125 thing2.c_seed = thing.c_seed;
126 int num = (plant !=
null) ? plant.water : 0;
127 int num2 = (plant !=
null) ? plant.fert : 0;
128 int num3 = 220 / (Mathf.Clamp(
EClass.pc.Evalue(286) - thing.LV, 0, 50) * 2 + 10 + num * 2 + ((num2 > 0) ? 20 : 0) + (
EClass.pc.HasElement(1325, 1) ? 25 : 0));
129 if (
EClass.player.isAutoFarming)
133 if (
EClass.rnd(num3) == 0)
135 int num4 = Mathf.Max(5,
EClass.pc.Evalue(286)) - thing2.encLV;
138 if (!
EClass.player.isAutoFarming)
140 Msg.Say(
"seedLvLimit", thing2,
null,
null,
null);
145 int num5 = Mathf.Clamp(
EClass.rnd(num4) - 5, 1,
EClass.player.isAutoFarming ? 3 : 10);
147 EClass.pc.PlaySound(
"seed_level", 1f,
true);
152 thing2.SetBlessedState(BlessedState.Normal);
159 for (
int i = 0; i < num; i++)
161 if (obj ==
null || obj.objType ==
"crop")
169 Rand.SetSeed(t.c_seed);
178 public static Thing MakeSeed(
string idSource)
184 public static Thing ApplySeed(
Thing t,
int refval)
188 if (row !=
null && row.vals.Length != 0)
190 t.idSkin = row.vals[0].ToInt();
204 public static Thing MakeRandomSeed(
bool enc =
false)
208 TraitSeed.ApplySeed(thing, randomSeedObj.id);
217 TraitSeed.listSeeds = (from s in EClass.sources.objs.rows
218 where s.HasTag(CTAG.seed) && !s.HasTag(CTAG.rareSeed)