log
Browse files
src/lib/components/Pages/Battle.svelte
CHANGED
@@ -604,11 +604,19 @@
|
|
604 |
}
|
605 |
|
606 |
async function handleBattleResults(playerWon: boolean) {
|
|
|
|
|
607 |
if (playerWon) {
|
608 |
// Calculate XP gained from defeating the enemy
|
|
|
|
|
|
|
|
|
609 |
const xpGained = calculateBattleXp(currentEnemyPiclet, 1);
|
|
|
610 |
|
611 |
if (xpGained > 0) {
|
|
|
612 |
// Animate XP gain by updating UI first
|
613 |
const updatedPlayerPiclet = {
|
614 |
...currentPlayerPiclet,
|
@@ -648,9 +656,11 @@
|
|
648 |
}, 4000);
|
649 |
} else {
|
650 |
// No level up, just end battle
|
|
|
651 |
onBattleEnd(true);
|
652 |
}
|
653 |
} else {
|
|
|
654 |
onBattleEnd(true);
|
655 |
}
|
656 |
} else {
|
|
|
604 |
}
|
605 |
|
606 |
async function handleBattleResults(playerWon: boolean) {
|
607 |
+
console.log('π handleBattleResults called:', { playerWon });
|
608 |
+
|
609 |
if (playerWon) {
|
610 |
// Calculate XP gained from defeating the enemy
|
611 |
+
console.log('π° Calculating XP for enemy:', {
|
612 |
+
enemyName: currentEnemyPiclet.nickname,
|
613 |
+
enemyLevel: currentEnemyPiclet.level
|
614 |
+
});
|
615 |
const xpGained = calculateBattleXp(currentEnemyPiclet, 1);
|
616 |
+
console.log('π― XP calculation result:', xpGained);
|
617 |
|
618 |
if (xpGained > 0) {
|
619 |
+
console.log('β
XP > 0, processing XP gain...');
|
620 |
// Animate XP gain by updating UI first
|
621 |
const updatedPlayerPiclet = {
|
622 |
...currentPlayerPiclet,
|
|
|
656 |
}, 4000);
|
657 |
} else {
|
658 |
// No level up, just end battle
|
659 |
+
console.log('π No level up, ending battle with XP gain');
|
660 |
onBattleEnd(true);
|
661 |
}
|
662 |
} else {
|
663 |
+
console.log('β XP is 0 or negative, ending battle without XP');
|
664 |
onBattleEnd(true);
|
665 |
}
|
666 |
} else {
|