Skip to content

Commit

Permalink
Fix detection of solo player if he would be the dealer himself (fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
uncaught committed Jun 23, 2020
1 parent 2a138ca commit b9e6913
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions client/src/store/Games/DetectLastGameAndForcedSolo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ export function detectLastGameAndForcedSolo(

//Find the players that are still present and still need their solo:
const open = playersWithStats.filter(({player, dutySoloPlayed}) => !dutySoloPlayed && activePlayers.includes(player));
if (open.length < remainingRegularGames) {
const openIndexes = open.map(({player}) => activePlayers.indexOf(player));
const countIndexesAfterDealer = openIndexes.filter((idx) => idx > nextDealerIndex).length;

if (open.length < remainingRegularGames

//Make sure the player does not have to deal when he is supposed to have his forced solo:
&& (activePlayers.length < 5 || countIndexesAfterDealer !== 1 || remainingRegularGames > 2)
&& (activePlayers.length < 6 || countIndexesAfterDealer !== 2 || remainingRegularGames > 3)
) {
return;
}

const openIndexes = open.map(({player}) => activePlayers.indexOf(player));

gameData.gameType = 'forcedSolo';
gameData.re.members = [];
gameData.contra.members = [];
Expand Down

0 comments on commit b9e6913

Please sign in to comment.