public float GetGrowthRate(EnumSoilNutrient nutrient) { // (x/70 - 0.143)^0.35 // http://fooplot.com/#W3sidHlwZSI6MCwiZXEiOiIoeC83MC0wLjE0MyleMC4zNSIsImNvbG9yIjoiIzAwMDAwMCJ9LHsidHlwZSI6MTAwMCwid2luZG93IjpbIjAiLCIxMDAiLCIwIiwiMS4yNSJdfV0- float moistFactor = (float)Math.Pow(Math.Max(0.01, moistureLevel * 100 / 70 - 0.143), 0.35); if (nutrients[(int)nutrient] > 75) { return(moistFactor * 1.1f); } if (nutrients[(int)nutrient] > 50) { return(moistFactor * 1); } if (nutrients[(int)nutrient] > 35) { return(moistFactor * 0.9f); } if (nutrients[(int)nutrient] > 20) { return(moistFactor * 0.6f); } if (nutrients[(int)nutrient] > 5) { return(moistFactor * 0.3f); } return(moistFactor * 0.1f); }
public float LowNutrientPenalty(EnumSoilNutrient nutrient) { if (nutrients[(int)nutrient] > 75) { return(1 / 1.1f); } if (nutrients[(int)nutrient] > 50) { return(1); } if (nutrients[(int)nutrient] > 35) { return(1 / 0.9f); } if (nutrients[(int)nutrient] > 20) { return(1 / 0.6f); } if (nutrients[(int)nutrient] > 5) { return(1 / 0.3f); } return(1 / 0.1f); }