Archiviert
1
0

Update some stuff

Dieser Commit ist enthalten in:
yoyosource 2022-04-01 13:26:05 +02:00
Ursprung 8ce2b9ab71
Commit b5528a6c60

Datei anzeigen

@ -82,19 +82,26 @@ public class FightEndsHandler implements SpigotHandler {
} }
private void calculateEloOfTeam(int schemId, int eloSchemOwn, int eloSchemEnemy, int eloTeamOwn, int eloTeamEnemy, double result, List<Integer> players, String gameMode, boolean noPlayerRank) { private void calculateEloOfTeam(int schemId, int eloSchemOwn, int eloSchemEnemy, int eloTeamOwn, int eloTeamEnemy, double result, List<Integer> players, String gameMode, boolean noPlayerRank) {
double winSchemExpectation = 1 / (1 + Math.pow(10, (eloSchemEnemy - eloSchemOwn) / 600f)); double winSchemExpectation = calsWinExpectation(eloSchemOwn, eloSchemEnemy);
SchemElo.setElo(schemId, (int) Math.round(eloSchemOwn + K * (result - winSchemExpectation))); SchemElo.setElo(schemId, (int) Math.round(eloSchemOwn + K * (result - winSchemExpectation)));
if (noPlayerRank) return; if (noPlayerRank) return;
double winTeamExpectation = 1 / (1 + Math.pow(10, (eloTeamEnemy - eloTeamOwn) / 600f)); double winTeamExpectation = calsWinExpectation(eloTeamOwn, eloTeamEnemy);
for (int player : players) { for (int player : players) {
int playerElo = UserElo.getEloOrDefault(player, gameMode); int playerElo = UserElo.getEloOrDefault(player, gameMode);
int fights = UserElo.getFightsOfSeason(player, gameMode); int fights = UserElo.getFightsOfSeason(player, gameMode);
double multiplier = Math.max(1.2 - (fights / 200.0), 0.8); UserElo.setElo(player, gameMode, (int) Math.round(playerElo + getK(fights) * (result - winTeamExpectation)));
UserElo.setElo(player, gameMode, (int) Math.round(playerElo + K * (result - winTeamExpectation) * multiplier));
} }
} }
private double calsWinExpectation(int eloOwn, int eloEnemy) {
return 1 / (1 + Math.pow(10, (eloEnemy - eloOwn) / 600f));
}
private double getK(int fights) {
return K * Math.max(1.2 - (fights / 200.0), 0.8);
}
private boolean teamComboExistedAlready(List<Integer> bluePlayers, List<Integer> redPlayers, String gameMode) { private boolean teamComboExistedAlready(List<Integer> bluePlayers, List<Integer> redPlayers, String gameMode) {
long time = Timestamp.from(Instant.now()).getTime() - fightRange; long time = Timestamp.from(Instant.now()).getTime() - fightRange;
int page = 0; int page = 0;