forked from OpenWF/SpaceNinjaServer
		
	chore: some minor improvements to nemesis mode=s (#2126)
Reviewed-on: OpenWF/SpaceNinjaServer#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 });
 | 
			
		||||
    } else if ((req.query.mode as string) == "s") {
 | 
			
		||||
        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));
 | 
			
		||||
        body.target.fp = BigInt(body.target.fp);
 | 
			
		||||
 | 
			
		||||
@ -188,6 +191,7 @@ 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;
 | 
			
		||||
            if (body.target.DisallowedWeapons) {
 | 
			
		||||
                do {
 | 
			
		||||
                    const weapon = weapons[weaponIdx];
 | 
			
		||||
                    if (body.target.DisallowedWeapons.indexOf(weapon) == -1) {
 | 
			
		||||
@ -196,6 +200,7 @@ export const nemesisController: RequestHandler = async (req, res) => {
 | 
			
		||||
                    weaponIdx = (weaponIdx + 1) % weapons.length;
 | 
			
		||||
                } while (weaponIdx != initialWeaponIdx);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        inventory.Nemesis = {
 | 
			
		||||
            fp: body.target.fp,
 | 
			
		||||
@ -215,10 +220,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
 | 
			
		||||
        };
 | 
			
		||||
@ -279,7 +284,7 @@ interface INemesisStartRequest {
 | 
			
		||||
        KillingSuit: string;
 | 
			
		||||
        killingDamageType: number;
 | 
			
		||||
        ShoulderHelmet: string;
 | 
			
		||||
        DisallowedWeapons: string[];
 | 
			
		||||
        DisallowedWeapons?: string[];
 | 
			
		||||
        WeaponIdx: number;
 | 
			
		||||
        AgentIdx: number;
 | 
			
		||||
        BirthNode: string;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user