Skip to content

Commit d0e76b1

Browse files
committed
レートを修正
1 parent 7e5351c commit d0e76b1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/main/java/com/github/elic0de/thejpspit/TheJpsPit.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void onEnable() {
5353
"Please check the supplied database credentials in the config file");
5454
}
5555

56-
ratingHelper = new KillRatingHelper(0.5);
56+
ratingHelper = new KillRatingHelper(0);
5757
queueManager = new QueueManager();
5858

5959
//queueTask = new QueueTask();

src/main/java/com/github/elic0de/thejpspit/util/KillRatingHelper.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,24 @@
66

77
public class KillRatingHelper {
88

9-
private static final double roundingFactor = 10000;
9+
// 少数第二で四捨五入
10+
private static final double roundingFactor = 10;
1011
private final double defaultRating;
1112

1213
public KillRatingHelper(double defaultRating) {
1314
this.defaultRating = defaultRating;
1415
}
1516

1617
public void initRating(PitPlayer player) {
17-
player.setRating(calculateWinningRatio(player));
18+
player.setRating(calculateKillingRatio(player));
1819
}
1920

20-
private double calculateWinningRatio(PitPlayer player) {
21+
private double calculateKillingRatio(PitPlayer player) {
2122
long deaths = player.getDeaths();
2223
long kills = player.getKills();
2324
long total = deaths + kills;
2425
if (deaths >= 0 && kills >= 0 && total > 0) {
25-
return round((double) kills / total * roundingFactor) / roundingFactor;
26+
return round((double) kills / deaths * roundingFactor) / roundingFactor;
2627
} else {
2728
return defaultRating;
2829
}

0 commit comments

Comments
 (0)