Add charlie to point calculation
All checks were successful
Jenkins Production Deployment

This commit is contained in:
Patrick Müller 2022-09-15 15:43:29 +02:00
parent 6d2c750a58
commit e8165727de
Signed by: Paddy
GPG Key ID: 37ABC11275CAABCE
2 changed files with 19 additions and 3 deletions

View File

@ -432,6 +432,7 @@ export class AddGameComponent implements OnInit {
// TODO: Bonus points // TODO: Bonus points
gameScore += this.getFinalFoxPoints(winningTeam); gameScore += this.getFinalFoxPoints(winningTeam);
gameScore += this.getCharliePoints(winningTeam);
// TODO: Check for announcements that have not been fulfilled! // TODO: Check for announcements that have not been fulfilled!
@ -534,4 +535,18 @@ export class AddGameComponent implements OnInit {
return finalPoints; return finalPoints;
} }
/**
* Returns the extra points for a when a charlie made the final trick.
* If the winning team played the charlie, they get one point. If the losing team played the charlie, the winning team loses one point.
* @param winningTeam The winning team
*/
getCharliePoints(winningTeam: Team): number {
for(let player of this.actualPlayers) {
if(player.wonLastTrickWithCharlie) {
return player.team === winningTeam ? 1 : -1;
}
}
return 0;
}
} }

View File

@ -10,4 +10,5 @@ export interface Player {
hadTrumpHandoff?: boolean; hadTrumpHandoff?: boolean;
team?: Team; team?: Team;
foxesCaught?: number; foxesCaught?: number;
wonLastTrickWithCharlie?: boolean;
} }