ENUMS: Initial Enum Helper rework + Reorganization (#596)

This commit is contained in:
Snarling
2023-06-12 00:34:20 -04:00
committed by GitHub
parent 6ed8ea9796
commit 6732549196
224 changed files with 2126 additions and 2171 deletions
+5 -3
View File
@@ -10,6 +10,7 @@ hacking game is very much in the spirit of the game.
Source-File minus 1 is extremely weak because it can be fully level up quickly.
*/
// Exploits don't need an enum helper so they are not in an enums file
export enum Exploit {
Bypass = "Bypass",
PrototypeTampering = "PrototypeTampering",
@@ -27,7 +28,7 @@ export enum Exploit {
EditSaveFile = "EditSaveFile",
}
const names: Record<string, string> = {
const names: Record<Exploit, string> = {
Bypass: "by circumventing the ram cost of document.",
EditSaveFile: "by editing your save file.",
PrototypeTampering: "by tampering with Numbers prototype.",
@@ -41,11 +42,12 @@ const names: Record<string, string> = {
INeedARainbow: "by using the power of the rainbow.",
};
export function ExploitName(exploit: string): string {
export function ExploitName(exploit: Exploit): string {
return names[exploit];
}
// Needed in case player edits save file poorly
export function sanitizeExploits(exploits: Exploit[]): Exploit[] {
exploits = exploits.filter((e: Exploit) => Object.keys(Exploit).includes(e));
exploits = exploits.filter((e: Exploit) => Object.values(Exploit).includes(e));
return [...new Set(exploits)];
}