feat(engine): costs on start, unlock checks, queue completion advancement

This commit is contained in:
ginnoir
2026-06-11 18:19:16 -05:00
parent ea2fb0afab
commit f514eeedf8
5 changed files with 232 additions and 36 deletions
+4 -2
View File
@@ -86,7 +86,8 @@ describe('applyOfflineProgress()', () => {
startAction(state, content, 'forage'); // 3000ms per gold
const credited = applyOfflineProgress(state, content, 1000, 1000 + 9000); // 9s
expect(credited).toBe(9000);
expect(state.resources.gold).toBe(3); // 9000 / 3000
expect(state.resources.gold).toBe(1); // one completion then idle
expect(state.activeActionId).toBeNull();
});
it('credits nothing when the clock did not advance', () => {
@@ -103,6 +104,7 @@ describe('applyOfflineProgress()', () => {
startAction(state, content, 'forage');
const credited = applyOfflineProgress(state, content, 0, 10_000_000, 6000);
expect(credited).toBe(6000);
expect(state.resources.gold).toBe(2); // 6000 / 3000
expect(state.resources.gold).toBe(1); // one completion then idle
expect(state.activeActionId).toBeNull();
});
});