13 return this.isToolRequired && this.reqLv > this.toolLv;
23 return this.pos.cell.CanHarvest();
29 public virtual bool CanReapSeed
33 return this.pos.cell.CanReapSeed();
39 public virtual BaseTaskHarvest.HarvestType harvestType
49 public virtual bool IsGrowth
59 public override bool CanPressRepeat
69 public override int LeftHand
79 public override CursorInfo CursorIcon
83 return CursorSystem.Cut;
88 public virtual string GetBaseText(
string str)
90 return base.GetText(str);
94 public override string GetTextSmall(
Card c)
96 return this.pos.cell.GetObjName();
100 public override string GetText(
string str =
"")
102 if (this.owner ==
null)
106 this.SetTarget(
EClass.pc,
null);
107 string text =
"tHarvest".lang(this.GetBaseText(str), (
EClass.pc.Tool ==
null) ?
"hand".lang() :
this.owner.Tool.NameSimple,
this.toolLv.ToString() ??
"",
null,
null);
108 text = text +
" (" + this.GetTextDifficulty() +
")";
111 text = text.TagColor(Color.gray);
126 c.things.Foreach(delegate(
Thing t)
132 task.SetTarget(c, t);
133 if (task.efficiency > best)
135 best = task.efficiency;
143 public void SetTarget(
Chara c,
Thing tool =
null)
153 string[] array =
null;
155 switch (this.harvestType)
158 if (this.pos.cell.HasBridge)
160 array = this.pos.sourceBridge.reqHarvest;
161 row = this.pos.matBridge;
165 array = this.pos.sourceFloor.reqHarvest;
166 row = this.pos.matFloor;
170 if (this.pos.HasBlock)
172 array = this.pos.sourceBlock.reqHarvest;
173 row = this.pos.matBlock;
177 array =
new string[this.pos.sourceFloor.reqHarvest.Length];
178 Array.Copy(this.pos.sourceFloor.reqHarvest, array,
this.pos.sourceFloor.reqHarvest.Length);
180 row = this.pos.matFloor;
184 array = this.pos.sourceObj.reqHarvest;
185 row = this.pos.cell.matObj;
188 array = this.target.trait.ReqHarvest.Split(
',', StringSplitOptions.None);
189 row = this.target.material;
192 if (this.target ==
null)
201 row = this.target.material;
204 this.matHardness = row.hardness;
207 this.matHardness = this.matHardness * ((this.pos.growth !=
null) ? this.pos.growth.GetHp() : this.pos.sourceObj.hp) / 100;
209 if (row.tag.Contains(
"hard"))
211 this.matHardness *= 3;
213 BaseTaskHarvest.HarvestType harvestType = this.harvestType;
216 this.matHardness *= 100;
218 this.idEle = (this.IsHarvest ? 250 :
EClass.sources.elements.alias[array[0]].id);
219 this.reqElement =
Element.Create(this.idEle, 0);
220 int num = array[1].ToInt();
221 this.reqLv = this.matHardness + num;
222 this.isToolRequired = (!this.IsHarvest && this.idEle != 250);
226 int num2 = (this.idEle == 220 || this.idEle == 225) ? this.GetToolEfficiency(tool, row) : 100;
227 this.toolLv += tool.material.hardness * num2 / 100;
228 this.toolLv = (int)(this.toolLv + (tool.encLV + tool.blessedState));
230 this.toolLv += c.Evalue(this.idEle) * 3 / 2;
235 this.efficiency = (this.toolLv + 5) * 100 / ((this.reqLv + 5) * 140 / 100);
236 if (this.efficiency < 50)
238 this.efficiency = 50;
244 else if (this.efficiency > 150)
248 else if (this.efficiency > 100)
257 if (this.harvestType ==
BaseTaskHarvest.HarvestType.Obj &&
this.IsHarvest && plantData !=
null && plantData.size > 0)
259 this.maxProgress = (int)Mathf.Clamp(Rand.Range(8f, 10f) * (
float)(100 + plantData.size * 100 + plantData.size * plantData.size * 30) / (
float)
this.efficiency, 2f, 1000f);
262 this.maxProgress = (int)Mathf.Clamp(Rand.Range(8f, 16f) * 100f / (
float)
this.efficiency, 2f, 30f);
266 public static int GetReqEle(
string _raw)
268 string[] array = _raw.Split(
',', StringSplitOptions.None);
269 return EClass.sources.elements.alias[array[0]].id;
275 int[] toolEfficiency = this.GetToolEfficiency(mat);
277 if (!t.HasElement(220, 1))
279 toolEfficiency[0] = 0;
281 if (!t.HasElement(225, 1))
283 toolEfficiency[1] = 0;
287 toolEfficiency[0] = 50 + this.owner.Evalue(261);
290 foreach (
int num2
in toolEfficiency)
303 string category = mat.category;
304 uint num = <PrivateImplementationDetails>.ComputeStringHash(category);
305 if (num <= 1237752336U)
307 if (num <= 862676408U)
309 if (num != 174734082U)
311 if (num != 270655681U)
313 if (num != 862676408U)
317 if (!(category ==
"skin"))
325 if (!(category ==
"fiber"))
332 else if (!(category ==
"soil"))
337 else if (num != 974867124U)
339 if (num != 1167392201U)
341 if (num != 1237752336U)
345 if (!(category ==
"water"))
352 if (!(category ==
"crystal"))
361 if (!(category ==
"rock"))
373 if (num <= 2585652531U)
375 if (num != 1527558748U)
377 if (num != 2226448744U)
379 if (num != 2585652531U)
383 if (!(category ==
"ore"))
390 if (!(category ==
"wood"))
397 else if (!(category ==
"gem"))
402 else if (num != 2993663101U)
404 if (num != 3683705231U)
406 if (num != 3693684870U)
410 if (!(category ==
"organic"))
418 if (!(category ==
"bone"))
431 if (!(category ==
"grass"))
464 public string GetTextDifficulty()
466 return Lang.GetList(
"skillDiff")[this.difficulty];
476 public int matHardness;
488 public int maxProgress;
491 public int efficiency;
494 public int difficulty;
497 public int effectFrame = 1;
500 public bool isToolRequired;
503 public enum HarvestType