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