/** * MUSEUM EVOLUTION SYSTEM * 3-stage museum restoration with artifact collection * Integrates with Kustos NPC and quest system */ export class MuseumEvolutionSystem { constructor(scene) { this.scene = scene; // Museum evolution stages this.currentStage = 0; // 0 = ruined, 1 = partial, 2 = advanced, 3 = complete // Artifact collection this.artifacts = new Map(); // artifactId → artifactData this.collectedArtifacts = new Set(); // Album tracking this.albumCategories = new Map(); this.init(); } init() { this.initializeArtifactDatabase(); this.initializeAlbumCategories(); } /** * Initialize all collectible artifacts */ initializeArtifactDatabase() { const artifacts = [ // Pre-war artifacts { id: 'dino_skull', name: 'Dinosaur Skull', category: 'prehistory', rarity: 'legendary', discoveryReward: 500 }, { id: 'ancient_vase', name: 'Ancient Vase', category: 'prehistory', rarity: 'rare', discoveryReward: 100 }, { id: 'fossil', name: 'Fossil', category: 'prehistory', rarity: 'common', discoveryReward: 50 }, // 2084 tech artifacts { id: 'ai_core', name: 'AI Core Fragment', category: '2084_tech', rarity: 'legendary', discoveryReward: 800 }, { id: 'hologram_projector', name: 'Hologram Projector', category: '2084_tech', rarity: 'rare', discoveryReward: 150 }, { id: 'old_smartphone', name: 'Pre-War Smartphone', category: '2084_tech', rarity: 'uncommon', discoveryReward: 80 }, // Cultural artifacts { id: 'religious_icon', name: 'Religious Icon', category: 'culture', rarity: 'rare', discoveryReward: 120 }, { id: 'painting', name: 'Old Painting', category: 'culture', rarity: 'uncommon', discoveryReward: 90 }, { id: 'book_collection', name: 'Rare Book Collection', category: 'culture', rarity: 'rare', discoveryReward: 110 }, // Post-apocalypse relics { id: 'first_cannabis_seed', name: 'First Cannabis Seed', category: 'post_apo', rarity: 'legendary', discoveryReward: 600 }, { id: 'zombie_variant_sample', name: 'Zombie Variant Sample', category: 'post_apo', rarity: 'rare', discoveryReward: 140 }, { id: 'survival_journal', name: "Survivor's Journal", category: 'post_apo', rarity: 'uncommon', discoveryReward: 70 } ]; artifacts.forEach(artifact => { this.artifacts.set(artifact.id, { ...artifact, discovered: false, donatedToMuseum: false, discoveryDate: null }); }); } /** * Initialize album categories for organization */ initializeAlbumCategories() { this.albumCategories.set('prehistory', { name: 'Prehistoric Era', description: 'Artifacts from Earth\'s ancient past', totalArtifacts: 3, collected: 0 }); this.albumCategories.set('2084_tech', { name: '2084 Technology', description: 'Advanced tech from before The Collapse', totalArtifacts: 3, collected: 0 }); this.albumCategories.set('culture', { name: 'Cultural Heritage', description: 'Art, religion, and culture of the old world', totalArtifacts: 3, collected: 0 }); this.albumCategories.set('post_apo', { name: 'Post-Apocalypse', description: 'Relics from the new world', totalArtifacts: 3, collected: 0 }); } /** * Discover artifact (player finds it) */ discoverArtifact(artifactId, location) { const artifact = this.artifacts.get(artifactId); if (!artifact) return false; if (artifact.discovered) { console.warn(`Artifact ${artifactId} already discovered`); return false; } artifact.discovered = true; artifact.discoveryDate = Date.now(); artifact.discoveryLocation = location; // Add to player inventory this.scene.inventorySystem.addItem(artifactId, 1); // Notification this.scene.uiSystem?.showNotification( `Artifact discovered: ${artifact.name}!`, 'discovery', { rarity: artifact.rarity } ); // Reward currency this.scene.economySystem.addCurrency(artifact.discoveryReward); // VFX this.scene.vfxSystem?.playEffect('artifact_discovery', this.scene.player.x, this.scene.player.y); console.log(`✨ Discovered artifact: ${artifact.name} (+${artifact.discoveryReward} coins)`); // Kustos dialogue trigger if (!artifact.donatedToMuseum) { this.triggerKustosDialogue(artifactId); } return true; } /** * Donate artifact to museum (Kustos interaction) */ donateArtifact(artifactId) { const artifact = this.artifacts.get(artifactId); if (!artifact || !artifact.discovered || artifact.donatedToMuseum) return false; // Remove from player inventory if (!this.scene.inventorySystem.hasItem(artifactId, 1)) { console.warn('Player does not have artifact in inventory'); return false; } this.scene.inventorySystem.removeItem(artifactId, 1); // Mark as donated artifact.donatedToMuseum = true; this.collectedArtifacts.add(artifactId); // Update category progress const category = this.albumCategories.get(artifact.category); category.collected++; // Kustos thanks dialogue this.scene.dialogueSystem?.startDialogue('kustos', 'thank_donation', { artifact: artifact.name }); // Check for museum evolution this.checkEvolutionTrigger(); // Achievement check this.checkCompletionAchievements(); console.log(`📦 Donated ${artifact.name} to museum`); return true; } /** * Check if museum should evolve to next stage */ checkEvolutionTrigger() { const totalDonated = this.collectedArtifacts.size; // Stage thresholds const stageThresholds = { 1: 4, // Stage 1: 4 artifacts donated 2: 8, // Stage 2: 8 artifacts donated 3: 12 // Stage 3: All 12 artifacts donated }; // Check for evolution for (let stage = 3; stage >= 1; stage--) { if (totalDonated >= stageThresholds[stage] && this.currentStage < stage) { this.evolveMuseum(stage); break; } } } /** * Evolve museum to next stage */ evolveMuseum(newStage) { if (newStage <= this.currentStage) return; this.currentStage = newStage; // Update building visual this.updateMuseumVisual(newStage); // VFX: Building evolution this.scene.vfxSystem?.playEffect('museum_evolution', 1500, 600); // Notification const stageNames = { 1: 'Partial Collection', 2: 'Advanced Exhibition', 3: 'World-Class Museum' }; this.scene.uiSystem?.showNotification( `Museum evolved: ${stageNames[newStage]}!`, 'success' ); // Kustos special dialogue this.scene.dialogueSystem?.startDialogue('kustos', `museum_stage_${newStage}`); // Grant benefits this.grantStageBenefits(newStage); console.log(`🏛️ Museum evolved to Stage ${newStage}: ${stageNames[newStage]}`); } /** * Update museum building sprite */ updateMuseumVisual(stage) { // Load corresponding sprite: museum_stage_1, museum_stage_2, museum_stage_3 const sprite = this.scene.buildingSystem.getBuilding('museum'); if (sprite) { sprite.setTexture(`museum_stage_${stage}`); } } /** * Grant benefits for reaching museum stage */ grantStageBenefits(stage) { switch (stage) { case 1: // Stage 1: Basic lore access this.scene.gameState.unlocks.lore_system = true; this.scene.uiSystem?.unlockTab('lore'); break; case 2: // Stage 2: Research bonuses this.scene.gameState.buffs.research_speed = 1.25; // +25% research break; case 3: // Stage 3: Full collection bonus this.scene.gameState.buffs.artifact_discovery = 2.0; // 2x artifact find rate this.scene.achievementSystem?.unlock('master_curator'); break; } } /** * Trigger Kustos dialogue about found artifact */ triggerKustosDialogue(artifactId) { const artifact = this.artifacts.get(artifactId); // Show notification to visit Kustos this.scene.uiSystem?.showNotification( `Kustos might be interested in the ${artifact.name}`, 'info', { icon: 'museum' } ); } /** * Check for collection completion achievements */ checkCompletionAchievements() { // Check category completion this.albumCategories.forEach((category, categoryId) => { if (category.collected === category.totalArtifacts) { this.scene.achievementSystem?.unlock(`complete_${categoryId}_collection`); } }); // Check total completion if (this.collectedArtifacts.size === this.artifacts.size) { this.scene.achievementSystem?.unlock('complete_museum_collection'); } } /** * Get album progress */ getAlbumProgress() { const categories = {}; this.albumCategories.forEach((category, categoryId) => { categories[categoryId] = { ...category, progress: Math.round((category.collected / category.totalArtifacts) * 100) }; }); return { categories, totalArtifacts: this.artifacts.size, totalCollected: this.collectedArtifacts.size, overallProgress: Math.round((this.collectedArtifacts.size / this.artifacts.size) * 100) }; } /** * Get artifacts by category for UI display */ getArtifactsByCategory(categoryId) { return Array.from(this.artifacts.values()) .filter(a => a.category === categoryId); } /** * Get museum stage info */ getStageInfo() { const stageData = { 0: { name: 'Ruined', description: 'Museum is destroyed' }, 1: { name: 'Partial Collection', description: '4 artifacts displayed' }, 2: { name: 'Advanced Exhibition', description: '8 artifacts displayed' }, 3: { name: 'World-Class Museum', description: 'All 12 artifacts displayed' } }; return { currentStage: this.currentStage, ...stageData[this.current Stage], nextStageRequirement: this.currentStage < 3 ? [4, 8, 12][this.currentStage] : null, currentArtifacts: this.collectedArtifacts.size }; } }