perf: this is just Math.min

This commit is contained in:
Breno A. 2024-06-09 09:56:58 -03:00
parent dd9f59fbfc
commit 4b03304cdc
2 changed files with 2 additions and 2 deletions

View File

@ -104,7 +104,7 @@ public class GachaSystem extends BaseGameSystem {
}
total += weight;
}
int roll = ThreadLocalRandom.current().nextInt((total < cutoff) ? total : cutoff);
int roll = ThreadLocalRandom.current().nextInt(Math.min(total, cutoff));
int subTotal = 0;
for (int i = 0; i < weights.length; i++) {
subTotal += weights[i];

View File

@ -118,7 +118,7 @@ public class BlossomManager {
public void notifyIcon() {
final int wl = getWorldLevel();
final int worldLevel = (wl < 0) ? 0 : ((wl > 8) ? 8 : wl);
final int worldLevel = (wl < 0) ? 0 : (Math.min(wl, 8));
final var worldLevelData = GameData.getWorldLevelDataMap().get(worldLevel);
final int monsterLevel = (worldLevelData != null) ? worldLevelData.getMonsterLevel() : 1;
List<BlossomBriefInfoOuterClass.BlossomBriefInfo> blossoms = new ArrayList<>();