bugfix: make FarmingPatch.TROLL_STRONGHOLD_HERB diease-free

The original change to add FarmingPatch.TROLL_STRONGHOLD_HERB to isFlowerProtected() was introduced a few days ago in order to attempt to make the troll patch disease-free.. however, it doesnt work.
The reason is that Patch.isFlowerProtected():297 has a check for `patch.type` to be `PatchType.ALLOTMENT`. That chech will return false before the when statement is ever executed.
I moved the check for TROLL_STRONGHOLD_HERB up a level since "isFlowerProtected" didnt seem like a right place for it anyway since it is not a flower protection.
This commit is contained in:
vk 2021-09-25 01:21:18 -07:00
parent 0d3cf38d4d
commit 8568241cfa

View file

@ -237,7 +237,7 @@ class Patch(val player: Player, val patch: FarmingPatch, var plantable: Plantabl
CompostType.SUPER -> 13
}
if(RandomFunction.random(128) <= (17 - diseaseMod) && !isWatered && !isGrown() && !protectionPaid && !isFlowerProtected() && patch.type != PatchType.EVIL_TURNIP){
if(patch != FarmingPatch.TROLL_STRONGHOLD_HERB && RandomFunction.random(128) <= (17 - diseaseMod) && !isWatered && !isGrown() && !protectionPaid && !isFlowerProtected() && patch.type != PatchType.EVIL_TURNIP ){
//bush, tree, fruit tree, herb and cactus can not disease on stage 1(0) of growth.
if(!((patch.type == PatchType.BUSH || patch.type == PatchType.TREE || patch.type == PatchType.FRUIT_TREE || patch.type == PatchType.CACTUS || patch.type == PatchType.HERB) && currentGrowthStage == 0)) {
isDiseased = true
@ -301,7 +301,6 @@ class Patch(val player: Player, val patch: FarmingPatch, var plantable: Plantabl
FarmingPatch.ARDOUGNE_ALLOTMENT_S,FarmingPatch.ARDOUGNE_ALLOTMENT_N -> FarmingPatch.ARDOUGNE_FLOWER_C
FarmingPatch.CATHERBY_ALLOTMENT_S,FarmingPatch.CATHERBY_ALLOTMENT_N -> FarmingPatch.CATHERBY_FLOWER_C
FarmingPatch.PORT_PHAS_ALLOTMENT_SE,FarmingPatch.PORT_PHAS_ALLOTMENT_NW -> FarmingPatch.PORT_PHAS_FLOWER_C
FarmingPatch.TROLL_STRONGHOLD_HERB -> return true
else -> return false
}.getPatchFor(player)