mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-07 00:23:20 +08:00
perf: this is just Math.min
This commit is contained in:
parent
dd9f59fbfc
commit
4b03304cdc
@ -104,7 +104,7 @@ public class GachaSystem extends BaseGameSystem {
|
|||||||
}
|
}
|
||||||
total += weight;
|
total += weight;
|
||||||
}
|
}
|
||||||
int roll = ThreadLocalRandom.current().nextInt((total < cutoff) ? total : cutoff);
|
int roll = ThreadLocalRandom.current().nextInt(Math.min(total, cutoff));
|
||||||
int subTotal = 0;
|
int subTotal = 0;
|
||||||
for (int i = 0; i < weights.length; i++) {
|
for (int i = 0; i < weights.length; i++) {
|
||||||
subTotal += weights[i];
|
subTotal += weights[i];
|
||||||
|
@ -118,7 +118,7 @@ public class BlossomManager {
|
|||||||
|
|
||||||
public void notifyIcon() {
|
public void notifyIcon() {
|
||||||
final int wl = getWorldLevel();
|
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 var worldLevelData = GameData.getWorldLevelDataMap().get(worldLevel);
|
||||||
final int monsterLevel = (worldLevelData != null) ? worldLevelData.getMonsterLevel() : 1;
|
final int monsterLevel = (worldLevelData != null) ? worldLevelData.getMonsterLevel() : 1;
|
||||||
List<BlossomBriefInfoOuterClass.BlossomBriefInfo> blossoms = new ArrayList<>();
|
List<BlossomBriefInfoOuterClass.BlossomBriefInfo> blossoms = new ArrayList<>();
|
||||||
|
Loading…
Reference in New Issue
Block a user