Esempio n. 1
0
        // Token: 0x0600368C RID: 13964 RVA: 0x001A0EAC File Offset: 0x0019F2AC
        private static float GetScoreAt(IntVec3 cell, Map map, ThingDef thingDef)
        {
            if ((float)InfestationLikeCellFinder.distToColonyBuilding[cell] > 30f)
            {
                return(0f);
            }
            if (!cell.Walkable(map))
            {
                return(0f);
            }
            if (cell.Fogged(map))
            {
                return(0f);
            }
            if (InfestationLikeCellFinder.CellHasBlockingThings(cell, map, thingDef))
            {
                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 (InfestationLikeCellFinder.closedAreaSize[cell] < 2)
            {
                return(0f);
            }
            float temperature = cell.GetTemperature(map);

            if (temperature < -17f)
            {
                return(0f);
            }
            float mountainousnessScoreAt = InfestationLikeCellFinder.GetMountainousnessScoreAt(cell, map);

            if (mountainousnessScoreAt < 0.17f)
            {
                return(0f);
            }
            int   num = InfestationLikeCellFinder.StraightLineDistToUnroofed(cell, map);
            float num2;

            if (!InfestationLikeCellFinder.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(InfestationLikeCellFinder.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);
        }