From 9e1653740d6fe973cdbbd17b1876f11c5b9ec7ee Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 14 May 2023 11:26:36 +0200 Subject: [PATCH] Hotfix (the last one hopefully) for the Elo handling --- .../bungeecore/network/handlers/EloPlayerHandler.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/network/handlers/EloPlayerHandler.java b/src/de/steamwar/bungeecore/network/handlers/EloPlayerHandler.java index 135a1bb..115a9fb 100644 --- a/src/de/steamwar/bungeecore/network/handlers/EloPlayerHandler.java +++ b/src/de/steamwar/bungeecore/network/handlers/EloPlayerHandler.java @@ -23,7 +23,10 @@ import de.steamwar.bungeecore.ArenaMode; import de.steamwar.bungeecore.BungeeCore; import de.steamwar.network.packets.PacketHandler; import de.steamwar.network.packets.common.FightEndsPacket; -import de.steamwar.sql.*; +import de.steamwar.sql.SchematicNode; +import de.steamwar.sql.SchematicType; +import de.steamwar.sql.SteamwarUser; +import de.steamwar.sql.UserElo; import lombok.RequiredArgsConstructor; import net.md_5.bungee.BungeeTitle; import net.md_5.bungee.api.ProxyServer; @@ -41,10 +44,6 @@ import java.util.stream.Collectors; public class EloPlayerHandler extends PacketHandler { private static final int MEDIAN_ELO_GAIN = 20; - private static final double WIN_FACTOR = 1.0; - private static final double DRAW_WIN_FACTOR = 0.2; - private static final double LOSE_FACTOR = -1.0; - private static final double DRAW_LOSE_FACTOR = -0.2; private static final long REMATCH_LIFETIME = 1L * 60 * 60 * 1000; private Map> gameModeGames = new HashMap<>(); @@ -119,7 +118,7 @@ public class EloPlayerHandler extends PacketHandler { double redWinFactor = (fightEndsPacket.getWin() == 2 ? 1 : 0.9); // Calculate division factor - double divisionFactor = 1/(fightEndsPacket.getWin() == 1 ? Math.max(blueTeamSize, redTeamSize) : Math.min(blueTeamSize, redTeamSize)); + double divisionFactor = 1D / Math.min(blueTeamSize, redTeamSize); // Calculate the elo gain for each player int blueEloGain = (int) Math.round(MEDIAN_ELO_GAIN * bluePlayerFactor * timeFactor * blueEloFactor * rematchFactor * blueWinFactor * divisionFactor);