Line 135: |
Line 135: |
| <syntaxhighlight lang="C#"> | | <syntaxhighlight lang="C#"> |
| if (this.minHarvest > 1 || this.maxHarvest > 1) | | if (this.minHarvest > 1 || this.maxHarvest > 1) |
− | num = random.Next(this.minHarvest, Math.Min(this.minHarvest + 1, this.maxHarvest + 1 + Game1.player.FarmingLevel / this.maxHarvestIncreasePerFarmingLevel)); | + | num = random.Next(this.minHarvest, Math.Max(this.minHarvest + 1, this.maxHarvest + 1 + Game1.player.FarmingLevel / this.maxHarvestIncreasePerFarmingLevel)); |
| | | |
| if (this.chanceForExtraCrops > 0.0) | | if (this.chanceForExtraCrops > 0.0) |
Line 144: |
Line 144: |
| num *= 2; | | num *= 2; |
| </syntaxhighlight> | | </syntaxhighlight> |
− |
| |
− | The result (''i.e.,'' <samp>num</samp>) of <code>random.Next(this.minHarvest, Math.Min(this.minHarvest + 1, this.maxHarvest + 1 + Game1.player.FarmingLevel / this.maxHarvestIncreasePerFarmingLevel))</code> is '''always the minHarvest''', for 2 reasons.
| |
− | #Taking the <samp>Math.Min</samp> of (<samp>minHarvest + 1</samp>) and (<samp>this.maxHarvest + 1 + Game1.player.FarmingLevel / this.maxHarvestIncreasePerFarmingLevel</samp>) always results in (<samp>minHarvest + 1</samp>)
| |
− | #<samp>random.Next</samp> uses an inclusive lower bound and an exclusive upper bound, so it is effectively calculating a random number between <samp>minHarvest</samp> and <samp>minHarvest</samp>
| |
− | Therefore, as of v1.2, only 3 seeds always give more than one crop per harvest, and that number is equal to the minHarvest:
| |
− | *Coffee Bean (433) -- 4 Beans
| |
− | *Blueberry Seeds (481) -- 3 Blueberries
| |
− | *Cranberry Seeds (493) -- 2 Cranberries
| |
− |
| |
− | An exception to this are [[Fiber Seeds]], which have a MinHarvest of 4 and a MaxHarvest of 7, meaning the crop produces on average 5.5 fiber.
| |
| | | |
| The value in <samp>chanceForExtraCrops</samp> may add additional crops to a harvest, calculated independently of the other 3 variables. For example, each harvest of a Potato Seed (475) has ≈20% chance of yielding an extra potato, in addition to the one Potato given as standard harvest. Each harvest of a Blueberry Seed (481) has ≈2% chance of yielding an extra Blueberry, in addition to the 3 Blueberries given as standard harvest. | | The value in <samp>chanceForExtraCrops</samp> may add additional crops to a harvest, calculated independently of the other 3 variables. For example, each harvest of a Potato Seed (475) has ≈20% chance of yielding an extra potato, in addition to the one Potato given as standard harvest. Each harvest of a Blueberry Seed (481) has ≈2% chance of yielding an extra Blueberry, in addition to the 3 Blueberries given as standard harvest. |