protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; Plant plant; if (!this.TryFindRandomBlightablePlant(map, out plant)) { return(false); } Room room = plant.GetRoom(RegionType.Set_Passable); plant.CropBlighted(); int i = 0; int num = GenRadial.NumCellsInRadius(15f); while (i < num) { IntVec3 intVec = plant.Position + GenRadial.RadialPattern[i]; if (intVec.InBounds(map) && intVec.GetRoom(map, RegionType.Set_Passable) == room) { Plant firstBlightableNowPlant = BlightUtility.GetFirstBlightableNowPlant(intVec, map); if (firstBlightableNowPlant != null && firstBlightableNowPlant != plant) { if (Rand.Chance(0.4f * this.BlightChanceFactor(firstBlightableNowPlant.Position, plant.Position))) { firstBlightableNowPlant.CropBlighted(); } } } i++; } Find.LetterStack.ReceiveLetter("LetterLabelCropBlight".Translate(), "LetterCropBlight".Translate(), LetterDefOf.NegativeEvent, new TargetInfo(plant.Position, map, false), null, null); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; float num = RadiusFactorPerPointsCurve.Evaluate(parms.points); if (!TryFindRandomBlightablePlant(map, out Plant plant)) { return(false); } Room room = plant.GetRoom(); int i = 0; for (int num2 = GenRadial.NumCellsInRadius(11f * num); i < num2; i++) { IntVec3 intVec = plant.Position + GenRadial.RadialPattern[i]; if (intVec.InBounds(map) && intVec.GetRoom(map) == room) { Plant firstBlightableNowPlant = BlightUtility.GetFirstBlightableNowPlant(intVec, map); if (firstBlightableNowPlant != null && firstBlightableNowPlant.def == plant.def && Rand.Chance(BlightChance(firstBlightableNowPlant.Position, plant.Position, num))) { firstBlightableNowPlant.CropBlighted(); } } } SendStandardLetter("LetterLabelCropBlight".Translate(new NamedArgument(plant.def, "PLANTDEF")), "LetterCropBlight".Translate(new NamedArgument(plant.def, "PLANTDEF")), LetterDefOf.NegativeEvent, parms, new TargetInfo(plant.Position, map)); return(true); }
public void TryReproduceNow() { GenRadial.ProcessEquidistantCells(base.Position, 4f, delegate(List <IntVec3> cells) { if (cells.Where((IntVec3 x) => BlightUtility.GetFirstBlightableNowPlant(x, base.Map) != null).TryRandomElement(out IntVec3 result)) { BlightUtility.GetFirstBlightableNowPlant(result, base.Map).CropBlighted(); return(true); } return(false); }, base.Map);
private bool <TryReproduceNow> m__0(List <IntVec3> cells) { IntVec3 c; if ((from x in cells where BlightUtility.GetFirstBlightableNowPlant(x, base.Map) != null select x).TryRandomElement(out c)) { BlightUtility.GetFirstBlightableNowPlant(c, base.Map).CropBlighted(); return(true); } return(false); }
public void TryReproduceNow() { GenRadial.ProcessEquidistantCells(base.Position, 4f, delegate(List <IntVec3> cells) { IntVec3 c; if ((from x in cells where BlightUtility.GetFirstBlightableNowPlant(x, base.Map) != null select x).TryRandomElement(out c)) { BlightUtility.GetFirstBlightableNowPlant(c, base.Map).CropBlighted(); return(true); } return(false); }, base.Map); }
private bool <TryReproduceNow> m__1(IntVec3 x) { return(BlightUtility.GetFirstBlightableNowPlant(x, base.Map) != null); }