XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

chore: some minor improvements to nemesis mode=s (#2126)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2126 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

41185286
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

1 个文件 +15 -10
Modified src/controllers/api/nemesisController.ts +15 -10
@@ -173,6 +173,9 @@ export const nemesisController: RequestHandler = async (req, res) => {
173 173 res.json({ LastEnc: inventory.Nemesis!.LastEnc });
174 174 } else if ((req.query.mode as string) == "s") {
175 175 const inventory = await getInventory(account._id.toString(), "Nemesis");
176 if (inventory.Nemesis) {
177 logger.warn(`overwriting an existing nemesis as a new one is being requested`);
178 }
176 179 const body = getJSONfromString<INemesisStartRequest>(String(req.body));
177 180 body.target.fp = BigInt(body.target.fp);
178 181
@@ -188,13 +191,15 @@ export const nemesisController: RequestHandler = async (req, res) => {
188 191 const weapons: readonly string[] = manifest.weapons;
189 192 const initialWeaponIdx = new SRng(body.target.fp).randomInt(0, weapons.length - 1);
190 193 weaponIdx = initialWeaponIdx;
191 do {
192 const weapon = weapons[weaponIdx];
193 if (body.target.DisallowedWeapons.indexOf(weapon) == -1) {
194 break;
195 }
196 weaponIdx = (weaponIdx + 1) % weapons.length;
197 } while (weaponIdx != initialWeaponIdx);
194 if (body.target.DisallowedWeapons) {
195 do {
196 const weapon = weapons[weaponIdx];
197 if (body.target.DisallowedWeapons.indexOf(weapon) == -1) {
198 break;
199 }
200 weaponIdx = (weaponIdx + 1) % weapons.length;
201 } while (weaponIdx != initialWeaponIdx);
202 }
198 203 }
199 204
200 205 inventory.Nemesis = {
@@ -215,10 +220,10 @@ export const nemesisController: RequestHandler = async (req, res) => {
215 220 GuessHistory: [],
216 221 Hints: [],
217 222 HintProgress: 0,
218 Weakened: body.target.Weakened,
223 Weakened: false,
219 224 PrevOwners: 0,
220 225 HenchmenKilled: 0,
221 SecondInCommand: body.target.SecondInCommand,
226 SecondInCommand: false,
222 227 MissionCount: 0,
223 228 LastEnc: 0
224 229 };
@@ -279,7 +284,7 @@ interface INemesisStartRequest {
279 284 KillingSuit: string;
280 285 killingDamageType: number;
281 286 ShoulderHelmet: string;
282 DisallowedWeapons: string[];
287 DisallowedWeapons?: string[];
283 288 WeaponIdx: number;
284 289 AgentIdx: number;
285 290 BirthNode: string;