12
2

Hotfix (the last one hopefully) for the Elo handling
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2023-05-14 11:26:36 +02:00
Ursprung 618c4d24a2
Commit 9e1653740d

Datei anzeigen

@ -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<String, LinkedList<Game>> 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);