21 Card held = chara.held;
22 obj = ((held !=
null) ? held.trait :
null);
29 public override bool CanPerform()
31 return TaskWater.ShouldWater(
Act.TP) && this.IsWaterCanValid(
false);
35 public override bool CanManualCancel()
41 public override IEnumerable<
AIAct.Status> Run()
43 this.dest =
new Point(this.dest);
44 List<Point> list = this.ListPoints();
52 list.Sort((
Point a,
Point b) => a.Distance(
this.dest) - b.Distance(
this.dest));
58 if (!this.IsWaterCanValid(
true))
60 yield
return this.Cancel();
62 CS$<>8__locals1.fail =
false;
63 yield
return base.DoGoto(p, 1,
false, delegate()
65 CS$<>8__locals1.fail =
true;
66 return AIAct.Status.Running;
68 if (!CS$<>8__locals1.fail)
70 if (!this.IsWaterCanValid(
true))
72 yield
return this.Cancel();
76 if (this.owner.Dist(
this.dest) > 1)
78 yield
return this.Cancel();
80 p.cell.isWatered =
true;
81 if (!p.cell.blocked &&
EClass.rnd(5) == 0)
83 EClass._map.SetLiquid(p.x, p.z, 1, 1);
85 this.owner.PlaySound(
"water_farm", 1f,
true);
86 this.owner.Say(
"water_farm", this.owner, p.cell.GetFloorName(),
null);
87 this.waterCan.owner.ModCharge(-1,
false);
88 this.owner.ModExp(286, 15);
89 if (!this.IsWaterCanValid(
true))
91 yield
return this.Cancel();
93 yield
return base.KeepRunning();
94 CS$<>8__locals1 =
null;
104 public static bool ShouldWater(
Point p)
107 if (cell.isWatered || cell.IsTopWater || cell.IsSnowTile || !p.IsFarmField)
111 if (p.cell.detail !=
null)
113 using (List<Thing>.Enumerator enumerator = p.Things.GetEnumerator())
115 while (enumerator.MoveNext())
117 if (enumerator.Current.trait is
TraitSeed)
124 return p.growth !=
null;
128 public bool IsWaterCanValid(
bool msg =
true)
130 bool flag = this.waterCan !=
null && this.waterCan.owner.c_charges > 0;
133 Msg.Say(
"water_deplete");
139 public List<Point> ListPoints()
141 List<Point> list =
new List<Point>();