diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index 96de85bbb..2c06b4644 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -42,9 +42,17 @@ public class EloManager extends MiniDbClientPlugin { EloTeam newTeam = new EloTeam(); + int newTotal = _ratingSystem.getNewRating(teamA.TotalElo / teamA.getPlayers().size(), teamB.TotalElo / teamB.getPlayers().size(), result); + int kTotal = 0; + for (EloPlayer player : teamA.getPlayers()) { - int newRating = _ratingSystem.getNewRating(player.getRating(), (teamB.TotalElo / teamB.getPlayers().size()), result); + kTotal += _ratingSystem.getKFactor(player.getRating()); + } + + for (EloPlayer player : teamA.getPlayers()) + { + int newRating = (int)(player.getRating() + ((double)_ratingSystem.getKFactor(player.getRating()) / (double)kTotal) * (newTotal - teamA.TotalElo)); EloPlayer newPlayer = new EloPlayer(player.getPlayer(), newRating); newTeam.addPlayer(newPlayer); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRatingSystem.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRatingSystem.java index d32433ed6..cb18341cc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRatingSystem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRatingSystem.java @@ -57,7 +57,7 @@ public class EloRatingSystem return oldRating + (int) (kFactor * (score - expectedScore)); } - private double getKFactor(int rating) + double getKFactor(int rating) { for (int i = 0; i < _kFactors.length; i++) {