Skip to content

Commit 007407a

Browse files
committed
fix: drop multiplier calculation
1 parent d14021a commit 007407a

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ dependencies {
3535
}
3636

3737
group = "com.github.Mori01231"
38-
version = "1.8.0+1.21.11"
38+
version = "1.8.1+1.21.11"
3939
description = "MMLuck"
4040

4141
publishing {

src/main/java/com/github/mori01231/mmluck/GiveCommandExecutor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
9292
Rarity minimumRareMessageRarity = RarityAPIProvider.get().getRarityById(args.length == 4 ? "rare" : args[4]);
9393

9494
// Calculate the odds the player will be getting the item
95-
BigDecimal luckNumberD = new BigDecimal(luckNumber);
96-
BigDecimal boostMultiD = new BigDecimal(boostMulti);
95+
BigDecimal luckNumberD = BigDecimal.valueOf(luckNumber);
96+
BigDecimal boostMultiD = BigDecimal.valueOf(boostMulti);
9797
double giveMultiplier = (100 + luckNumber) * boostMulti / 100; // multiplier in 0-100%
9898
// If the random number is lower than the chance of getting item, give item.
9999
boolean doDrop;
100100
try {
101-
BigDecimal giveMultiplierD = luckNumberD.add(new BigDecimal(100)).multiply(boostMultiD).divide(new BigDecimal(100), RoundingMode.HALF_EVEN);
101+
BigDecimal giveMultiplierD = luckNumberD.add(new BigDecimal(100)).multiply(boostMultiD).movePointLeft(2);
102102
BigDecimal giveOdds = giveMultiplierD.multiply(BigDecimal.valueOf(mmItemChance)); // odds in 0-100%
103103
String formattedValue = giveOdds.multiply(new BigDecimal(100)).stripTrailingZeros().toPlainString();
104104
String japanese = toFriendlyString(new BigDecimal(1).divide(giveOdds, RoundingMode.HALF_EVEN).toBigInteger()) + "分の1";

0 commit comments

Comments
 (0)