LOG
Browse files
src/lib/components/Pages/Encounters.svelte
CHANGED
@@ -359,34 +359,41 @@
|
|
359 |
// Get the updated piclet instance and show detail page
|
360 |
const updatedPiclet = await db.picletInstances.get(capturedPiclet.id);
|
361 |
if (updatedPiclet) {
|
|
|
362 |
newlyCaughtPiclet = updatedPiclet;
|
363 |
showNewlyCaught = true;
|
|
|
|
|
|
|
364 |
}
|
365 |
} catch (error) {
|
366 |
console.error('Error adding captured Piclet to roster:', error);
|
367 |
}
|
368 |
}
|
369 |
|
370 |
-
function handleBattleEnd(result: any) {
|
371 |
showBattle = false;
|
372 |
uiStore.exitBattle();
|
373 |
|
374 |
if (result === true) {
|
375 |
// Victory
|
376 |
console.log('Battle won!');
|
|
|
|
|
377 |
} else if (result === false) {
|
378 |
// Defeat or ran away
|
379 |
console.log('Battle lost or fled');
|
|
|
|
|
380 |
} else if (result && result.id) {
|
381 |
// Caught a piclet - add to roster
|
382 |
console.log('Piclet caught!', result);
|
383 |
-
addCapturedPicletToRoster(result);
|
384 |
incrementCounter('picletsCapured');
|
385 |
addProgressPoints(100);
|
|
|
|
|
386 |
}
|
387 |
-
|
388 |
-
// Force refresh encounters after battle
|
389 |
-
forceEncounterRefresh();
|
390 |
}
|
391 |
</script>
|
392 |
|
@@ -462,6 +469,8 @@
|
|
462 |
onClose={() => {
|
463 |
showNewlyCaught = false;
|
464 |
newlyCaughtPiclet = null;
|
|
|
|
|
465 |
}}
|
466 |
/>
|
467 |
{/if}
|
|
|
359 |
// Get the updated piclet instance and show detail page
|
360 |
const updatedPiclet = await db.picletInstances.get(capturedPiclet.id);
|
361 |
if (updatedPiclet) {
|
362 |
+
console.log('Setting newlyCaughtPiclet and showing detail page:', updatedPiclet.nickname);
|
363 |
newlyCaughtPiclet = updatedPiclet;
|
364 |
showNewlyCaught = true;
|
365 |
+
console.log('showNewlyCaught is now:', showNewlyCaught);
|
366 |
+
} else {
|
367 |
+
console.error('Could not retrieve updated piclet from database');
|
368 |
}
|
369 |
} catch (error) {
|
370 |
console.error('Error adding captured Piclet to roster:', error);
|
371 |
}
|
372 |
}
|
373 |
|
374 |
+
async function handleBattleEnd(result: any) {
|
375 |
showBattle = false;
|
376 |
uiStore.exitBattle();
|
377 |
|
378 |
if (result === true) {
|
379 |
// Victory
|
380 |
console.log('Battle won!');
|
381 |
+
// Force refresh encounters after battle
|
382 |
+
forceEncounterRefresh();
|
383 |
} else if (result === false) {
|
384 |
// Defeat or ran away
|
385 |
console.log('Battle lost or fled');
|
386 |
+
// Force refresh encounters after battle
|
387 |
+
forceEncounterRefresh();
|
388 |
} else if (result && result.id) {
|
389 |
// Caught a piclet - add to roster
|
390 |
console.log('Piclet caught!', result);
|
391 |
+
await addCapturedPicletToRoster(result);
|
392 |
incrementCounter('picletsCapured');
|
393 |
addProgressPoints(100);
|
394 |
+
// Don't refresh encounters immediately - let user view the caught piclet first
|
395 |
+
// Refresh will happen when they close the detail dialog
|
396 |
}
|
|
|
|
|
|
|
397 |
}
|
398 |
</script>
|
399 |
|
|
|
469 |
onClose={() => {
|
470 |
showNewlyCaught = false;
|
471 |
newlyCaughtPiclet = null;
|
472 |
+
// Refresh encounters after user closes the detail dialog
|
473 |
+
forceEncounterRefresh();
|
474 |
}}
|
475 |
/>
|
476 |
{/if}
|