From 8ec2330ee350dbd9206caf3ff4a305190ce15dbc Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Sat, 7 Jun 2025 02:01:42 +0200 Subject: [PATCH 1/2] chore: some minor improvements to nemesis mode=s --- src/controllers/api/nemesisController.ts | 25 ++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/controllers/api/nemesisController.ts b/src/controllers/api/nemesisController.ts index 435f6791..8710137c 100644 --- a/src/controllers/api/nemesisController.ts +++ b/src/controllers/api/nemesisController.ts @@ -170,6 +170,9 @@ export const nemesisController: RequestHandler = async (req, res) => { res.json({ LastEnc: inventory.Nemesis!.LastEnc }); } else if ((req.query.mode as string) == "s") { const inventory = await getInventory(account._id.toString(), "Nemesis"); + if (inventory.Nemesis) { + logger.warn(`account already has a nemesis but is requesting a new one; overwriting it`); + } const body = getJSONfromString(String(req.body)); body.target.fp = BigInt(body.target.fp); @@ -185,13 +188,15 @@ export const nemesisController: RequestHandler = async (req, res) => { const weapons: readonly string[] = manifest.weapons; const initialWeaponIdx = new SRng(body.target.fp).randomInt(0, weapons.length - 1); weaponIdx = initialWeaponIdx; - do { - const weapon = weapons[weaponIdx]; - if (body.target.DisallowedWeapons.indexOf(weapon) == -1) { - break; - } - weaponIdx = (weaponIdx + 1) % weapons.length; - } while (weaponIdx != initialWeaponIdx); + if (body.target.DisallowedWeapons) { + do { + const weapon = weapons[weaponIdx]; + if (body.target.DisallowedWeapons.indexOf(weapon) == -1) { + break; + } + weaponIdx = (weaponIdx + 1) % weapons.length; + } while (weaponIdx != initialWeaponIdx); + } } inventory.Nemesis = { @@ -212,10 +217,10 @@ export const nemesisController: RequestHandler = async (req, res) => { GuessHistory: [], Hints: [], HintProgress: 0, - Weakened: body.target.Weakened, + Weakened: false, PrevOwners: 0, HenchmenKilled: 0, - SecondInCommand: body.target.SecondInCommand, + SecondInCommand: false, MissionCount: 0, LastEnc: 0 }; @@ -276,7 +281,7 @@ interface INemesisStartRequest { KillingSuit: string; killingDamageType: number; ShoulderHelmet: string; - DisallowedWeapons: string[]; + DisallowedWeapons?: string[]; WeaponIdx: number; AgentIdx: number; BirthNode: string; -- 2.47.2 From 0a5863e8b19aff9ad4efbc13b265bb672a34921a Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Sat, 7 Jun 2025 02:03:11 +0200 Subject: [PATCH 2/2] improve wording --- src/controllers/api/nemesisController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/api/nemesisController.ts b/src/controllers/api/nemesisController.ts index 8710137c..2c0d8244 100644 --- a/src/controllers/api/nemesisController.ts +++ b/src/controllers/api/nemesisController.ts @@ -171,7 +171,7 @@ export const nemesisController: RequestHandler = async (req, res) => { } else if ((req.query.mode as string) == "s") { const inventory = await getInventory(account._id.toString(), "Nemesis"); if (inventory.Nemesis) { - logger.warn(`account already has a nemesis but is requesting a new one; overwriting it`); + logger.warn(`overwriting an existing nemesis as a new one is being requested`); } const body = getJSONfromString(String(req.body)); body.target.fp = BigInt(body.target.fp); -- 2.47.2