SteamWar/BungeeCore
Archiviert
13
2

Fix ELO not given for public team vs public team
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Fix R1 vs R2
Dieser Commit ist enthalten in:
yoyosource 2023-10-25 08:29:22 +02:00
Ursprung 69720bfbd8
Commit 9be6ec94dc

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;