fix exploit duplicate

This commit is contained in:
Olivier Gagnon 2021-11-10 19:11:19 -05:00
parent a3346719a0
commit 2cf3d640bb
3 changed files with 5 additions and 2 deletions

@ -61,7 +61,7 @@ v1.0.0 - 2021-11-10 Breaking the API :( (blame hydroflame)
* Button colors can be edited. * Button colors can be edited.
* Added 2 new colors in the theme editor: background primary and background secondary. * Added 2 new colors in the theme editor: background primary and background secondary.
* infiltration uses key instead of keycode so it should work better on non-american keyboards. * infiltration uses key instead of keycode so it should work better on non-american keyboards.
* nerf noodle bar. * buff noodle bar.
v0.58.0 - 2021-10-27 Road to Steam (hydroflame & community) v0.58.0 - 2021-10-27 Road to Steam (hydroflame & community)
----------------------------------------------------------- -----------------------------------------------------------

@ -42,5 +42,6 @@ export function ExploitName(exploit: string): string {
} }
export function sanitizeExploits(exploits: Exploit[]): Exploit[] { export function sanitizeExploits(exploits: Exploit[]): Exploit[] {
return exploits.filter((e: Exploit) => Object.keys(Exploit).includes(e)); exploits = exploits.filter((e: Exploit) => Object.keys(Exploit).includes(e));
return [...new Set(exploits)];
} }

@ -1,9 +1,11 @@
import { Player } from "../Player"; import { Player } from "../Player";
import { sanitizeExploits } from "./Exploit";
export function applyExploit(): void { export function applyExploit(): void {
if (Player.exploits && Player.exploits.length === 0) { if (Player.exploits && Player.exploits.length === 0) {
return; return;
} }
Player.exploits = sanitizeExploits(Player.exploits);
const inc = Math.pow(1.001, Player.exploits.length); const inc = Math.pow(1.001, Player.exploits.length);
const dec = Math.pow(0.999, Player.exploits.length); const dec = Math.pow(0.999, Player.exploits.length);