private static float GetScoreAt(IntVec3 cell, Map map) { if ((float)(int)InfestationCellFinder.distToColonyBuilding[cell] > 30.0) { return(0f); } if (!cell.Standable(map)) { return(0f); } if (cell.Fogged(map)) { return(0f); } if (InfestationCellFinder.CellHasBlockingThings(cell, map)) { return(0f); } if (cell.Roofed(map) && cell.GetRoof(map).isThickRoof) { Region region = cell.GetRegion(map, RegionType.Set_Passable); if (region == null) { return(0f); } if (InfestationCellFinder.closedAreaSize[cell] < 16) { return(0f); } float temperature = cell.GetTemperature(map); if (temperature < -17.0) { return(0f); } float mountainousnessScoreAt = InfestationCellFinder.GetMountainousnessScoreAt(cell, map); if (mountainousnessScoreAt < 0.17000000178813934) { return(0f); } int num = InfestationCellFinder.StraightLineDistToUnroofed(cell, map); float num2 = (float)(InfestationCellFinder.regionsDistanceToUnroofed.TryGetValue(region, out num2) ? Mathf.Min(num2, (float)((float)num * 4.0)) : ((float)num * 1.1499999761581421)); num2 = Mathf.Pow(num2, 1.55f); float num3 = Mathf.InverseLerp(0f, 12f, (float)num); float num4 = Mathf.Lerp(1f, 0.18f, map.glowGrid.GameGlowAt(cell, false)); float num5 = (float)(1.0 - Mathf.Clamp((float)(InfestationCellFinder.DistToBlocker(cell, map) / 11.0), 0f, 0.6f)); float num6 = Mathf.InverseLerp(-17f, -7f, temperature); float f = num2 * num3 * num5 * mountainousnessScoreAt * num4 * num6; f = Mathf.Pow(f, 1.2f); if (f < 7.5) { return(0f); } return(f); } return(0f); }
private static float GetScoreAt(IntVec3 cell, Map map) { if ((float)InfestationCellFinder.distToColonyBuilding[cell] > 30f) { return(0f); } if (!cell.Walkable(map)) { return(0f); } if (cell.Fogged(map)) { return(0f); } if (InfestationCellFinder.CellHasBlockingThings(cell, map)) { return(0f); } if (!cell.Roofed(map) || !cell.GetRoof(map).isThickRoof) { return(0f); } Region region = cell.GetRegion(map, RegionType.Set_Passable); if (region == null) { return(0f); } if (InfestationCellFinder.closedAreaSize[cell] < 2) { return(0f); } float temperature = cell.GetTemperature(map); if (temperature < -17f) { return(0f); } float mountainousnessScoreAt = InfestationCellFinder.GetMountainousnessScoreAt(cell, map); if (mountainousnessScoreAt < 0.17f) { return(0f); } int num = InfestationCellFinder.StraightLineDistToUnroofed(cell, map); float num2; if (!InfestationCellFinder.regionsDistanceToUnroofed.TryGetValue(region, out num2)) { num2 = (float)num * 1.15f; } else { num2 = Mathf.Min(num2, (float)num * 4f); } num2 = Mathf.Pow(num2, 1.55f); float num3 = Mathf.InverseLerp(0f, 12f, (float)num); float num4 = Mathf.Lerp(1f, 0.18f, map.glowGrid.GameGlowAt(cell, false)); float num5 = 1f - Mathf.Clamp(InfestationCellFinder.DistToBlocker(cell, map) / 11f, 0f, 0.6f); float num6 = Mathf.InverseLerp(-17f, -7f, temperature); float num7 = num2 * num3 * num5 * mountainousnessScoreAt * num4 * num6; num7 = Mathf.Pow(num7, 1.2f); if (num7 < 7.5f) { return(0f); } return(num7); }