From 3f0ca145cc12ae6d6caa522deefa0da6c335f810 Mon Sep 17 00:00:00 2001 From: devxb Date: Mon, 24 Jun 2024 00:31:29 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=99=95=EB=A5=A0=EA=B3=84=EC=82=B0?= =?UTF-8?q?=EC=97=90=EC=84=9C=20ratio=EA=B0=80=200.0=EC=9D=B8=20=ED=8E=AB?= =?UTF-8?q?=EB=93=A4=EC=9D=80=20=EC=A0=9C=EC=99=B8=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 12224cc..4320839 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -1,5 +1,6 @@ package org.gitanimals.render.domain +import java.math.RoundingMode import java.text.DecimalFormat import kotlin.math.atan2 import kotlin.math.max @@ -1237,7 +1238,7 @@ enum class PersonaType(val weight: Double, private var dropRate: String? = null) } private fun loadDropRate(): String { - val allPersonaCount = personas.size + val allPersonaCount = personas.filter { it.weight > 0.0 }.size val personaCount = (weight * 1000).toInt() val dropRateTemp = (personaCount.toDouble() / allPersonaCount.toDouble()) * 100.0 @@ -1287,7 +1288,7 @@ enum class PersonaType(val weight: Double, private var dropRate: String? = null) } companion object { - private val dropRateFormat = DecimalFormat("#.#") + private val dropRateFormat = DecimalFormat("#.##") private val maxWeight = lazy { var maxWeight = 0