fix: apply crystal multiplier to boss rewards, steepen prestige threshold, fix stale upgrade race condition, and fix companion format display
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m6s
CI / Lint, Build & Test (pull_request) Failing after 1m13s

Closes #221
Closes #222
Closes #201
Closes #213
This commit is contained in:
2026-04-06 13:22:15 -07:00
committed by Naomi Carrigan
parent 1c10df88fb
commit 69579e166a
10 changed files with 131 additions and 55 deletions
+4 -2
View File
@@ -205,9 +205,11 @@ bossRouter.post("/challenge", async(context) => {
boss.status = "defeated";
boss.currentHp = 0;
const crystalMult = state.prestige.runestonesCrystalMultiplier ?? 1;
state.resources.gold = state.resources.gold + boss.goldReward;
state.resources.essence = state.resources.essence + boss.essenceReward;
state.resources.crystals = state.resources.crystals + boss.crystalReward;
const crystalAward = boss.crystalReward * crystalMult;
state.resources.crystals = state.resources.crystals + crystalAward;
state.player.totalGoldEarned = state.player.totalGoldEarned + boss.goldReward;
for (const upgradeId of boss.upgradeRewards) {
@@ -323,7 +325,7 @@ bossRouter.post("/challenge", async(context) => {
rewards = {
bountyRunestones: bountyRunestones,
crystals: boss.crystalReward,
crystals: crystalAward,
equipmentIds: boss.equipmentRewards,
essence: boss.essenceReward,
gold: boss.goldReward,
+12
View File
@@ -546,6 +546,17 @@ const validateAndSanitize = (
? previous.prestige
: incoming.prestige;
/*
* If the DB prestige count is higher than the client's, the client is sending a
* stale pre-prestige save. Discard its upgrades (which have purchased: true) in
* favour of the DB's post-prestige upgrades (purchased: false) so that upgrade
* multipliers cannot persist across prestige via a race-condition auto-save.
*/
const upgrades
= incoming.prestige.count < previous.prestige.count
? previous.upgrades
: incoming.upgrades;
/*
* Echoes are only granted server-side via transcendence and can only decrease between
* saves (spent on echo upgrades). Cap at the previous value to block inflation.
@@ -671,6 +682,7 @@ const validateAndSanitize = (
prestige,
quests,
resources,
upgrades,
...transcendenceSpread,
...apotheosisSpread,
...explorationSpread,
+3 -3
View File
@@ -28,8 +28,8 @@ const maxBaseRunestones = 200;
/**
* Calculates the gold threshold required for the next prestige.
* Formula: BASE * (count + 1)^2 — polynomial growth that peaks around prestige 810
* then gets easier as the production multiplier overtakes it.
* Formula: BASE * (count + 1)^2.5steeper growth to keep late prestiges
* meaningful even as the production multiplier scales.
* @param prestigeCount - The current number of prestiges completed.
* @param thresholdMultiplier - An optional echo-upgrade multiplier applied to the threshold.
* @returns The gold amount required to prestige.
@@ -40,7 +40,7 @@ const calculatePrestigeThreshold = (
): number => {
return (
basePrestigeGoldThreshold
* Math.pow(prestigeCount + 1, 2)
* Math.pow(prestigeCount + 1, 2.5)
* thresholdMultiplier
);
};