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

fix: some issues with sortie generation (#1871)

Now using sortieTilesets as a source of truth for allowed mission nodes as it's based only on real sorties, also added disallowed mission types for FC_OROKIN (Corrupted Vor) that otherwise cause a script error. Closes #1865 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1871 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

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

代码差异

1 个文件 +35 -21
Modified src/services/worldStateService.ts +35 -21
@@ -50,21 +50,27 @@ const sortieBossToFaction: Record<string, string> = {
50 50 SORTIE_BOSS_PHORID: "FC_INFESTATION",
51 51 SORTIE_BOSS_LEPHANTIS: "FC_INFESTATION",
52 52 SORTIE_BOSS_INFALAD: "FC_INFESTATION",
53 SORTIE_BOSS_CORRUPTED_VOR: "FC_CORRUPTED"
53 SORTIE_BOSS_CORRUPTED_VOR: "FC_OROKIN"
54 54 };
55 55
56 56 const sortieFactionToSystemIndexes: Record<string, number[]> = {
57 57 FC_GRINEER: [0, 2, 3, 5, 6, 9, 11, 18],
58 58 FC_CORPUS: [1, 4, 7, 8, 12, 15],
59 59 FC_INFESTATION: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 15],
60 FC_CORRUPTED: [14]
60 FC_OROKIN: [14]
61 61 };
62 62
63 63 const sortieFactionToFactionIndexes: Record<string, number[]> = {
64 64 FC_GRINEER: [0],
65 65 FC_CORPUS: [1],
66 66 FC_INFESTATION: [0, 1, 2],
67 FC_CORRUPTED: [3]
67 FC_OROKIN: [3]
68 };
69
70 const sortieFactionToSpecialMissionTileset: Record<string, string> = {
71 FC_GRINEER: "GrineerGalleonTileset",
72 FC_CORPUS: "CorpusShipTileset",
73 FC_INFESTATION: "CorpusShipTileset"
68 74 };
69 75
70 76 const sortieBossNode: Record<string, string> = {
@@ -273,14 +279,7 @@ const pushSortieIfRelevant = (worldState: IWorldState, day: number): void => {
273 279 if (
274 280 sortieFactionToSystemIndexes[sortieBossToFaction[boss]].includes(value.systemIndex) &&
275 281 sortieFactionToFactionIndexes[sortieBossToFaction[boss]].includes(value.factionIndex!) &&
276 !isArchwingMission(value) &&
277 value.missionIndex != 0 && // Exclude MT_ASSASSINATION
278 value.missionIndex != 10 && // Exclude MT_PVP (for relays)
279 value.missionIndex != 21 && // Exclude MT_PURIFY
280 value.missionIndex != 22 && // Exclude MT_ARENA
281 value.missionIndex != 23 && // Exclude MT_JUNCTION
282 (value.missionIndex != 28 || value.systemIndex == 2) && // MT_LANDSCAPE only on Earth
283 value.missionIndex < 29
282 key in sortieTilesets
284 283 ) {
285 284 if (!availableMissionIndexes.includes(value.missionIndex)) {
286 285 availableMissionIndexes.push(value.missionIndex);
@@ -289,21 +288,36 @@ const pushSortieIfRelevant = (worldState: IWorldState, day: number): void => {
289 288 }
290 289 }
291 290
291 const specialMissionTypes = [1, 3, 5, 9];
292 if (!(sortieBossToFaction[boss] in sortieFactionToSpecialMissionTileset)) {
293 for (const missionType of specialMissionTypes) {
294 const i = availableMissionIndexes.indexOf(missionType);
295 if (i != -1) {
296 availableMissionIndexes.splice(i, 1);
297 }
298 }
299 }
300
292 301 const selectedNodes: ISortieMission[] = [];
293 302 const missionTypes = new Set();
294 303
295 304 for (let i = 0; i < 3; i++) {
296 const randomIndex = rng.randomInt(0, nodes.length - 1);
297 const node = nodes[randomIndex];
298 let missionIndex = ExportRegions[node].missionIndex;
305 let randomIndex;
306 let node;
307 let missionIndex;
308 do {
309 randomIndex = rng.randomInt(0, nodes.length - 1);
310 node = nodes[randomIndex];
299 311
300 if (
301 !["SolNode404", "SolNode411"].includes(node) && // for some reason the game doesn't like missionType changes for these missions
302 missionIndex != 28 &&
303 rng.randomInt(0, 2) == 2
304 ) {
305 missionIndex = rng.randomElement(availableMissionIndexes);
306 }
312 missionIndex = ExportRegions[node].missionIndex;
313 if (missionIndex != 28) {
314 missionIndex = rng.randomElement(availableMissionIndexes);
315 }
316 } while (
317 specialMissionTypes.indexOf(missionIndex) != -1 &&
318 sortieTilesets[node as keyof typeof sortieTilesets] !=
319 sortieFactionToSpecialMissionTileset[sortieBossToFaction[boss]]
320 );
307 321
308 322 if (i == 2 && rng.randomInt(0, 2) == 2) {
309 323 const filteredModifiers = modifiers.filter(mod => mod !== "SORTIE_MODIFIER_MELEE_ONLY");