From c70a8040f10d96ace6f770995b023786cdfc7620 Mon Sep 17 00:00:00 2001 From: vk Date: Sat, 25 Sep 2021 01:21:18 -0700 Subject: [PATCH] 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. --- .../main/kotlin/rs09/game/node/entity/skill/farming/Patch.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/Patch.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/Patch.kt index 3592b10e5..824ce1b68 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/Patch.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/Patch.kt @@ -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)