This commit is contained in:
parent
6d2c750a58
commit
e8165727de
|
@ -432,6 +432,7 @@ export class AddGameComponent implements OnInit {
|
|||
|
||||
// TODO: Bonus points
|
||||
gameScore += this.getFinalFoxPoints(winningTeam);
|
||||
gameScore += this.getCharliePoints(winningTeam);
|
||||
|
||||
// TODO: Check for announcements that have not been fulfilled!
|
||||
|
||||
|
@ -503,8 +504,8 @@ export class AddGameComponent implements OnInit {
|
|||
let reFoxesCaught: number = 0;
|
||||
let contraFoxesCaught: number = 0;
|
||||
|
||||
for(let player of this.actualPlayers) {
|
||||
if(player.team === Team.RE) {
|
||||
for (let player of this.actualPlayers) {
|
||||
if (player.team === Team.RE) {
|
||||
reFoxesCaught += player.foxesCaught ?? 0;
|
||||
} else {
|
||||
contraFoxesCaught += player.foxesCaught ?? 0;
|
||||
|
@ -524,7 +525,7 @@ export class AddGameComponent implements OnInit {
|
|||
getFinalFoxPoints(winningTeam: Team): number {
|
||||
let finalPoints = 0;
|
||||
|
||||
if(winningTeam === Team.RE) {
|
||||
if (winningTeam === Team.RE) {
|
||||
finalPoints += this.calculateFoxPoints().re;
|
||||
finalPoints -= this.calculateFoxPoints().contra;
|
||||
} else {
|
||||
|
@ -534,4 +535,18 @@ export class AddGameComponent implements OnInit {
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,4 +10,5 @@ export interface Player {
|
|||
hadTrumpHandoff?: boolean;
|
||||
team?: Team;
|
||||
foxesCaught?: number;
|
||||
wonLastTrickWithCharlie?: boolean;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user