Adding correct point calculation for Solo games
All checks were successful
Jenkins Production Deployment
All checks were successful
Jenkins Production Deployment
This commit is contained in:
parent
7082abcdf7
commit
aec84dca5d
|
@ -387,7 +387,7 @@ export class AddGameComponent implements OnInit {
|
|||
let winningTeam = this.getWinningTeamAndScore().team;
|
||||
let winningTeamScore = this.getWinningTeamAndScore().score;
|
||||
let unfulfilledAnnouncementPoints = this.checkUnfulfilledAnnouncements(winningTeam, winningTeamScore);
|
||||
let isSoloPlay = false;
|
||||
let isSoloPlay = this.checkIfSolo();
|
||||
|
||||
// We are going to calculate the points for the winning team and then set all players points accordingly
|
||||
|
||||
|
@ -412,8 +412,7 @@ export class AddGameComponent implements OnInit {
|
|||
gameScore += this.getCharliePoints(winningTeam);
|
||||
}
|
||||
|
||||
// TODO: Game score in case of a solo
|
||||
this.setGameScores(gameScore, winningTeam);
|
||||
this.setGameScores(gameScore, winningTeam, isSoloPlay);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -509,10 +508,14 @@ export class AddGameComponent implements OnInit {
|
|||
* @param score The score to set
|
||||
* @param winningTeam The team that won
|
||||
*/
|
||||
setGameScores(score: number, winningTeam: Team) {
|
||||
setGameScores(score: number, winningTeam: Team, isSolo: boolean) {
|
||||
for (let player of this.actualPlayers) {
|
||||
if (player.team === winningTeam) {
|
||||
if(isSolo) {
|
||||
player.gamePoints = score * 3;
|
||||
} else {
|
||||
player.gamePoints = score;
|
||||
}
|
||||
} else {
|
||||
player.gamePoints = -score;
|
||||
}
|
||||
|
@ -606,4 +609,27 @@ export class AddGameComponent implements OnInit {
|
|||
|
||||
return gamePoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* _____ __
|
||||
* / ___/____ / /___
|
||||
* \__ \/ __ \/ / __ \
|
||||
* ___/ / /_/ / / /_/ /
|
||||
* /____/\____/_/\____/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Checks, according to the assigned Teams, if this is a solo play
|
||||
*/
|
||||
checkIfSolo(): boolean {
|
||||
let numberOfElders: number = 0;
|
||||
|
||||
for(let player of this.actualPlayers) {
|
||||
if(player.team === Team.RE) {
|
||||
numberOfElders++;
|
||||
}
|
||||
}
|
||||
|
||||
return numberOfElders === 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user