You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Prevent players from going below zero total points
684
+
if ($cache !== null && ($cache->points + $playerGR->points) < 0)
685
+
{
686
+
// Cap the loss: set game points to negative of current total
687
+
// Example: if cache = 10, set game points to -10, so new total = 10 + (-10) = 0
688
+
$playerGR->points = -1 * $cache->points;
689
+
}
690
+
elseif ($cache === null && $playerGR->points < 0)
691
+
{
692
+
// No cache exists, don't allow negative points
693
+
$playerGR->points = 0;
694
+
}
695
+
696
+
// Safety check: losers should NEVER get positive points. An edge case has been observed where players with negative or very low pts, earned ~+1 pts when winning, lets prevent that.
697
+
if (!$playerGRTeamWonTheGame && !$playerGR->draw && $playerGR->points > 0)
681
698
{
682
699
$playerGR->points = 0;
683
700
}
@@ -824,7 +841,21 @@ public function awardPlayerPoints(GameReport $gameReport, LadderHistory $history
Log::debug("QuickMatchService ** Both have colors prefs: " . $bothHaveColorPrefs . " Match has observer: " . $matchHasObserver . " qmPlayer is observer: " . $qmPlayer->isObserver());
0 commit comments