chore: some minor improvements to nemesis mode=s
All checks were successful
Build / build (push) Successful in 46s
Build / build (pull_request) Successful in 46s

This commit is contained in:
Sainan 2025-06-07 02:01:42 +02:00
parent 0997f9567f
commit 8ec2330ee3

View File

@ -170,6 +170,9 @@ export const nemesisController: RequestHandler = async (req, res) => {
res.json({ LastEnc: inventory.Nemesis!.LastEnc }); res.json({ LastEnc: inventory.Nemesis!.LastEnc });
} else if ((req.query.mode as string) == "s") { } else if ((req.query.mode as string) == "s") {
const inventory = await getInventory(account._id.toString(), "Nemesis"); 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<INemesisStartRequest>(String(req.body)); const body = getJSONfromString<INemesisStartRequest>(String(req.body));
body.target.fp = BigInt(body.target.fp); body.target.fp = BigInt(body.target.fp);
@ -185,6 +188,7 @@ export const nemesisController: RequestHandler = async (req, res) => {
const weapons: readonly string[] = manifest.weapons; const weapons: readonly string[] = manifest.weapons;
const initialWeaponIdx = new SRng(body.target.fp).randomInt(0, weapons.length - 1); const initialWeaponIdx = new SRng(body.target.fp).randomInt(0, weapons.length - 1);
weaponIdx = initialWeaponIdx; weaponIdx = initialWeaponIdx;
if (body.target.DisallowedWeapons) {
do { do {
const weapon = weapons[weaponIdx]; const weapon = weapons[weaponIdx];
if (body.target.DisallowedWeapons.indexOf(weapon) == -1) { if (body.target.DisallowedWeapons.indexOf(weapon) == -1) {
@ -193,6 +197,7 @@ export const nemesisController: RequestHandler = async (req, res) => {
weaponIdx = (weaponIdx + 1) % weapons.length; weaponIdx = (weaponIdx + 1) % weapons.length;
} while (weaponIdx != initialWeaponIdx); } while (weaponIdx != initialWeaponIdx);
} }
}
inventory.Nemesis = { inventory.Nemesis = {
fp: body.target.fp, fp: body.target.fp,
@ -212,10 +217,10 @@ export const nemesisController: RequestHandler = async (req, res) => {
GuessHistory: [], GuessHistory: [],
Hints: [], Hints: [],
HintProgress: 0, HintProgress: 0,
Weakened: body.target.Weakened, Weakened: false,
PrevOwners: 0, PrevOwners: 0,
HenchmenKilled: 0, HenchmenKilled: 0,
SecondInCommand: body.target.SecondInCommand, SecondInCommand: false,
MissionCount: 0, MissionCount: 0,
LastEnc: 0 LastEnc: 0
}; };
@ -276,7 +281,7 @@ interface INemesisStartRequest {
KillingSuit: string; KillingSuit: string;
killingDamageType: number; killingDamageType: number;
ShoulderHelmet: string; ShoulderHelmet: string;
DisallowedWeapons: string[]; DisallowedWeapons?: string[];
WeaponIdx: number; WeaponIdx: number;
AgentIdx: number; AgentIdx: number;
BirthNode: string; BirthNode: string;