SteamWar/BungeeCore
Archiviert
13
2

Fix ELO not given for public team vs public team #488

Zusammengeführt
Lixfel hat 1 Commits von EloFixForPublicVsPublicAndRank nach master 2023-10-28 20:23:05 +02:00 zusammengeführt
Nur Änderungen aus Commit 9be6ec94dc werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -70,11 +70,18 @@ public class EloPlayerHandler extends PacketHandler {
// gleichen Team sind dieser ungewertet ist.
Set<Integer> teamsIds = fightEndsPacket.getBluePlayers().stream().map(SteamwarUser::get).map(SteamwarUser::getTeam).collect(Collectors.toSet());
for (int redPlayer : fightEndsPacket.getRedPlayers()) {
if (teamsIds.contains(SteamwarUser.get(redPlayer).getTeam())) {
int team = SteamwarUser.get(redPlayer).getTeam();
if (team != 0 && teamsIds.contains(team)) {
return;
}
}
int blueRank = SchematicNode.getSchematicNode(fightEndsPacket.getBlueSchem()).getRank();
int redRank = SchematicNode.getSchematicNode(fightEndsPacket.getRedSchem()).getRank();
double blueRankFactor = blueRank > redRank ? (fightEndsPacket.getWin() == 1 ? 0.9 : 1.0) : (fightEndsPacket.getWin() == 1 ? 1.5 : 1.0);
double redRankFactor = redRank > blueRank ? (fightEndsPacket.getWin() == 2 ? 0.9 : 1.0) : (fightEndsPacket.getWin() == 2 ? 1.5 : 1.0);
// Get sizes of both teams
int blueTeamSize = fightEndsPacket.getBluePlayers().size();
int redTeamSize = fightEndsPacket.getRedPlayers().size();
@ -147,8 +154,8 @@ 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;
double blueFactor = blueRankFactor * bluePlayerFactor * timeFactor * blueEloFactor * rematchFactor * blueWinFactor * divisionFactor;
double redFactor = redRankFactor * 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) + blueTeamEloBonus;