only check cheevo conditional if player is missing it

This commit is contained in:
Russell Stringer 2022-01-11 12:42:20 -05:00
parent fa0f5cb451
commit c941ec2ba6

@ -759,13 +759,13 @@ export const achievements: IMap<Achievement> = {
// { ID: "FLIGHT.EXE", Condition: () => Player.getHomeComputer().programs.includes(Programs.Flight.name) },
export function calculateAchievements(): void {
const availableAchievements = Object.values(achievements)
.filter((a) => a.Condition())
.map((a) => a.ID);
const playerAchievements = Player.achievements.map((a) => a.ID);
const newAchievements = availableAchievements.filter((a) => !playerAchievements.includes(a));
for (const id of newAchievements) {
const missingAchievements = Object.values(achievements)
.filter((a) => !playerAchievements.includes(a.ID) && a.Condition())
.map((a) => a.ID);
for (const id of missingAchievements) {
Player.giveAchievement(id);
}