diff --git a/views/1v1-battlefield.ejs b/views/1v1-battlefield.ejs index 08a51aa..8d65fbd 100644 --- a/views/1v1-battlefield.ejs +++ b/views/1v1-battlefield.ejs @@ -502,7 +502,11 @@ /* ── Karte in Hand-Slot legen ──────────────────────── */ function setHandSlot(id, card) { - handSlotState[id] = { card, currentCd: card.cooldown ?? 0 }; + handSlotState[id] = { + card, + currentCd: card.cooldown ?? 0, + wasReduced: false, + }; renderHandSlot(id); } @@ -522,7 +526,30 @@ handCardIds.forEach((id) => { const state = handSlotState[id]; if (!state) return; - if (state.currentCd > 0) state.currentCd--; + + 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--; + } + } + renderHandSlot(id); }); } @@ -552,15 +579,16 @@ } // Erste 3 in die Hand - handCardIds.forEach((id, i) => { - if (expanded[i]) setHandSlot(id, expanded[i]); - }); + for (let i = 0; i < 3; i++) { + if (expanded[i]) { + setHandSlot(handCardIds[i], 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); } @@ -1446,58 +1474,6 @@ ); }); - -// ═════════════════════════════════════════════ -// 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 deleted file mode 100644 index 8d65fbd..0000000 --- a/views/1v1-battlefield.ejs_old +++ /dev/null @@ -1,1496 +0,0 @@ - - - - - - <%= 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 %>
-
- -
-
-
-
-
-
- -
-
-
-
-
-
-
🛡
-
-
-
💊
-
🃏
-
-
-
-
-
- - -
-
-
- - - -
- - - - -