/** * Cosmic Garden - Achievement Definitions & Checker */ const ACHIEVEMENTS = { // Click achievements firstClick: { id: 'firstClick', name: 'First Contact', description: 'Click for the first time', icon: '👆', condition: (state) => state.totalClicks >= 1 }, clicker: { id: 'clicker', name: 'Clicker', description: 'Click 100 times', icon: '🖱️', condition: (state) => state.totalClicks >= 100 }, spammer: { id: 'spammer', name: 'Spam Finger', description: 'Click 1,000 times', icon: '🔥', condition: (state) => state.totalClicks >= 1000 }, clickMaster: { id: 'clickMaster', name: 'Click Master', description: 'Click 10,000 times', icon: '⚡', condition: (state) => state.totalClicks >= 10000 }, // Stardust achievements dustCollector: { id: 'dustCollector', name: 'Dust Collector', description: 'Earn 1,000 total stardust', icon: '✨', condition: (state) => state.totalStardust >= 1000 }, stardustMagnate: { id: 'stardustMagnate', name: 'Stardust Magnate', description: 'Earn 100,000 total stardust', icon: '💫', condition: (state) => state.totalStardust >= 100000 }, cosmicTycoon: { id: 'cosmicTycoon', name: 'Cosmic Tycoon', description: 'Earn 10,000,000 total stardust', icon: '🌟', condition: (state) => state.totalStardust >= 10000000 }, galaxyBaron: { id: 'galaxyBaron', name: 'Galaxy Baron', description: 'Earn 1,000,000,000 total stardust', icon: '👑', condition: (state) => state.totalStardust >= 1000000000 }, // Building achievements firstPlant: { id: 'firstPlant', name: 'First Plant', description: 'Buy your first building', icon: '🌱', condition: (state) => Object.values(state.buildings).some(c => c >= 1) }, gardenStart: { id: 'gardenStart', name: 'Garden Starter', description: 'Own 10 total buildings', icon: '🌿', condition: (state) => Object.values(state.buildings).reduce((a, b) => a + b, 0) >= 10 }, gardenCenter: { id: 'gardenCenter', name: 'Garden Center', description: 'Own 50 total buildings', icon: '🏡', condition: (state) => Object.values(state.buildings).reduce((a, b) => a + b, 0) >= 50 }, cosmicGarden: { id: 'cosmicGarden', name: 'Cosmic Garden', description: 'Own 100 total buildings', icon: '🌌', condition: (state) => Object.values(state.buildings).reduce((a, b) => a + b, 0) >= 100 }, // Specific building achievements sproutFarmer: { id: 'sproutFarmer', name: 'Sprout Farmer', description: 'Own 25 Star Sprouts', icon: '🌱', condition: (state) => (state.buildings.starSprout || 0) >= 25 }, bloomGarden: { id: 'bloomGarden', name: 'Bloom Garden', description: 'Own 25 Moon Blooms', icon: '🌸', condition: (state) => (state.buildings.moonBloom || 0) >= 25 }, solarPowered: { id: 'solarPowered', name: 'Solar Powered', description: 'Own 25 Solar Leaves', icon: '☀️', condition: (state) => (state.buildings.solarLeaf || 0) >= 25 }, // Production achievements steadyStream: { id: 'steadyStream', name: 'Steady Stream', description: 'Reach 100 stardust/sec', icon: '💧', condition: (state) => Game.getProductionPerSecond() >= 100 }, rushingRiver: { id: 'rushingRiver', name: 'Rushing River', description: 'Reach 1,000 stardust/sec', icon: '🌊', condition: (state) => Game.getProductionPerSecond() >= 1000 }, cosmicFlood: { id: 'cosmicFlood', name: 'Cosmic Flood', description: 'Reach 100,000 stardust/sec', icon: '🌊', condition: (state) => Game.getProductionPerSecond() >= 100000 } }; const Achievements = { /** * Check all achievements and unlock new ones */ check() { for (const [id, achievement] of Object.entries(ACHIEVEMENTS)) { if (Game.state.achievements.includes(id)) continue; if (achievement.condition(Game.state)) { Game.state.achievements.push(id); UI.showNotification(`Achievement: ${achievement.name}!`, 'achievement'); // Particle effect for achievement unlock const countEl = document.querySelector('#achievements-tab h3'); if (countEl) { const rect = countEl.getBoundingClientRect(); Particles.createAchievementEffect(rect.left + rect.width / 2, rect.top + rect.height / 2); } console.log(`🏆 Achievement unlocked: ${achievement.name}`); } } }, /** * Get achievement count */ getCount() { return Game.state.achievements.length; }, /** * Get total achievements */ getTotal() { return Object.keys(ACHIEVEMENTS).length; } }; window.ACHIEVEMENTS = ACHIEVEMENTS; window.Achievements = Achievements;