diff --git a/src/de/steamwar/bungeecore/network/handlers/FightEndsHandler.java b/src/de/steamwar/bungeecore/network/handlers/FightEndsHandler.java index 5463f2f7..07e9fbe2 100644 --- a/src/de/steamwar/bungeecore/network/handlers/FightEndsHandler.java +++ b/src/de/steamwar/bungeecore/network/handlers/FightEndsHandler.java @@ -185,11 +185,11 @@ public class FightEndsHandler extends PacketHandler { } private void calcSchemElo(int eloSchemOwn, int eloSchemEnemy, int schemId, double result) { - double winSchemExpectation = calsWinExpectation(eloSchemOwn, eloSchemEnemy); + double winSchemExpectation = calcWinExpectation(eloSchemOwn, eloSchemEnemy); SchemElo.setElo(schemId, (int) Math.round(eloSchemOwn + K * (result - winSchemExpectation))); } - private double calsWinExpectation(int eloOwn, int eloEnemy) { + private double calcWinExpectation(int eloOwn, int eloEnemy) { return 1 / (1 + Math.pow(10, (eloEnemy - eloOwn) / 600f)); } @@ -212,19 +212,11 @@ public class FightEndsHandler extends PacketHandler { } private double getBlueEloFactor(int blueElo, int redElo) { - if (blueElo == 0) blueElo = 1; - if (redElo == 0) redElo = 1; - return sigmoid(redElo / (double) blueElo); + return 2 - calcWinExpectation(blueElo, redElo) * 2; } private double getRedEloFactor(int blueElo, int redElo) { - if (blueElo == 0) blueElo = 1; - if (redElo == 0) redElo = 1; - return sigmoid(blueElo / (double) redElo); - } - - private double sigmoid(double x) { - return 1 / (1 + Math.exp(-2 * (x - 1))) * 2; + return 2 - calcWinExpectation(redElo, blueElo) * 2; } private double getRematchFactor(FightEndsPacket fightEndsPacket) {