Archiviert
1
0

Update FightEndsHandler

Dieser Commit ist enthalten in:
yoyosource 2022-03-11 20:14:39 +01:00
Ursprung e015641086
Commit ef320718ef

Datei anzeigen

@ -73,9 +73,9 @@ public class FightEndsHandler implements SpigotHandler {
calculateEloOfTeam(fightEndsPacket.getRedSchem(), redSchemElo, blueSchemElo, 1 - blueResult, fightEndsPacket.getRedPlayers(), fightEndsPacket.getGameMode()); calculateEloOfTeam(fightEndsPacket.getRedSchem(), redSchemElo, blueSchemElo, 1 - blueResult, fightEndsPacket.getRedPlayers(), fightEndsPacket.getGameMode());
} }
private void calculateEloOfTeam(int schemId, int elo1, int elo2, double result, List<Integer> players, String gameMode) { private void calculateEloOfTeam(int schemId, int eloOwn, int eloEnemy, double result, List<Integer> players, String gameMode) {
double winExpectation = 1 / (1 + Math.pow(10, (elo1 - elo2) / 600f)); double winExpectation = 1 / (1 + Math.pow(10, (eloOwn - eloEnemy) / 600f));
SchemElo.setElo(schemId, (int) Math.round(elo1 + K * (result - winExpectation))); SchemElo.setElo(schemId, (int) Math.round(eloOwn + K * (result - winExpectation)));
for (int player : players) { for (int player : players) {
int playerElo = UserElo.getEloOrDefault(player, gameMode); int playerElo = UserElo.getEloOrDefault(player, gameMode);
UserElo.setElo(player, gameMode, (int) Math.round(playerElo + K * (result - winExpectation))); UserElo.setElo(player, gameMode, (int) Math.round(playerElo + K * (result - winExpectation)));