generated from nhcarrigan/template
feat: v0.6.0 balance pass, quest-gated bosses, and achievement fixes
This commit is contained in:
@@ -68,10 +68,22 @@ transcendenceRouter.post("/", async(context) => {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line capitalized-comments -- v8 ignore
|
||||
/* v8 ignore next 3 -- @preserve */
|
||||
const runAchievementsUnlocked = state.achievements.filter((achievement) => {
|
||||
return achievement.unlockedAt !== null;
|
||||
}).length;
|
||||
/* v8 ignore next 5 -- @preserve */
|
||||
const totalAchievementsUnlocked = state.achievements.filter(
|
||||
(achievement) => {
|
||||
return achievement.unlockedAt !== null;
|
||||
},
|
||||
).length;
|
||||
|
||||
/*
|
||||
* Achievements now persist across resets, so `totalAchievementsUnlocked`
|
||||
* already includes everything counted at previous resets — only the
|
||||
* delta since then should be folded into the lifetime stat.
|
||||
*/
|
||||
const achievementsUnlockedDelta = Math.max(
|
||||
0,
|
||||
totalAchievementsUnlocked - state.player.lifetimeAchievementsUnlocked,
|
||||
);
|
||||
|
||||
const now = Date.now();
|
||||
await prisma.gameState.update({
|
||||
@@ -86,7 +98,7 @@ transcendenceRouter.post("/", async(context) => {
|
||||
|
||||
lastSavedAt: now,
|
||||
|
||||
lifetimeAchievementsUnlocked: { increment: runAchievementsUnlocked },
|
||||
lifetimeAchievementsUnlocked: { increment: achievementsUnlockedDelta },
|
||||
|
||||
lifetimeAdventurersRecruited: { increment: runAdventurersRecruited },
|
||||
|
||||
|
||||
Reference in New Issue
Block a user