diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-13 06:42:24 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-13 06:42:24 +0200 |
commit | c8f81f0fc19ffe0778ea3d0ebb7e34d7f7ac76da (patch) | |
tree | 2f12ac9dc1f30c314904ff0cebc0d81a95fb27b0 /src/main/java/at/hannibal2/skyhanni/features/garden | |
parent | ca01ffa10846f8fabc0fe77d915575171e895160 (diff) | |
download | skyhanni-c8f81f0fc19ffe0778ea3d0ebb7e34d7f7ac76da.tar.gz skyhanni-c8f81f0fc19ffe0778ea3d0ebb7e34d7f7ac76da.tar.bz2 skyhanni-c8f81f0fc19ffe0778ea3d0ebb7e34d7f7ac76da.zip |
hopefully fixed finnegan perk detection and calculation logic
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt index b53627699..4be321a0f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt @@ -128,14 +128,7 @@ class GardenCropMilestoneDisplay { val crop = item.getCropType() ?: return if (cultivatingData.containsKey(crop)) { val old = cultivatingData[crop]!! -// val finneganPerkFactor = if (finneganPerkActive() && Random.nextDouble() <= 0.25) 0.5 else 1.0 -// val finneganPerkFactor = if (finneganPerkActive()) 0.8 else 1.0 - - // 1/(1 + 0.25*2) - val multiplier = 0.6666 - val finneganPerkFactor = if (finneganPerkActive()) multiplier else 1.0 - val addedCounter = ((counter - old) * finneganPerkFactor).toInt() - println("addedCounter: $addedCounter") + val addedCounter = counter - old if (GardenCropMilestones.cropCounter.isEmpty()) { for (innerCrop in CropType.values()) { @@ -147,8 +140,9 @@ class GardenCropMilestoneDisplay { cropType.setSpeed(-1) } } - - crop.setCounter(crop.getCounter() + addedCounter) + if (!finneganPerkActive()) { + crop.setCounter(crop.getCounter() + addedCounter) + } EliteFarmingWeight.addCrop(crop, addedCounter) if (currentCrop == crop) { calculateSpeed(addedCounter) @@ -162,8 +156,14 @@ class GardenCropMilestoneDisplay { } } - private fun finneganPerkActive() = - config.forcefullyEnabledAlwaysFinnegan || MayorElectionData.isPerkActive("Finnegan", "Farming Simulator") + private fun finneganPerkActive(): Boolean { + val forcefullyEnabledAlwaysFinnegan = config.forcefullyEnabledAlwaysFinnegan + val perkActive = MayorElectionData.isPerkActive("Finnegan", "Farming Simulator") + MayorElectionData.currentCandidate?.let { + + } + return forcefullyEnabledAlwaysFinnegan || perkActive + } @SubscribeEvent fun onBlockClick(event: BlockClickEvent) { @@ -209,6 +209,10 @@ class GardenCropMilestoneDisplay { } private fun checkSpeed() { + if (finneganPerkActive()) { + currentSpeed = (currentSpeed.toDouble() * 0.8).toInt() + } + if (countInLastSecond > 8) { allCounters.add(currentSpeed) while (allCounters.size > 30) { @@ -217,6 +221,12 @@ class GardenCropMilestoneDisplay { averageSpeedPerSecond = allCounters.average().toInt() } countInLastSecond = 0 + + if (finneganPerkActive()) { + currentCrop?.let { + it.setCounter(it.getCounter() + currentSpeed) + } + } currentSpeed = 0 lastBlocksPerSecond = blocksBroken |