mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 20:55:44 +01:00
quickfix: aug list (#629)
This commit is contained in:
parent
92c41e60e2
commit
c059c35bca
@ -12,7 +12,7 @@ export class Faction {
|
||||
alreadyInvited = false;
|
||||
|
||||
/** Holds names of all augmentations that this Faction offers */
|
||||
augmentations: AugmentationName[] = [];
|
||||
augmentations: Set<AugmentationName> = new Set();
|
||||
|
||||
/** Amount of favor the player has with this faction. */
|
||||
favor = 0;
|
||||
@ -72,7 +72,9 @@ export class Faction {
|
||||
const faction = Generic_fromJSON(Faction, value.data);
|
||||
// Remove invalid augs from faction. Augs are repopulated with correct augs during any reset.
|
||||
const augHelper = getEnumHelper("AugmentationName");
|
||||
faction.augmentations = faction.augmentations.filter((augName) => augHelper.isMember(augName));
|
||||
faction.augmentations = new Set(
|
||||
Array.from(faction.augmentations.values()).filter((augName) => augHelper.isMember(augName)),
|
||||
);
|
||||
return faction;
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ export const getFactionAugmentationsFiltered = (faction: Faction): AugmentationN
|
||||
return true;
|
||||
}
|
||||
// Keep all the ones that this faction has anyway.
|
||||
if (faction.augmentations.includes(a.name)) {
|
||||
if (faction.augmentations.has(a.name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -164,5 +164,5 @@ export const getFactionAugmentationsFiltered = (faction: Faction): AugmentationN
|
||||
return augs.map((a) => a.name);
|
||||
}
|
||||
|
||||
return faction.augmentations.slice();
|
||||
return Array.from(faction.augmentations);
|
||||
};
|
||||
|
@ -58,7 +58,7 @@ function resetFaction(newFactionObject: Faction): void {
|
||||
console.error(`Faction ${factionName} did not exist while adding augs to factions`);
|
||||
continue;
|
||||
}
|
||||
faction.augmentations.push(aug.name);
|
||||
faction.augmentations.add(aug.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,13 +7,8 @@ import { FactionName } from "@enums";
|
||||
import { Server } from "../Server/Server";
|
||||
|
||||
function allFactionAugs(f: Faction): boolean {
|
||||
const factionAugs = f.augmentations.slice().filter((aug) => aug !== "NeuroFlux Governor");
|
||||
for (const factionAug of factionAugs) {
|
||||
if (
|
||||
!Player.augmentations.some((aug) => {
|
||||
return aug.name == factionAug;
|
||||
})
|
||||
)
|
||||
for (const factionAug of f.augmentations) {
|
||||
if (factionAug !== "NeuroFlux Governor" && !Player.augmentations.some((aug) => aug.name == factionAug))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user