Skip to content

Commit dd4c87f

Browse files
authored
Add XP mining on skills (#246)
1 parent db3d97b commit dd4c87f

File tree

3 files changed

+140
-7
lines changed

3 files changed

+140
-7
lines changed

src/_includes/footer.njk

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,23 @@
7272
<span class="opacity-50">+1 LVL</span>
7373
</button>
7474

75-
<button
76-
onclick="toggleScreenshotMode()"
77-
class="w-full flex justify-between items-center p-2 mb-2 rounded-md border border-white/5 bg-white/5 text-[10px] font-mono text-slate-400 hover:bg-white/10 hover:border-slate-400 hover:translate-x-1 transition-all duration-200 cursor-pointer"
78-
>
79-
<span class="flex items-center gap-2">📸 SCREENSHOT</span>
80-
<span class="opacity-50">[5 seconds]</span>
81-
</button>
75+
<div class="flex flex-col gap-2 mt-4 pt-4 border-t border-white/10">
76+
<button
77+
onclick="addExperience(5)"
78+
class="w-full flex justify-between items-center p-2 rounded-md border border-cyan-500/30 bg-cyan-500/5 text-[10px] font-mono text-cyan-400 hover:bg-cyan-500/20 hover:border-cyan-400 transition-all cursor-pointer"
79+
>
80+
<span class="flex items-center gap-2">💎 SIMULATE SKILL MINING</span>
81+
<span class="opacity-60">+5 XP</span>
82+
</button>
83+
84+
<button
85+
onclick="toggleScreenshotMode()"
86+
class="w-full flex justify-between items-center p-2 rounded-md border border-white/5 bg-white/5 text-[10px] font-mono text-slate-400 hover:bg-white/10 hover:border-slate-400 transition-all cursor-pointer"
87+
>
88+
<span class="flex items-center gap-2">📸 SCREENSHOT MODE</span>
89+
<span class="opacity-40">[5S]</span>
90+
</button>
91+
</div>
8292

8393
<div class="pt-2">
8494
<button onclick="localStorage.clear(); location.reload();" class="w-full py-3 bg-blue-600/20 hover:bg-blue-600/40 text-blue-400 text-[10px] font-bold border border-blue-500/30 rounded-lg transition-all">

src/assets/css/style.css

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,3 +343,51 @@ html body #dev-tools[data-lock="true"] {
343343
filter: drop-shadow(0 0 12px var(--accent)) hue-rotate(360deg);
344344
}
345345
}
346+
/* Visual feedback when hovering a skill to gain XP */
347+
.mining-xp {
348+
filter: brightness(1.5);
349+
box-shadow: 0 0 15px var(--accent);
350+
transition: all 0.2s ease;
351+
}
352+
353+
/* Special styling for those who have reached Level 5 (Data Miner) */
354+
body[data-level="5"] .skill-item {
355+
border-color: #06b6d4 !important; /* Data Miner Cyan */
356+
background: rgba(6, 182, 212, 0.1) !important;
357+
position: relative;
358+
overflow: hidden;
359+
}
360+
361+
/* Add a gem-like sparkle to skills at Level 5 */
362+
body[data-level="5"] .skill-item::before {
363+
content: '';
364+
position: absolute;
365+
top: -50%;
366+
left: -50%;
367+
width: 200%;
368+
height: 200%;
369+
background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
370+
transform: rotate(45deg);
371+
animation: gem-shimmer 3s infinite;
372+
}
373+
374+
@keyframes gem-shimmer {
375+
0% { transform: translateX(-100%) rotate(45deg); }
376+
100% { transform: translateX(100%) rotate(45deg); }
377+
}
378+
@keyframes float-up {
379+
0% { transform: translate(-50%, 0); opacity: 1; }
380+
100% { transform: translate(-50%, -50px); opacity: 0; }
381+
}
382+
383+
/* Level 5 Specific Visual Perk */
384+
.level-architect .skill-item,
385+
body[data-level="5"] .skill-item {
386+
border-color: #06b6d4 !important;
387+
background: rgba(6, 182, 212, 0.1) !important;
388+
box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
389+
}
390+
391+
.skill-item {
392+
cursor: crosshair; /* Makes it feel like you are "mining" */
393+
}

src/assets/js/script.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,85 @@ window.toggleScreenshotMode = function() {
520520
document.addEventListener('DOMContentLoaded', () => {
521521
const devToolsVisible = localStorage.getItem('devToolsVisible') === 'true';
522522
const devPanel = document.getElementById('dev-tools');
523+
// Add this to your initialization script
524+
let skillHoverCount = 0;
525+
523526
if (devToolsVisible && devPanel) {
524527
devPanel.classList.remove('hidden');
525528
}
526529

527530
applyTheme(localStorage.getItem('theme') || 'light');
528531
updateGameUI();
529532
});
533+
534+
/**
535+
* 9. ENHANCED XP & SKILL MINING SYSTEM
536+
*/
537+
let currentXP = JSON.parse(localStorage.getItem('userXP')) || 0;
538+
const XP_PER_LEVEL = 20; // Adjust this to make leveling harder/easier
539+
540+
function addExperience(amount) {
541+
// Stop XP if at Max Level or if system is locked (Self-Destruct)
542+
const isLocked = document.getElementById('dev-tools')?.hasAttribute('data-lock');
543+
if (unlockedEggs.length >= LEVELS.length - 1 || isLocked) return;
544+
545+
currentXP += amount;
546+
547+
// Check for Level Up
548+
// If XP exceeds threshold, we "unlock" a new egg/level
549+
if (currentXP >= XP_PER_LEVEL) {
550+
currentXP = 0; // Reset for next level
551+
unlockEgg(`level_up_${unlockedEggs.length + 1}`);
552+
}
553+
554+
localStorage.setItem('userXP', JSON.stringify(currentXP));
555+
updateGameUI();
556+
}
557+
558+
function createFloatingXP(event) {
559+
const float = document.createElement('div');
560+
// Color matches Level 5 "Data Miner" Cyan
561+
const levelColor = LEVELS[unlockedEggs.length]?.color || '#06b6d4';
562+
563+
float.innerText = '+1 XP';
564+
float.style.cssText = `
565+
position: fixed;
566+
left: ${event.clientX}px;
567+
top: ${event.clientY}px;
568+
color: ${levelColor};
569+
font-family: monospace;
570+
font-weight: 900;
571+
font-size: 14px;
572+
pointer-events: none;
573+
z-index: 10000;
574+
animation: float-up 0.8s ease-out forwards;
575+
text-shadow: 0 0 10px rgba(0,0,0,0.5);
576+
`;
577+
578+
document.body.appendChild(float);
579+
setTimeout(() => float.remove(), 800);
580+
}
581+
582+
function initSkillXP() {
583+
const skills = document.querySelectorAll('.skill-item');
584+
skills.forEach(skill => {
585+
skill.addEventListener('mouseenter', (e) => {
586+
const isLocked = document.getElementById('dev-tools')?.hasAttribute('data-lock');
587+
if (!isLocked) {
588+
addExperience(1);
589+
createFloatingXP(e);
590+
591+
// Fancy scale-up on hover
592+
skill.style.transform = "scale(1.1) translateY(-2px)";
593+
skill.style.transition = "transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275)";
594+
}
595+
});
596+
597+
skill.addEventListener('mouseleave', () => {
598+
skill.style.transform = "scale(1) translateY(0)";
599+
});
600+
});
601+
}
602+
603+
// Re-initialize skills after Surprise scroll or any DOM changes
604+
window.addEventListener('DOMContentLoaded', initSkillXP);

0 commit comments

Comments
 (0)