Fixed high level bias

This commit is contained in:
Auxilor 2024-06-23 16:33:13 +01:00
parent 0da40cab00
commit c4b71948df
3 changed files with 5 additions and 5 deletions

View File

@ -134,8 +134,8 @@ class EnchantingTableSupport(
cost / maxObtainableLevel.toDouble()
}
val levelPart2 = NumberUtils.bias(levelPart1, enchantment.type.highLevelBias)
val levelPart3 = NumberUtils.triangularDistribution(0.0, 1.0, levelPart2)
val levelPart2 = NumberUtils.triangularDistribution(0.0, 1.0, levelPart1)
val levelPart3 = NumberUtils.bias(levelPart2, enchantment.type.highLevelBias)
val level = ceil(levelPart3 * maxLevel).coerceIn(1.0..maxLevel.toDouble()).toInt()
multiplier /= this.plugin.configYml.getDouble("enchanting-table.reduction")

View File

@ -76,8 +76,8 @@ class VillagerSupport(
val maxLevel = enchantment.maximumLevel
val levelPart1 = event.recipe.ingredients[0].amount / 64.0
val levelPart2 = NumberUtils.bias(levelPart1, enchantment.type.highLevelBias)
val levelPart3 = NumberUtils.triangularDistribution(0.0, 1.0, levelPart2)
val levelPart2 = NumberUtils.triangularDistribution(0.0, 1.0, levelPart1)
val levelPart3 = NumberUtils.bias(levelPart2, enchantment.type.highLevelBias)
val level = ceil(levelPart3 * maxLevel).coerceIn(1.0..maxLevel.toDouble()).toInt()
multiplier /= this.plugin.configYml.getDouble("villager.reduction")

View File

@ -15,7 +15,7 @@ class EnchantmentType(
val id = config.getString("id")
val format = config.getString("format")
val limit = config.getInt("limit").infiniteIfNegative()
val highLevelBias = config.getDouble("high-level-bias")
val highLevelBias = config.getDouble("high-level-bias").coerceAtMost(0.999)
val noGrindstone = config.getBool("no-grindstone")
override fun equals(other: Any?): Boolean {