From 4dad89ec342add5751b367c58b4581af34efcdef Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 26 Jun 2023 21:42:51 +0200 Subject: [PATCH] Update EloPlayerHandler.MEDIAN_ELO_GAIN and add EloPlayerHandler.MEDIAN_ELO_LOSE --- .../bungeecore/network/handlers/EloPlayerHandler.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/network/handlers/EloPlayerHandler.java b/src/de/steamwar/bungeecore/network/handlers/EloPlayerHandler.java index 273acf4..70f5752 100644 --- a/src/de/steamwar/bungeecore/network/handlers/EloPlayerHandler.java +++ b/src/de/steamwar/bungeecore/network/handlers/EloPlayerHandler.java @@ -43,7 +43,8 @@ import java.util.stream.Collectors; public class EloPlayerHandler extends PacketHandler { - private static final int MEDIAN_ELO_GAIN = 20; + private static final int MEDIAN_ELO_GAIN = 40; + private static final int MEDIAN_ELO_LOSE = 20; private static final long REMATCH_LIFETIME = 1L * 60 * 60 * 1000; private Map> gameModeGames = new HashMap<>(); @@ -120,9 +121,12 @@ public class EloPlayerHandler extends PacketHandler { // Calculate division factor double divisionFactor = 1D / Math.max(blueTeamSize, redTeamSize); + double blueFactor = bluePlayerFactor * timeFactor * blueEloFactor * rematchFactor * blueWinFactor * divisionFactor; + double redFactor = redPlayerFactor * timeFactor * redEloFactor * rematchFactor * redWinFactor * divisionFactor; + // Calculate the elo gain for each player - int blueEloGain = (int) Math.round(MEDIAN_ELO_GAIN * bluePlayerFactor * timeFactor * blueEloFactor * rematchFactor * blueWinFactor * divisionFactor); - int redEloGain = (int) Math.round(MEDIAN_ELO_GAIN * redPlayerFactor * timeFactor * redEloFactor * rematchFactor * redWinFactor * divisionFactor); + int blueEloGain = (int) Math.round((blueFactor < 0 ? MEDIAN_ELO_LOSE : MEDIAN_ELO_GAIN) * blueFactor); + int redEloGain = (int) Math.round((redFactor < 0 ? MEDIAN_ELO_LOSE : MEDIAN_ELO_GAIN) * redFactor); // BungeeCore.get().getLogger().info("Blue: " + fightEndsPacket.getBluePlayers() + " " + blueTeamSize + " " + bluePlayerFactor + " " + timeFactor + " " + blueEloFactor + " " + rematchFactor + " " + blueWinFactor + " " + divisionFactor + " " + blueEloGain); // BungeeCore.get().getLogger().info("Red: " + fightEndsPacket.getRedPlayers() + " " + redTeamSize + " " + redPlayerFactor + " " + timeFactor + " " + redEloFactor + " " + rematchFactor + " " + redWinFactor + " " + divisionFactor + " " + redEloGain);