feat: Add universal victory celebration modal, chamber item requirements, and fix broom & cauldron displays

This commit is contained in:
Maxi
2026-09-22 21:10:08 +02:00
parent cb8851b7a4
commit 8c3e60c1c4
19 changed files with 1149 additions and 92 deletions
+541 -5
View File
@@ -1517,6 +1517,215 @@ body {
}
/* ========================================================
MINI-GAME: DIE BRAUKÜCHE / CAULDRON BREW (/brew)
======================================================== */
.brew-container {
max-width: 520px;
margin: 0 auto;
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
padding: 0.5rem;
}
.recipe-book {
width: 100%;
background: rgba(22, 17, 30, 0.9);
border: 2px solid var(--gold);
border-radius: 14px;
padding: 1rem 1.2rem;
text-align: center;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}
.recipe-step-badge {
display: inline-block;
background: rgba(229, 185, 72, 0.2);
border: 1px solid var(--gold);
color: var(--gold);
font-size: 0.8rem;
font-weight: bold;
padding: 0.2rem 0.75rem;
border-radius: 20px;
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 0.3rem;
}
.cauldron-visual-container {
width: 100%;
max-width: 320px;
aspect-ratio: 320 / 280;
margin: 0 auto;
position: relative;
display: flex;
justify-content: center;
align-items: center;
filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.8));
}
.cauldron-svg {
width: 100%;
height: 100%;
overflow: visible;
}
.animated-flames {
animation: flameFlicker 0.6s infinite alternate ease-in-out;
transform-origin: 160px 260px;
}
@keyframes flameFlicker {
0% { transform: scaleY(0.92) scaleX(0.98); opacity: 0.85; }
100% { transform: scaleY(1.08) scaleX(1.02); opacity: 1; }
}
.bubble-anim {
animation: bubbleRise 1.6s infinite ease-in-out alternate;
}
.bubble-anim.b1 { animation-delay: 0.1s; }
.bubble-anim.b2 { animation-delay: 0.4s; }
.bubble-anim.b3 { animation-delay: 0.7s; }
.bubble-anim.b4 { animation-delay: 1.0s; }
.bubble-anim.b5 { animation-delay: 1.3s; }
@keyframes bubbleRise {
0% { transform: translateY(0); opacity: 0.4; }
50% { transform: translateY(-4px) scale(1.2); opacity: 0.8; }
100% { transform: translateY(2px) scale(0.9); opacity: 0.5; }
}
/* Ingredients Shelf */
.ingredients-shelf {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0.65rem;
width: 100%;
}
.ingredient-btn {
background: linear-gradient(135deg, rgba(30, 24, 42, 0.95), rgba(18, 14, 26, 0.95));
border: 2px solid rgba(229, 185, 72, 0.35);
border-radius: 12px;
padding: 0.85rem 0.5rem;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.3rem;
cursor: pointer;
font-family: inherit;
transition: all 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
touch-action: manipulation;
-webkit-user-select: none;
user-select: none;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.ingredient-btn:active {
transform: scale(0.94);
border-color: var(--gold);
}
.ingredient-btn:disabled {
opacity: 0.45;
cursor: not-allowed;
border-color: rgba(255, 255, 255, 0.1);
transform: none !important;
}
.ing-icon {
font-size: 2.2rem;
filter: drop-shadow(0 2px 5px rgba(0,0,0,0.6));
}
.ing-name {
color: var(--text-light);
font-size: 0.88rem;
font-weight: bold;
}
.ing-count {
color: var(--gold);
font-size: 0.78rem;
background: rgba(0, 0, 0, 0.4);
padding: 0.1rem 0.45rem;
border-radius: 8px;
}
/* Heat Control Panel */
.heat-control-panel {
display: none;
flex-direction: column;
align-items: center;
gap: 0.6rem;
width: 100%;
background: rgba(20, 16, 28, 0.9);
border: 2px solid var(--gold);
border-radius: 14px;
padding: 1rem 1.2rem;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}
.heat-control-panel.active {
display: flex;
}
.temp-bar-container {
width: 100%;
max-width: 320px;
height: 24px;
background: rgba(10, 8, 16, 0.9);
border: 2px solid #555;
border-radius: 12px;
position: relative;
overflow: hidden;
}
.temp-ideal-zone {
position: absolute;
top: 0;
bottom: 0;
background: rgba(46, 204, 113, 0.35);
border-left: 2px solid #2ecc71;
border-right: 2px solid #2ecc71;
z-index: 1;
}
.temp-indicator {
height: 100%;
width: 20%;
background: linear-gradient(90deg, #3498db, #f39c12, #e74c3c);
border-radius: 10px;
transition: width 0.15s ease-out, background 0.2s ease;
z-index: 2;
position: relative;
}
.bellows-btn {
background: linear-gradient(135deg, #d35400, #c0392b);
border: 2px solid #f39c12;
border-radius: 12px;
color: #ffffff;
font-family: inherit;
font-size: 1.15rem;
font-weight: bold;
padding: 0.85rem 2rem;
cursor: pointer;
box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
touch-action: manipulation;
-webkit-user-select: none;
user-select: none;
transition: transform 0.1s ease, box-shadow 0.1s ease;
margin-top: 0.3rem;
}
.bellows-btn:active {
transform: scale(0.94);
box-shadow: 0 2px 8px rgba(231, 76, 60, 0.6);
}
/* ========================================================
MINI-GAME: WICHTEL-PANIK / CORNISH PIXIES (/pixies)
======================================================== */
@@ -1640,22 +1849,349 @@ body {
100% { transform: translateY(0) rotate(6deg); }
}
/* Flight Start Overlay */
/* Flight Canvas Wrapper & Start Overlay */
.canvas-wrapper {
position: relative;
width: 100%;
max-width: 800px;
margin: 0 auto;
overflow: hidden;
border-radius: 14px;
box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}
.flight-start-overlay {
position: absolute;
inset: 0;
background: rgba(12, 10, 20, 0.9);
background: rgba(12, 10, 20, 0.93);
border: 2px solid var(--gold);
border-radius: 14px;
z-index: 25;
z-index: 50;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 1.5rem;
text-align: center;
backdrop-filter: blur(4px);
box-shadow: 0 0 30px rgba(0, 0, 0, 0.9);
backdrop-filter: blur(6px);
box-shadow: 0 0 35px rgba(0, 0, 0, 0.95);
pointer-events: auto;
}
.flight-start-overlay.hidden {
display: none !important;
opacity: 0 !important;
pointer-events: none !important;
visibility: hidden !important;
}
/* Chamber Locked Screen */
.chamber-lock-banner {
background: linear-gradient(135deg, rgba(30, 20, 25, 0.95), rgba(18, 12, 18, 0.98));
border: 2px dashed #e74c3c;
border-radius: 16px;
padding: 2.2rem 1.5rem;
text-align: center;
margin: 1.5rem auto;
max-width: 600px;
box-shadow: 0 0 35px rgba(231, 76, 60, 0.25);
position: relative;
}
.chamber-lock-icon {
font-size: 3.6rem;
margin-bottom: 0.5rem;
animation: lockJiggle 2.5s infinite ease-in-out;
}
@keyframes lockJiggle {
0%, 100% { transform: rotate(0deg); }
15% { transform: rotate(-9deg); }
30% { transform: rotate(9deg); }
45% { transform: rotate(-5deg); }
60% { transform: rotate(0deg); }
}
.chamber-lock-title {
color: #e74c3c;
font-size: 1.7rem;
margin-bottom: 0.6rem;
}
.chamber-lock-desc {
color: var(--text-light);
font-size: 1.05rem;
line-height: 1.55;
margin-bottom: 1.3rem;
}
.chamber-req-box {
display: inline-flex;
align-items: center;
gap: 0.9rem;
background: rgba(0, 0, 0, 0.55);
border: 2px solid var(--gold);
border-radius: 12px;
padding: 0.85rem 1.4rem;
margin-bottom: 1.5rem;
text-align: left;
box-shadow: 0 0 20px rgba(229, 185, 72, 0.2);
}
.chamber-req-icon {
font-size: 2.4rem;
}
.chamber-req-info strong {
display: block;
color: var(--gold);
font-size: 1.15rem;
}
.chamber-req-info span {
color: var(--text-dim);
font-size: 0.88rem;
}
.chamber-lock-actions {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.85rem;
}
.alohomora-link {
color: var(--text-dim);
font-size: 0.85rem;
text-decoration: underline;
cursor: pointer;
transition: color 0.2s;
background: none;
border: none;
padding: 0.3rem 0.6rem;
}
.alohomora-link:hover {
color: var(--gold);
}
/* ========================================================
VICTORY CELEBRATION MODAL & PARTICLES
======================================================== */
.victory-modal-backdrop {
position: fixed;
inset: 0;
background: rgba(6, 4, 12, 0.94);
backdrop-filter: blur(10px);
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
padding: 1rem;
opacity: 0;
pointer-events: none;
visibility: hidden;
transition: opacity 0.35s ease, visibility 0.35s ease;
}
.victory-modal-backdrop.show {
opacity: 1;
pointer-events: auto;
visibility: visible;
}
.victory-confetti-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 1;
}
.victory-card {
position: relative;
z-index: 2;
background: linear-gradient(135deg, rgba(26, 18, 40, 0.98), rgba(14, 10, 22, 0.98));
border: 3px solid var(--gold);
border-radius: 20px;
max-width: 520px;
width: 100%;
padding: 2rem 1.5rem;
text-align: center;
box-shadow: 0 0 50px rgba(229, 185, 72, 0.45), inset 0 0 30px rgba(0, 0, 0, 0.8);
transform: scale(0.85);
transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
max-height: 90vh;
overflow-y: auto;
}
.victory-modal-backdrop.show .victory-card {
transform: scale(1);
}
.victory-crest-wrap {
position: relative;
width: 85px;
height: 85px;
margin: 0 auto 0.75rem auto;
display: flex;
align-items: center;
justify-content: center;
}
.victory-crest-icon {
font-size: 3.8rem;
filter: drop-shadow(0 0 20px #ffd700);
animation: victoryCrestBounce 1s infinite alternate ease-in-out;
position: relative;
z-index: 2;
}
@keyframes victoryCrestBounce {
0% { transform: translateY(0) scale(1); }
100% { transform: translateY(-8px) scale(1.08); }
}
.victory-chamber-badge {
display: inline-block;
background: rgba(229, 185, 72, 0.2);
border: 1px solid var(--gold);
color: var(--gold);
font-weight: bold;
padding: 0.25rem 0.85rem;
border-radius: 20px;
font-size: 0.85rem;
letter-spacing: 1px;
text-transform: uppercase;
margin-bottom: 0.4rem;
}
.victory-title {
font-size: clamp(1.5rem, 5vw, 2.1rem);
color: #ffd700;
margin-bottom: 0.6rem;
text-shadow: 0 2px 10px rgba(255, 215, 0, 0.4);
}
.victory-stats-box {
display: flex;
justify-content: center;
gap: 1.2rem;
margin-bottom: 1.2rem;
font-size: 0.95rem;
color: var(--text-light);
background: rgba(0, 0, 0, 0.35);
padding: 0.5rem 1rem;
border-radius: 10px;
}
.victory-reward-box {
display: flex;
align-items: center;
gap: 1rem;
background: linear-gradient(135deg, rgba(229, 185, 72, 0.15), rgba(46, 204, 113, 0.1));
border: 2px solid var(--gold);
border-radius: 14px;
padding: 0.85rem 1rem;
margin-bottom: 1.25rem;
text-align: left;
box-shadow: 0 0 20px rgba(229, 185, 72, 0.25);
animation: rewardGlow 2s infinite alternate;
}
@keyframes rewardGlow {
0% { box-shadow: 0 0 10px rgba(229, 185, 72, 0.2); }
100% { box-shadow: 0 0 25px rgba(229, 185, 72, 0.5); }
}
.reward-icon {
font-size: 2.8rem;
filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
animation: rewardPop 0.6s ease-out;
}
@keyframes rewardPop {
0% { transform: scale(0.4) rotate(-20deg); opacity: 0; }
70% { transform: scale(1.25) rotate(10deg); }
100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.reward-label {
display: block;
font-size: 0.78rem;
color: var(--gold-light);
text-transform: uppercase;
letter-spacing: 0.5px;
}
.reward-name {
display: block;
font-size: 1.15rem;
color: #ffffff;
margin: 0.1rem 0;
}
.reward-desc {
font-size: 0.82rem;
color: var(--text-dim);
margin: 0;
line-height: 1.3;
}
.victory-story-box {
font-family: 'Caveat', cursive;
font-size: 1.35rem;
color: #e0d0b8;
line-height: 1.5;
background: rgba(15, 10, 20, 0.6);
border-left: 3px solid var(--gold);
padding: 0.75rem 1rem;
margin-bottom: 1.5rem;
text-align: left;
border-radius: 0 8px 8px 0;
}
.victory-actions {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.victory-next-btn {
font-size: 1.25rem !important;
padding: 0.95rem 1.5rem !important;
box-shadow: 0 0 25px rgba(229, 185, 72, 0.6) !important;
animation: nextBtnPulse 1.8s infinite ease-in-out;
}
@keyframes nextBtnPulse {
0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(229, 185, 72, 0.5); }
50% { transform: scale(1.03); box-shadow: 0 0 32px rgba(229, 185, 72, 0.85); }
}
.victory-sub-actions {
display: flex;
justify-content: center;
gap: 1rem;
}
.btn-subtle {
background: transparent;
border: 1px solid rgba(229, 185, 72, 0.4);
color: var(--text-light);
border-radius: 8px;
padding: 0.5rem 0.9rem;
font-size: 0.9rem;
cursor: pointer;
text-decoration: none;
transition: all 0.2s;
}
.btn-subtle:hover {
background: rgba(229, 185, 72, 0.15);
border-color: var(--gold);
color: var(--gold);
}
/* Mobile responsive adjustments */
+29 -12
View File
@@ -123,19 +123,36 @@
const data = await res.json();
if (data.result === 'success_ahead') {
if (window.soundFX) window.soundFX.playMagicSuccess();
if (window.notifyNewItem && data.new_item) {
window.notifyNewItem(data.new_item);
if (window.showChamberVictory) {
window.showChamberVictory({
chamberBadge: "Kammer VI: Snapes Flaschenrätsel",
title: "🔥 Schwarzes Feuer Durchquert!",
statsHtml: `<span>🧪 Flasche 3 (Zwerg): <strong>Schutztrank</strong></span><span>🔥 Schwarzes Feuer: <strong>Besiegt!</strong></span>`,
item: data.new_item || {
id: "philosophers_stone",
name: "Stein der Weisen",
icon: "💎",
desc: "Der legendäre rote Alchemistenstein!"
},
storyText: "Ein eisiger Frosthauch hüllt deinen Körper ein! Du schreitest durch das tosend schwarze Feuer, ohne auch nur ein Haar zu versengen. Dahinter enthüllt sich das größte Geheimnis von Hogwarts: <strong>Der Spiegel Nerhegeb und der Stein der Weisen</strong>!",
nextUrl: "/finale",
nextBtnText: "➔ Zum großen Finale: Der Stein der Weisen 💎"
});
} else {
if (window.soundFX) window.soundFX.playMagicSuccess();
if (window.notifyNewItem && data.new_item) {
window.notifyNewItem(data.new_item);
}
modalIcon.innerText = "❄️⚡";
modalTitle.innerText = "Hervorragend kombiniert!";
modalTitle.style.color = "#ffd700";
modalText.innerHTML = `Du hast die <strong>kleinste Flasche (Flasche 3, den 'Zwerg')</strong> getrunken!<br><br>
${data.message}<br><br>
Das schwarze Feuer teilt sich mit einem frostigen Zischen. Der Weg zum Stein der Weisen liegt frei vor dir!`;
modalBtn.innerText = "Zum Finale & Escape-Triumph 🏆";
modalBtn.onclick = () => { window.location.href = data.next_url; };
modalBackdrop.classList.add('show');
}
modalIcon.innerText = "❄️⚡";
modalTitle.innerText = "Hervorragend kombiniert!";
modalTitle.style.color = "#ffd700";
modalText.innerHTML = `Du hast die <strong>kleinste Flasche (Flasche 3, den 'Zwerg')</strong> getrunken!<br><br>
${data.message}<br><br>
Das schwarze Feuer teilt sich mit einem frostigen Zischen. Der Weg zum Stein der Weisen liegt frei vor dir!`;
modalBtn.innerText = "Zum Finale & Escape-Triumph 🏆";
modalBtn.onclick = () => { window.location.href = data.next_url; };
modalBackdrop.classList.add('show');
} else if (data.result === 'success_back') {
if (window.soundFX) window.soundFX.playMagicSuccess();
+23 -3
View File
@@ -215,16 +215,36 @@
if (window.navigator && window.navigator.vibrate) window.navigator.vibrate([50, 100, 150]);
// API Completion Call
let newItem = null;
try {
const res = await fetch('/api/brew/complete', { method: 'POST' });
const data = await res.json();
if (data.new_item && window.notifyNewItem) {
window.notifyNewItem(data.new_item);
}
if (data.new_item) newItem = data.new_item;
} catch (e) {
console.error("Brew complete error:", e);
}
if (!newItem) {
newItem = {
id: "felix_felicis",
name: "Felix Felicis",
icon: "🧪",
desc: "Ein Tropfen flüssiges Gold! Verleiht dir unerschütterliches Glück und enthüllt verborgene Runen."
};
}
if (successPanel) successPanel.style.display = 'block';
if (window.showChamberVictory) {
window.showChamberVictory({
chamberBadge: "Kammer III: Die Brauküche",
title: "⚗️ Zaubertrank Gemeistert!",
statsHtml: `<span>🧪 Elixier: <strong>Felix Felicis</strong></span><span>🌡️ Hitze: <strong>Perfekt gemeistert</strong></span>`,
item: newItem,
storyText: "Der Kessel erstrahlt in gleißendem, flüssigem Gold! Du füllst eine Phiole des unbezahlbaren <strong>Felix Felicis</strong> ab. Seine Wärme durchdringt deinen Geist. Mit geschärften Sinnen trittst du vor das gewaltige <strong>Runen-Drehschloss der vier Gründer</strong>!",
nextUrl: "/cryptex",
nextBtnText: "➔ Weiter zu Kammer IV: Das Drehschloss 🔐"
});
}
}
})();
+46 -16
View File
@@ -35,7 +35,10 @@
window.startFlight = function() {
const overlay = document.getElementById('broomStartOverlay');
if (overlay) overlay.style.display = 'none';
if (overlay) {
overlay.classList.add('hidden');
overlay.style.display = 'none';
}
rings.length = 0;
rings.push({ x: width + 60, y: height * 0.4, radius: 25, speed: 3.5, golden: false, collected: false, scale: 1, alpha: 1, pulse: 0 });
@@ -57,6 +60,20 @@
if (window.navigator && window.navigator.vibrate) window.navigator.vibrate(40);
};
// Explicitly bind click and pointerdown to start button for instant mobile activation
const startFlightBtn = document.getElementById('startFlightBtn');
if (startFlightBtn) {
const onStartTrigger = (e) => {
if (e) {
e.preventDefault();
e.stopPropagation();
}
window.startFlight();
};
startFlightBtn.addEventListener('click', onStartTrigger);
startFlightBtn.addEventListener('pointerdown', onStartTrigger);
}
// Player (Broomstick)
const player = {
x: 90,
@@ -505,7 +522,7 @@
requestAnimationFrame(loop);
async function onCourseWin(elapsedSec) {
if (window.soundFX) window.soundFX.playMagicSuccess();
let newItem = null;
try {
const res = await fetch('/api/broom/complete', {
method: 'POST',
@@ -513,23 +530,36 @@
body: JSON.stringify({ score: score, time_taken: elapsedSec })
});
const data = await res.json();
if (data.new_item && window.notifyNewItem) {
window.notifyNewItem(data.new_item);
}
if (data.new_item) newItem = data.new_item;
} catch (e) {
console.error(e);
}
modalTitle.innerText = "🏆 Ring-Parcours Gemeistert!";
modalText.innerHTML = `
Mit atemberaubenden Manövern hast du alle <strong>${TOTAL_RINGS_NEEDED} goldenen Ringe</strong> durchflogen!<br><br>
<strong>Flugzeit:</strong> ${elapsedSec} Sekunden<br>
<strong>Punkte:</strong> ${score}<br><br>
Madam Hooch nickt anerkennend und überreicht dir die Flug-Auszeichnung!<br>
Das Tor zur nächsten Kammer steht offen!
`;
modalBtn.innerText = "Weiter zum Zauberspruch-Duell 🪄";
modalBtn.onclick = () => { window.location.href = '/duel'; };
modalBackdrop.classList.add('show');
if (!newItem) {
newItem = {
id: "winged_key",
name: "Geflügelter Schlüssel",
icon: "🗝️",
desc: "Ein surrender Schlüssel mit Libellenflügeln. Er öffnet die Tür zur Duellier-Kammer!"
};
}
if (window.showChamberVictory) {
window.showChamberVictory({
chamberBadge: "Kammer I: Ring-Flug",
title: "🏆 Ring-Parcours Gemeistert!",
statsHtml: `<span>⏱️ Flugzeit: <strong>${elapsedSec}s</strong></span><span>✨ Punkte: <strong>${score} Pkt</strong></span><span>⭕ Ringe: <strong>${TOTAL_RINGS_NEEDED}/${TOTAL_RINGS_NEEDED}</strong></span>`,
item: newItem,
storyText: "Mit einem meisterhaften Sturzflug fängst du den surrenden <strong>geflügelten Schlüssel</strong>! Madam Hoochs Silberpfeife ertönt anerkennend über dem Schloss. Die massive Eichentür zur verzauberten <strong>Duellier-Kammer</strong> öffnet sich!",
nextUrl: "/duel",
nextBtnText: "➔ Weiter zu Kammer II: Spruch-Duell 🪄"
});
} else {
modalTitle.innerText = "🏆 Ring-Parcours Gemeistert!";
modalText.innerHTML = `Mit atemberaubenden Manövern hast du alle <strong>${TOTAL_RINGS_NEEDED} goldenen Ringe</strong> durchflogen!<br>Flugzeit: ${elapsedSec}s · Punkte: ${score}`;
modalBtn.innerText = "Weiter zum Zauberspruch-Duell 🪄";
modalBtn.onclick = () => { window.location.href = '/duel'; };
modalBackdrop.classList.add('show');
}
}
})();
+31 -3
View File
@@ -146,9 +146,24 @@
window.notifyNewItem(data.new_item);
}
setTimeout(() => {
if (successPanel) successPanel.style.display = 'block';
}, 600);
if (successPanel) successPanel.style.display = 'block';
if (window.showChamberVictory) {
window.showChamberVictory({
chamberBadge: "Kammer IV: Das Runen-Drehschloss",
title: "🔐 Gründer-Siegel Entriegelt!",
statsHtml: `<span>🦁 Löwe</span><span>🌙 Mond</span><span>🔥 Feuer</span><span>🪄 Zauberstab</span>`,
item: data.new_item || {
id: "cryptex_key",
name: "Schlüssel der Gründer",
icon: "🗝️",
desc: "Ein uralter Messingschlüssel. Er sperrt die Pforte zur Verteidigungs-Kammer auf!"
},
storyText: "Mit einem satten Grollen rasten die vier massiven Messingbolzen ein! Das Tor schnappt auf. Der <strong>Schlüssel der Gründer</strong> und <strong>Snapes Logik-Rolle</strong> wandern in deinen Beutel. Dahinter hörst du lautes Geschrei: <strong>Wichtel-Panik</strong>!",
nextUrl: "/pixies",
nextBtnText: "➔ Weiter zu Kammer V: Wichtel-Panik 🧚"
});
}
} else {
if (window.soundFX) window.soundFX.playWhoosh();
@@ -174,4 +189,17 @@
console.error("Cryptex check error:", e);
}
};
// Felix Felicis Lucky Intuition Action
window.useFelixFelicisHint = function() {
if (window.soundFX) window.soundFX.playMagicSuccess();
if (window.showFloatingToast) {
window.showFloatingToast("🍀 <strong>Felix Felicis wirkt!</strong> Eine goldene Stimme flüstert: <em>»Löwe 🦁 und Mond 🌙 weisen den Weg!«</em>");
}
// Guide dials 0 and 1
dials[0] = 0; // 🦁
dials[1] = 1; // 🌙
updateDialDisplay(0);
updateDialDisplay(1);
};
})();
+28 -14
View File
@@ -302,27 +302,41 @@
}
async function onDuelWon() {
if (window.soundFX) window.soundFX.playMagicSuccess();
let newItem = null;
try {
const res = await fetch('/api/duel/complete', { method: 'POST' });
const data = await res.json();
if (data.new_item && window.notifyNewItem) {
window.notifyNewItem(data.new_item);
}
if (data.new_item) newItem = data.new_item;
} catch (e) {
console.error(e);
}
modalTitle.innerText = "⚡ Duell Gemeistert!";
modalText.innerHTML = `
Mit meisterhafter Zauberstabführung hast du alle 3 Zaubersprüche entfesselt und die verzauberte Rüstung bezwungen!<br><br>
<strong>Gelehrte Sprüche:</strong> Flipendo ⚡, Incendio 🔥 & Alohomora 🗝️<br><br>
Die alte Rüstung verneigt sich ehrfürchtig. Das Tor öffnet sich und gibt den Weg zur dampfenden <strong>Zaubertrank-Brauküche</strong> frei!<br><br>
🎒 <em>Das goldene Duellanten-Abzeichen wurde deinem Zauberbeutel hinzugefügt!</em>
`;
modalBtn.innerText = "Weiter zur Zaubertrank-Brauküche ⚗️ ➔";
modalBtn.onclick = () => { window.location.href = '/brew'; };
modalBackdrop.classList.add('show');
if (!newItem) {
newItem = {
id: "duel_badge",
name: "Duellanten-Abzeichen & Kessel-Rezept",
icon: "⚡",
desc: "Ein goldenes Abzeichen und Snapes geheime Zaubertrank-Formel für die Brauküche."
};
}
if (window.showChamberVictory) {
window.showChamberVictory({
chamberBadge: "Kammer II: Das Spruch-Duell",
title: "⚡ Duell Gemeistert!",
statsHtml: `<span>🪄 Gesten: <strong>4 Sprüche</strong></span><span>🛡️ Rüstung: <strong>Bezwungen!</strong></span>`,
item: newItem,
storyText: "Die verzauberte Rüstung bricht klirrend in sich zusammen! In ihrem Brustharnisch liegt ein versiegeltes Pergament: <strong>Snapes geheime Rezeptur</strong> für die Kessel-Brauküche. Das schwere Fallgitter zur <strong>Zaubertrank-Brauküche</strong> hebt sich!",
nextUrl: "/brew",
nextBtnText: "➔ Weiter zu Kammer III: Brauküche ⚗️"
});
} else {
modalTitle.innerText = "⚡ Duell Gemeistert!";
modalText.innerHTML = `Mit meisterhafter Zauberstabführung hast du alle Sprüche entfesselt und die Rüstung bezwungen!`;
modalBtn.innerText = "Weiter zur Brauküche ⚗️";
modalBtn.onclick = () => { window.location.href = '/brew'; };
modalBackdrop.classList.add('show');
}
}
function render() {
+121
View File
@@ -230,6 +230,127 @@
window.showFloatingToast(`🎒 <strong>Neuer Gegenstand im Beutel:</strong> ${item.icon} ${item.name}!`);
};
// Confetti Animation Controller
let confettiAnimId = null;
function runVictoryConfetti() {
const canvas = document.getElementById('victoryConfettiCanvas');
if (!canvas) return;
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const colors = ['#ffd700', '#f39c12', '#e74c3c', '#3498db', '#2ecc71', '#9b59b6', '#ffffff'];
const particles = [];
for (let i = 0; i < 90; i++) {
particles.push({
x: Math.random() * canvas.width,
y: Math.random() * -canvas.height * 0.5,
w: Math.random() * 9 + 5,
h: Math.random() * 5 + 3,
vx: (Math.random() - 0.5) * 4,
vy: Math.random() * 3 + 2.5,
color: colors[Math.floor(Math.random() * colors.length)],
angle: Math.random() * Math.PI * 2,
vAngle: (Math.random() - 0.5) * 0.15,
shape: Math.random() > 0.4 ? 'rect' : 'star'
});
}
let start = Date.now();
if (confettiAnimId) cancelAnimationFrame(confettiAnimId);
function drawConfetti() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
const elapsed = (Date.now() - start) / 1000;
particles.forEach(p => {
p.x += p.vx;
p.y += p.vy;
p.angle += p.vAngle;
ctx.save();
ctx.translate(p.x, p.y);
ctx.rotate(p.angle);
ctx.fillStyle = p.color;
if (p.shape === 'star') {
ctx.beginPath();
ctx.arc(0, 0, p.w * 0.45, 0, Math.PI * 2);
ctx.fill();
} else {
ctx.fillRect(-p.w / 2, -p.h / 2, p.w, p.h);
}
ctx.restore();
if (p.y > canvas.height + 20) {
p.y = -20;
p.x = Math.random() * canvas.width;
}
});
if (elapsed < 8) {
confettiAnimId = requestAnimationFrame(drawConfetti);
} else {
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
}
confettiAnimId = requestAnimationFrame(drawConfetti);
}
// Unified Spectacular Victory Celebration Overlay
window.showChamberVictory = function(config) {
const modal = document.getElementById('victoryCelebrationModal');
if (!modal) {
// Fallback to standard modal if celebration overlay missing
if (window.modalTitle) window.modalTitle.innerText = config.title;
if (window.modalText) window.modalText.innerHTML = config.storyText;
if (window.modalBackdrop) window.modalBackdrop.classList.add('show');
return;
}
const badge = document.getElementById('vicChamberBadge');
const title = document.getElementById('vicTitle');
const statsBox = document.getElementById('vicStatsBox');
const itemBox = document.getElementById('vicItemRewardBox');
const rewardIcon = document.getElementById('vicRewardIcon');
const rewardName = document.getElementById('vicRewardName');
const rewardDesc = document.getElementById('vicRewardDesc');
const storyBox = document.getElementById('vicStoryBox');
const nextBtn = document.getElementById('vicNextBtn');
if (badge) badge.innerText = config.chamberBadge || 'Kammer Gemeistert';
if (title) title.innerText = config.title || 'Hervorragend!';
if (statsBox) {
statsBox.innerHTML = config.statsHtml || '';
statsBox.style.display = config.statsHtml ? 'flex' : 'none';
}
if (storyBox) storyBox.innerHTML = config.storyText || '';
if (config.item && itemBox) {
itemBox.style.display = 'flex';
if (rewardIcon) rewardIcon.innerText = config.item.icon || '✨';
if (rewardName) rewardName.innerText = config.item.name || '';
if (rewardDesc) rewardDesc.innerText = config.item.desc || '';
window.notifyNewItem(config.item);
} else if (itemBox) {
itemBox.style.display = 'none';
}
if (nextBtn) {
nextBtn.href = config.nextUrl || '/';
nextBtn.innerHTML = config.nextBtnText || '➔ Weiter zur nächsten Kammer ✨';
}
// Trigger Audio, Haptic & Particle Celebration
if (window.soundFX) window.soundFX.playMagicSuccess();
if (window.navigator && window.navigator.vibrate) {
window.navigator.vibrate([60, 50, 80, 50, 180]);
}
modal.classList.add('show');
runVictoryConfetti();
};
// Auto-select first item if available
if (itemSlots.length > 0) {
selectItem(itemSlots[0]);
+23 -8
View File
@@ -165,11 +165,7 @@
activeTargets.clear();
if (won) {
if (window.soundFX) window.soundFX.playMagicSuccess();
if (window.navigator && window.navigator.vibrate) {
window.navigator.vibrate([50, 100, 150]);
}
let newItem = null;
try {
const res = await fetch('/api/pixies/complete', {
method: 'POST',
@@ -177,15 +173,34 @@
body: JSON.stringify({ caught: score })
});
const data = await res.json();
if (data.new_item && window.notifyNewItem) {
window.notifyNewItem(data.new_item);
}
if (data.new_item) newItem = data.new_item;
} catch (e) {
console.error("Pixies complete error:", e);
}
if (!newItem) {
newItem = {
id: "pixie_jar",
name: "Wichtelglas",
icon: "🧚",
desc: "Ein dickbauchiges Glas mit einem gebannten Wichtel."
};
}
if (successPanel) successPanel.style.display = 'block';
if (window.showChamberVictory) {
window.showChamberVictory({
chamberBadge: "Kammer V: Wichtel-Panik",
title: "🧚 Wichtel Gebannt!",
statsHtml: `<span>❄️ Gebannt: <strong>${score} Wichtel</strong></span><span>👦 Neville: <strong>Gerettet</strong></span>`,
item: newItem,
storyText: "Mit blitzschnellen <em>Immobilus!</em>-Zaubern hast du alle 10 Wichtel eingefroren! Ein zappelnder Wichtel landet sicher im <strong>Wichtelglas</strong>. Neville bedankt sich erleichtert. Der Weg zur berüchtigten <strong>Flammenkammer von Severus Snape</strong> liegt nun offen!",
nextUrl: "/bottles",
nextBtnText: "➔ Weiter zu Kammer VI: Snapes Flaschen 🧪"
});
}
} else {
if (window.soundFX) window.soundFX.playWhoosh();
if (startOverlay) {
+19 -8
View File
@@ -125,14 +125,25 @@
fetch('/api/sliding/complete', { method: 'POST' }).catch(console.error);
modalTitle.innerText = "✨ Schieberätsel gelöst!";
modalText.innerHTML = `Mit geschicktem Schieben hast du alle 8 alchemistischen Phiolen in die perfekte harmonische Ordnung gebracht!<br><br>
<strong>Züge:</strong> ${moves}<br>
<strong>Zeit:</strong> ${secondsElapsed} Sekunden<br><br>
Die Runenplatte leuchtet golden auf und der Weg zur Flammenkammer öffnet sich!`;
modalBtn.innerText = "Zur Flammenkammer 🧪";
modalBtn.onclick = () => { window.location.href = '/bottles'; };
modalBackdrop.classList.add('show');
if (window.showChamberVictory) {
window.showChamberVictory({
chamberBadge: "Alchemie-Zusatzprüfung",
title: "✨ Schiebesiegel Gelöst!",
statsHtml: `<span>⚗️ Züge: <strong>${moves}</strong></span><span>⏱️ Zeit: <strong>${secondsElapsed}s</strong></span>`,
storyText: "Mit geschicktem Schieben hast du alle 8 alchemistischen Essenzen in harmonische Ordnung gebracht! Das antike Relief leuchtet golden auf.",
nextUrl: "/bottles",
nextBtnText: "➔ Weiter zu Snapes Flaschen 🧪"
});
} else {
modalTitle.innerText = "✨ Schieberätsel gelöst!";
modalText.innerHTML = `Mit geschicktem Schieben hast du alle 8 alchemistischen Phiolen in die perfekte harmonische Ordnung gebracht!<br><br>
<strong>Züge:</strong> ${moves}<br>
<strong>Zeit:</strong> ${secondsElapsed} Sekunden<br><br>
Die Runenplatte leuchtet golden auf und der Weg zur Flammenkammer öffnet sich!`;
modalBtn.innerText = "Zur Flammenkammer 🧪";
modalBtn.onclick = () => { window.location.href = '/bottles'; };
modalBackdrop.classList.add('show');
}
}
}