Refactoring score calculation logic

This commit is contained in:
2022-09-14 21:58:31 +02:00
parent 051657ef65
commit 753e490c29
5 changed files with 139 additions and 41 deletions
@@ -28,8 +28,7 @@ export function getAllAnnouncementValues(): Announcement[] {
/**
* Checks if the selected announcements are a valid set of announcements.
* E.g.: If RE_NO_NINETY is newly selected, RE also has to be selected
* @param alreadySelected
* @param newSelected
* @param selectedAnnouncements The list of selected announcements
*/
export function checkValidity(selectedAnnouncements: Announcement[]): boolean {
// First check all "RE" Announcements
@@ -70,6 +69,10 @@ export function checkValidity(selectedAnnouncements: Announcement[]): boolean {
return true
}
/**
* Returns the names of the two highest announcements from the given list, one for RE and one for CONTRA if applicable
* @param selectedAnnouncements The list of announcements to check
*/
export function returnTwoHighestAnnouncements(selectedAnnouncements: Announcement[]): string {
let finalString: string = '';
-2
View File
@@ -5,8 +5,6 @@ import {Solo} from './enums/solo';
export interface Game {
gameId: number;
players: Player[];
foxesCaught: number;
announcements: Announcement[];
solo?: Solo;
againstTheElders: boolean;
}
+3 -2
View File
@@ -4,9 +4,10 @@ export interface Player {
firebonkId: number;
uuid: string;
firstName: string;
finalCardScore?: number;
gamePoints?: number;
finalCardScore: number;
gamePoints: number;
hadMarriage?: boolean;
hadTrumpHandoff?: boolean;
team?: Team;
foxesCaught?: number;
}