geforkt von SteamWar/BungeeCore
Fix another elo related thing
Dieser Commit ist enthalten in:
Ursprung
4dad89ec34
Commit
e99f24b01b
@ -49,6 +49,10 @@ public class EloPlayerHandler extends PacketHandler {
|
||||
|
||||
private Map<String, LinkedList<Game>> gameModeGames = new HashMap<>();
|
||||
|
||||
/**
|
||||
* {@link FightEndsPacket#getWin()} == 1 -> Blue won
|
||||
* {@link FightEndsPacket#getWin()} == 2 -> Red won
|
||||
*/
|
||||
@Handler
|
||||
public void handle(FightEndsPacket fightEndsPacket) {
|
||||
if (!ArenaMode.getBySchemType(SchematicType.fromDB(fightEndsPacket.getGameMode())).isRanked()) {
|
||||
@ -86,6 +90,20 @@ public class EloPlayerHandler extends PacketHandler {
|
||||
int blueTeamElo = fightEndsPacket.getBluePlayers().stream().mapToInt(player -> UserElo.getEloOrDefault(player, fightEndsPacket.getGameMode())).sum();
|
||||
int redTeamElo = fightEndsPacket.getRedPlayers().stream().mapToInt(player -> UserElo.getEloOrDefault(player, fightEndsPacket.getGameMode())).sum();
|
||||
|
||||
// Adaptive elo bonus
|
||||
int blueTeamEloBonus = 0;
|
||||
int redTeamEloBonus = 0;
|
||||
if (Math.abs(blueTeamElo / (double) fightEndsPacket.getBluePlayers().size() - redTeamElo / (double) fightEndsPacket.getRedPlayers().size()) > 400) {
|
||||
int outlivedDuration = Math.max(fightEndsPacket.getDuration() - 60, 0);
|
||||
if (fightEndsPacket.getWin() == 1 && blueTeamElo < redTeamElo) {
|
||||
blueTeamEloBonus = outlivedDuration / 20;
|
||||
redTeamEloBonus = -(blueTeamEloBonus / 2);
|
||||
} else if (fightEndsPacket.getWin() == 2 && redTeamElo < blueTeamElo) {
|
||||
redTeamEloBonus = outlivedDuration / 20;
|
||||
blueTeamEloBonus = -(redTeamEloBonus / 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate the elo factor
|
||||
double blueEloFactor = ((fightEndsPacket.getWin() == 1 ? 1 : 0) - 1 / (1 + Math.pow(10, (redTeamElo - blueTeamElo) / 600.0))) * (1 / (1 + Math.exp(-Math.abs(blueTeamElo - redTeamElo) / 1200))) * 4;
|
||||
double redEloFactor = blueEloFactor * -1;
|
||||
@ -125,8 +143,8 @@ public class EloPlayerHandler extends PacketHandler {
|
||||
double redFactor = redPlayerFactor * timeFactor * redEloFactor * rematchFactor * redWinFactor * divisionFactor;
|
||||
|
||||
// Calculate the elo gain for each player
|
||||
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);
|
||||
int blueEloGain = (int) Math.round((blueFactor < 0 ? MEDIAN_ELO_LOSE : MEDIAN_ELO_GAIN) * blueFactor) + blueTeamEloBonus;
|
||||
int redEloGain = (int) Math.round((redFactor < 0 ? MEDIAN_ELO_LOSE : MEDIAN_ELO_GAIN) * redFactor) + redTeamEloBonus;
|
||||
|
||||
// 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);
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren