chore: some minor improvements to nemesis mode=s (#2126)
Reviewed-on: #2126 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
parent
8ffbb308c5
commit
4118528603
@ -173,6 +173,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(`overwriting an existing nemesis as a new one is being requested`);
|
||||||
|
}
|
||||||
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);
|
||||||
|
|
||||||
@ -188,13 +191,15 @@ 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;
|
||||||
do {
|
if (body.target.DisallowedWeapons) {
|
||||||
const weapon = weapons[weaponIdx];
|
do {
|
||||||
if (body.target.DisallowedWeapons.indexOf(weapon) == -1) {
|
const weapon = weapons[weaponIdx];
|
||||||
break;
|
if (body.target.DisallowedWeapons.indexOf(weapon) == -1) {
|
||||||
}
|
break;
|
||||||
weaponIdx = (weaponIdx + 1) % weapons.length;
|
}
|
||||||
} while (weaponIdx != initialWeaponIdx);
|
weaponIdx = (weaponIdx + 1) % weapons.length;
|
||||||
|
} while (weaponIdx != initialWeaponIdx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inventory.Nemesis = {
|
inventory.Nemesis = {
|
||||||
@ -215,10 +220,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
|
||||||
};
|
};
|
||||||
@ -279,7 +284,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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user