fix(gameplay & db): fix casino spin freeze, bank deposit sync, and plant selection menu (fixes #8, #9, #10)

This commit is contained in:
2026-09-22 12:04:30 +00:00
parent 351d5f1cca
commit bd314730ff
7 changed files with 247 additions and 33 deletions
+14 -1
View File
@@ -130,11 +130,21 @@ window.EconomySystem = class EconomySystem {
this.selectedDeck = deckIds.filter(id => this.isPlantUnlocked(id)).slice(0, this.getMaxSlots());
this.saveProfileData();
}
const chosen = this.selectedDeck.length > 0 ? this.selectedDeck : this.defaultUnlocked;
const chosen = (this.selectedDeck && this.selectedDeck.length > 0) ? this.selectedDeck : this.defaultUnlocked;
this.cards = chosen.map(id => {
const found = this.allCards.find(c => c.id === id);
return found ? { ...found, timer: 0 } : null;
}).filter(Boolean);
// Guaranteed fallback: If this.cards is empty, restore default starter cards so top menu never disappears
if (!this.cards || this.cards.length === 0) {
this.selectedDeck = [...this.defaultUnlocked];
this.cards = this.defaultUnlocked.map(id => {
const found = this.allCards.find(c => c.id === id);
return found ? { ...found, timer: 0 } : null;
}).filter(Boolean);
this.saveProfileData();
}
}
reloadProfileData() {
@@ -720,6 +730,9 @@ window.EconomySystem = class EconomySystem {
}
// 2. Draw Cards
if (!this.isConveyor && !this.isIZombie && (!this.cards || this.cards.length === 0)) {
this.setDeckFromSelection();
}
const cardStartX = 105;
const cardY = 8;
const cardW = 66;