Refactor convertBotDifficultyDropdownToBotDifficulty() ot use switch statement

This commit is contained in:
Dev 2023-05-18 17:23:28 +01:00
parent 90d8b52a41
commit f3b28d532c

View File

@ -98,17 +98,15 @@ export class BotDifficultyHelper
*/ */
public convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string public convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string
{ {
if (dropDownDifficulty.toLowerCase() === "medium") switch (dropDownDifficulty.toLowerCase())
{ {
return "normal"; case "medium":
return "normal";
case "random":
return this.chooseRandomDifficulty();
default:
return dropDownDifficulty.toLowerCase();
} }
if (dropDownDifficulty.toLowerCase() === "random")
{
return this.chooseRandomDifficulty();
}
return dropDownDifficulty.toLowerCase();
} }
/** /**