fix: prevent conversion system from auto-unlocking all mana types on first tick
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m30s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m30s
- Removed auto-unlock lines in gameStore.ts element regen loop and recovery room boost loop - Added unlocked guard to skip locked elements during conversion processing - Added regression test (bug-377) verifying only transference stays unlocked Fixes #377
This commit is contained in:
@@ -207,8 +207,7 @@ export const useGameStore = create<GameCoordinatorStore>()(
|
||||
}
|
||||
// Apply net element regen to pools: produced - drained (component consumption)
|
||||
for (const [elem, entry] of Object.entries(conversionResult.rates)) {
|
||||
if (entry.paused || !elements[elem]) continue;
|
||||
if (!elements[elem].unlocked) elements[elem] = { ...elements[elem], unlocked: true };
|
||||
if (entry.paused || !elements[elem] || !elements[elem].unlocked) continue;
|
||||
const netRate = elementRegen[elem];
|
||||
if (netRate === 0) continue;
|
||||
const delta = netRate * HOURS_PER_TICK;
|
||||
@@ -320,8 +319,7 @@ export const useGameStore = create<GameCoordinatorStore>()(
|
||||
const regenDelta = Math.max(0, netBoostedRegen - netRawRegen);
|
||||
rawMana = Math.min(rawMana + regenDelta * HOURS_PER_TICK, maxMana);
|
||||
for (const [elem, entry] of Object.entries(conversionResult.rates)) {
|
||||
if (entry.paused || entry.finalRate <= 0 || !elements[elem]) continue;
|
||||
if (!elements[elem].unlocked) elements[elem] = { ...elements[elem], unlocked: true };
|
||||
if (entry.paused || entry.finalRate <= 0 || !elements[elem] || !elements[elem].unlocked) continue;
|
||||
// Normal conversion already applied above; add only the 9× delta
|
||||
elements[elem] = { ...elements[elem], current: Math.min(elements[elem].max, elements[elem].current + entry.finalRate * 9 * HOURS_PER_TICK) };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user