File size: 1,164 Bytes
7428b13
 
 
 
 
 
 
 
 
1f2c086
7428b13
 
 
1f2c086
7428b13
1f2c086
 
 
7428b13
 
1f2c086
7428b13
1f2c086
 
 
7428b13
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { db } from './index';

// Utility function to reset the game state (useful for testing)
export async function resetGameState() {
  // Clear all game data
  await db.picletInstances.clear();
  await db.encounters.clear();
  await db.gameState.clear();
  
  // Note: All Piclets are now stored in picletInstances table
  console.log('Game state reset - all caught piclets and encounters cleared');
}

// Clear only uncaught piclets (discovered but not caught)
export async function clearDiscoveredPiclets() {
  // Remove all uncaught piclets from the database
  await db.picletInstances.where('caught').equals(false).delete();
  console.log('Uncaught piclets cleared');
}

// Full reset including all piclets
export async function fullGameReset() {
  await db.picletInstances.clear();
  await db.encounters.clear();
  await db.gameState.clear();
  console.log('Full game reset - all data cleared');
}

// Make functions available globally for debugging
if (typeof window !== 'undefined') {
  (window as any).resetGameState = resetGameState;
  (window as any).clearDiscoveredPiclets = clearDiscoveredPiclets;
  (window as any).fullGameReset = fullGameReset;
}