From 2cf3d640bb18e4920d986f72d45d49a38d54d43b Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Wed, 10 Nov 2021 19:11:19 -0500 Subject: [PATCH] fix exploit duplicate --- doc/source/changelog.rst | 2 +- src/Exploits/Exploit.ts | 3 ++- src/Exploits/applyExploits.ts | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst index 55d295a2d..24589bdd0 100644 --- a/doc/source/changelog.rst +++ b/doc/source/changelog.rst @@ -61,7 +61,7 @@ v1.0.0 - 2021-11-10 Breaking the API :( (blame hydroflame) * Button colors can be edited. * 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. -* nerf noodle bar. +* buff noodle bar. v0.58.0 - 2021-10-27 Road to Steam (hydroflame & community) ----------------------------------------------------------- diff --git a/src/Exploits/Exploit.ts b/src/Exploits/Exploit.ts index f1f32640a..dbb4914ab 100644 --- a/src/Exploits/Exploit.ts +++ b/src/Exploits/Exploit.ts @@ -42,5 +42,6 @@ export function ExploitName(exploit: string): string { } 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)]; } diff --git a/src/Exploits/applyExploits.ts b/src/Exploits/applyExploits.ts index 7612e03ae..f2edf35a9 100644 --- a/src/Exploits/applyExploits.ts +++ b/src/Exploits/applyExploits.ts @@ -1,9 +1,11 @@ import { Player } from "../Player"; +import { sanitizeExploits } from "./Exploit"; export function applyExploit(): void { if (Player.exploits && Player.exploits.length === 0) { return; } + Player.exploits = sanitizeExploits(Player.exploits); const inc = Math.pow(1.001, Player.exploits.length); const dec = Math.pow(0.999, Player.exploits.length);