geforkt von SteamWar/BungeeCore
Update FightEndsHandler
Dieser Commit ist enthalten in:
Ursprung
2bd15d5c4f
Commit
e015641086
@ -69,22 +69,16 @@ public class FightEndsHandler implements SpigotHandler {
|
||||
int blueSchemElo = SchemElo.getElo(fightEndsPacket.getBlueSchem());
|
||||
int redSchemElo = SchemElo.getElo(fightEndsPacket.getRedSchem());
|
||||
|
||||
double blueWinExpectation = 1 / (1 + Math.pow(10, (redSchemElo - blueSchemElo) / 600f));
|
||||
double redWinExpectation = 1 / (1 + Math.pow(10, (blueSchemElo - redSchemElo) / 600f));
|
||||
|
||||
SchemElo.setElo(fightEndsPacket.getBlueSchem(), (int) Math.round(blueSchemElo + K * (blueResult - blueWinExpectation)));
|
||||
SchemElo.setElo(fightEndsPacket.getRedSchem(), (int) Math.round(redSchemElo + K * (1 - blueResult - redWinExpectation)));
|
||||
|
||||
if (!bluePublic) {
|
||||
calculateEloOfTeam(fightEndsPacket.getBluePlayers(), fightEndsPacket.getGameMode(), blueResult - blueWinExpectation);
|
||||
calculateEloOfTeam(fightEndsPacket.getRedPlayers(), fightEndsPacket.getGameMode(), 1 - blueResult - blueWinExpectation);
|
||||
}
|
||||
calculateEloOfTeam(fightEndsPacket.getBlueSchem(), blueSchemElo, redSchemElo, blueResult, fightEndsPacket.getBluePlayers(), fightEndsPacket.getGameMode());
|
||||
calculateEloOfTeam(fightEndsPacket.getRedSchem(), redSchemElo, blueSchemElo, 1 - blueResult, fightEndsPacket.getRedPlayers(), fightEndsPacket.getGameMode());
|
||||
}
|
||||
|
||||
private void calculateEloOfTeam(List<Integer> team, String gameMode, double factor) {
|
||||
for (int player : team) {
|
||||
private void calculateEloOfTeam(int schemId, int elo1, int elo2, double result, List<Integer> players, String gameMode) {
|
||||
double winExpectation = 1 / (1 + Math.pow(10, (elo1 - elo2) / 600f));
|
||||
SchemElo.setElo(schemId, (int) Math.round(elo1 + K * (result - winExpectation)));
|
||||
for (int player : players) {
|
||||
int playerElo = UserElo.getEloOrDefault(player, gameMode);
|
||||
UserElo.setElo(player, gameMode, (int) Math.round(playerElo + K * factor));
|
||||
UserElo.setElo(player, gameMode, (int) Math.round(playerElo + K * (result - winExpectation)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren