From e60d1ab841ff4e212439b13245722de61bd56bdd Mon Sep 17 00:00:00 2001 From: cay Date: Mon, 13 Apr 2026 11:55:29 +0100 Subject: [PATCH] dgfjnfgxy --- views/1v1-battlefield.ejs | 92 +- views/1v1-battlefield.ejs_old | 1496 +++++++++++++++++++++++++++++++++ 2 files changed, 1554 insertions(+), 34 deletions(-) create mode 100644 views/1v1-battlefield.ejs_old diff --git a/views/1v1-battlefield.ejs b/views/1v1-battlefield.ejs index 8d65fbd..08a51aa 100644 --- a/views/1v1-battlefield.ejs +++ b/views/1v1-battlefield.ejs @@ -502,11 +502,7 @@ /* ── Karte in Hand-Slot legen ──────────────────────── */ function setHandSlot(id, card) { - handSlotState[id] = { - card, - currentCd: card.cooldown ?? 0, - wasReduced: false, - }; + handSlotState[id] = { card, currentCd: card.cooldown ?? 0 }; renderHandSlot(id); } @@ -526,30 +522,7 @@ handCardIds.forEach((id) => { const state = handSlotState[id]; if (!state) return; - - const baseCd = Number(state.card.cooldown || 0); - - // Karte war diese Runde spielbar, wurde aber NICHT gespielt - if (state.currentCd <= 0 && !state.wasReduced) { - if (baseCd > 0) { - let reduced = Math.floor(baseCd / 2); - if (reduced < 1) reduced = 1; - - state.currentCd = reduced; - } else { - state.currentCd = 0; - } - - state.wasReduced = true; - } - - // Normales Cooldown runterzählen - else { - if (state.currentCd > 0) { - state.currentCd--; - } - } - + if (state.currentCd > 0) state.currentCd--; renderHandSlot(id); }); } @@ -579,16 +552,15 @@ } // Erste 3 in die Hand - for (let i = 0; i < 3; i++) { - if (expanded[i]) { - setHandSlot(handCardIds[i], expanded[i]); - } - } + handCardIds.forEach((id, i) => { + if (expanded[i]) setHandSlot(id, expanded[i]); + }); // Rest als Deck-Queue deckQueue = expanded.slice(3); const countEl = document.getElementById("deck-count"); if (countEl) countEl.textContent = deckQueue.length; + showMulliganOverlay(); } catch (e) { console.error("[Battlefield] Deck laden:", e); } @@ -1474,6 +1446,58 @@ ); }); + +// ═════════════════════════════════════════════ +// MULLIGAN SYSTEM (2x komplette neue Hand) +// ═════════════════════════════════════════════ +let mulliganLeft = 2; +let mulliganDone = false; + +function showMulliganOverlay() { + const overlay = document.createElement("div"); + overlay.id = "mulligan-overlay"; + overlay.style.cssText = "position:fixed;inset:0;background:rgba(0,0,0,.88);z-index:9999;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;font-family:'Cinzel',serif;"; + overlay.innerHTML = ` +
STARTHAND
+
Du kannst deine 3 Startkarten bis zu 2x komplett neu ziehen
+
+
+ + +
`; + document.body.appendChild(overlay); + renderMulliganCards(); + document.getElementById("btn-mulligan-redraw").addEventListener("click", doMulligan); + document.getElementById("btn-mulligan-ready").addEventListener("click", finishMulligan); +} +function renderMulliganCards() { + const wrap=document.getElementById("mulligan-cards"); if(!wrap) return; + wrap.innerHTML=""; + for(let i=0;i<3;i++){ + const state=handSlotState[handCardIds[i]]; if(!state) continue; + const card=state.card; + const el=document.createElement("div"); + el.style.cssText="width:130px;height:190px;border-radius:10px;overflow:hidden;border:2px solid rgba(255,215,80,.4);background:#111;box-shadow:0 8px 20px rgba(0,0,0,.5);"; + el.innerHTML=``; + wrap.appendChild(el); + } +} +function doMulligan() { + if(mulliganLeft<=0) return; + for(let i=0;i<3;i++){ + const id=handCardIds[i], state=handSlotState[id]; + if(state){ deckQueue.push(state.card); handSlotState[id]=null; renderHandSlot(id); } + } + for(let i=deckQueue.length-1;i>0;i--){ const j=Math.floor(Math.random()*(i+1)); [deckQueue[i],deckQueue[j]]=[deckQueue[j],deckQueue[i]]; } + for(let i=0;i<3;i++) drawNextCard(); + mulliganLeft--; + renderMulliganCards(); + const btn=document.getElementById("btn-mulligan-redraw"); + if(btn){ btn.textContent=`Neue Hand (${mulliganLeft})`; if(mulliganLeft<=0){btn.disabled=true;btn.style.opacity=".45";}} +} +function finishMulligan(){ mulliganDone=true; document.getElementById("mulligan-overlay")?.remove(); } + + /* ── Event-Listener ─────────────────────────────────── */ document .getElementById("bereit-btn") diff --git a/views/1v1-battlefield.ejs_old b/views/1v1-battlefield.ejs_old new file mode 100644 index 0000000..8d65fbd --- /dev/null +++ b/views/1v1-battlefield.ejs_old @@ -0,0 +1,1496 @@ + + + + + + <%= title || "Spielfeld" %> + + + + + + + +
+
+
Warte auf Gegner…
+

Verbindung wird hergestellt

+
+ +
+
+
<%= title || "Spielfeld" %>
+ + + + +
+
+
🗺
+
📖
+
🏆
+
+
+ + +
+
+ + + +
+ + +
+
+
+
<%= player1 || "Spieler 1" %>
+
+
+ <%= player1hp || 20 %> +
+
+ 💧<%= player1mana || 3 %> +
+
+
<%= player1hp || 15 %>
+
+ +
+ + +
+
🛡
+
+
<%= player2 || "Gegner" %>
+
+
+ <%= player2hp || 20 %> +
+
+ 💧<%= player2mana || 3 %> +
+
+
<%= player2hp || 15 %>
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+
🛡
+
+
+
💊
+
🃏
+
+
+
+
+
+ + +
+
+
+ + + +
+ + + + +