fix error: Lock Capsule not locking rarities consistently

This commit is contained in:
xy 2025-05-06 17:39:16 +08:00
parent f11e65f550
commit 39937f0cc2

View File

@ -3287,6 +3287,8 @@ export function getModifierTypeFuncById(id: string): ModifierTypeFunc {
return modifierTypes[id];
}
let lockModifierTiers: null | boolean = null;
/**
* Generates modifier options for a {@linkcode SelectModifierPhase}
* @param count Determines the number of items to generate
@ -3312,6 +3314,7 @@ export function getPlayerModifierTypeOptions(
const options: ModifierTypeOption[] = [];
const retryCount = Math.min(count * 5, 50);
if (!customModifierSettings) {
lockModifierTiers = !!modifierTiers && modifierTiers.length >= count;
new Array(count).fill(0).map((_, i) => {
options.push(
getModifierTypeOptionWithRetry(
@ -3322,6 +3325,8 @@ export function getPlayerModifierTypeOptions(
),
);
});
// init lockModifierTiers
lockModifierTiers = null;
} else {
// Guaranteed mod options first
if (
@ -3640,7 +3645,7 @@ function getNewModifierTypeOption(
}
tier += upgradeCount;
}
} else if (retryCount === 10 && tier) {
} else if (retryCount === 10 && tier && lockModifierTiers !== true) {
retryCount = 0;
tier--;
}