Fix stuff I broke in #910

This commit is contained in:
omuretsu 2023-11-02 18:57:22 -04:00
parent 2997384403
commit e56e3dddf1
2 changed files with 2 additions and 2 deletions

@ -33,7 +33,6 @@ export function loadFactions(saveString: string, player: PlayerObject): void {
if (typeof loadedRep === "number" && loadedRep > 0) faction.playerReputation = loadedRep;
if (typeof loadedFavor === "number" && loadedFavor > 0) faction.favor = loadedFavor;
if (getEnumHelper("FactionDiscovery").isMember(loadedDiscovery)) faction.discovery = loadedDiscovery;
if (faction.alreadyInvited || faction.isMember) faction.discovery = FactionDiscovery.known;
}
// Load joined factions from player save
for (const joinedFacName of player.factions) {

@ -179,6 +179,7 @@ export function receiveInvite(this: PlayerObject, factionName: FactionName): voi
export function receiveRumor(this: PlayerObject, factionName: FactionName): void {
const faction = Factions[factionName];
if (faction.discovery === FactionDiscovery.unknown) faction.discovery = FactionDiscovery.rumored;
if (this.factionRumors.has(factionName) || faction.isMember || faction.isBanned || faction.alreadyInvited) return;
this.factionRumors.add(factionName);
}
@ -624,7 +625,7 @@ export function checkForFactionInvitations(this: PlayerObject): Faction[] {
const { inviteReqs, rumorReqs } = faction.getInfo();
if (inviteReqs.every((req) => req.isSatisfied(this))) invitedFactions.push(faction);
// Handle rumors
if (faction.discovery !== FactionDiscovery.unknown) continue;
if (this.factionRumors.has(faction.name)) continue;
if (rumorReqs.every((req) => req.isSatisfied(this))) this.receiveRumor(faction.name);
}
return invitedFactions;