SteamWar/BungeeCore
Archiviert
13
2

Merge pull request 'Fix ELO not given for public team vs public team' (#488) from EloFixForPublicVsPublicAndRank into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #488
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2023-10-28 20:23:04 +02:00
Commit 3d64ee3b6f

Datei anzeigen

@ -70,11 +70,18 @@ public class EloPlayerHandler extends PacketHandler {
// gleichen Team sind dieser ungewertet ist. // gleichen Team sind dieser ungewertet ist.
Set<Integer> teamsIds = fightEndsPacket.getBluePlayers().stream().map(SteamwarUser::get).map(SteamwarUser::getTeam).collect(Collectors.toSet()); Set<Integer> teamsIds = fightEndsPacket.getBluePlayers().stream().map(SteamwarUser::get).map(SteamwarUser::getTeam).collect(Collectors.toSet());
for (int redPlayer : fightEndsPacket.getRedPlayers()) { 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; 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 // Get sizes of both teams
int blueTeamSize = fightEndsPacket.getBluePlayers().size(); int blueTeamSize = fightEndsPacket.getBluePlayers().size();
int redTeamSize = fightEndsPacket.getRedPlayers().size(); int redTeamSize = fightEndsPacket.getRedPlayers().size();
@ -147,8 +154,8 @@ public class EloPlayerHandler extends PacketHandler {
// Calculate division factor // Calculate division factor
double divisionFactor = 1D / Math.max(blueTeamSize, redTeamSize); double divisionFactor = 1D / Math.max(blueTeamSize, redTeamSize);
double blueFactor = bluePlayerFactor * timeFactor * blueEloFactor * rematchFactor * blueWinFactor * divisionFactor; double blueFactor = blueRankFactor * bluePlayerFactor * timeFactor * blueEloFactor * rematchFactor * blueWinFactor * divisionFactor;
double redFactor = redPlayerFactor * timeFactor * redEloFactor * rematchFactor * redWinFactor * divisionFactor; double redFactor = redRankFactor * redPlayerFactor * timeFactor * redEloFactor * rematchFactor * redWinFactor * divisionFactor;
// Calculate the elo gain for each player // Calculate the elo gain for each player
int blueEloGain = (int) Math.round((blueFactor < 0 ? MEDIAN_ELO_LOSE : MEDIAN_ELO_GAIN) * blueFactor) + blueTeamEloBonus; int blueEloGain = (int) Math.round((blueFactor < 0 ? MEDIAN_ELO_LOSE : MEDIAN_ELO_GAIN) * blueFactor) + blueTeamEloBonus;