fix: Hex Wars - Mine Legende, Kopf nach Explosion auf altes Feld
This commit is contained in:
@@ -321,6 +321,28 @@ router.post('/:id/move', authenticate, (req, res) => {
|
||||
destroyedOwn = explosion.destroyedByOwner;
|
||||
destroyedOpp = explosion.destroyedByOpp;
|
||||
lastEvent = JSON.stringify({ type:'mine', player:me, row, col, blastCells, destroyedOwn, destroyedOpp });
|
||||
|
||||
// Kopf zurücksetzen: Mine-Feld gehört dem Spieler, aber Kopf soll auf das letzte
|
||||
// noch existierende eigene Feld vor dem Mine-Zug zeigen.
|
||||
// Der alte Kopf (myHR, myHC) wird durch explodeMine nicht zerstört (Explosion trifft Nachbarn),
|
||||
// also ist er noch vorhanden — Kopf bleibt beim alten Kopf (vor dem Mine-Zug).
|
||||
// Falls kein alter Kopf bekannt: suche nächstes eigenes Feld neben der Mine.
|
||||
if (myHR !== null) {
|
||||
// Alten Kopf wiederherstellen — Mine-Feld selbst ist kein guter Ausgangspunkt
|
||||
if (game.owner_id === me) newOwnerHead = `${myHR},${myHC}`;
|
||||
else newOppHead = `${myHR},${myHC}`;
|
||||
} else {
|
||||
// Fallback: nächstes eigenes Feld neben der Mine suchen
|
||||
let fallbackHead = null;
|
||||
for (const [dr,dc] of DIRS8) {
|
||||
const nr=row+dr, nc=col+dc;
|
||||
if (nr>=0&&nr<GRID&&nc>=0&&nc<GRID&&grid[nr][nc]===me) { fallbackHead=`${nr},${nc}`; break; }
|
||||
}
|
||||
if (fallbackHead) {
|
||||
if (game.owner_id === me) newOwnerHead = fallbackHead;
|
||||
else newOppHead = fallbackHead;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── Mine ins Sichtfeld gekommen: Explosion prüfen ────────────────────────
|
||||
|
||||
@@ -375,7 +375,7 @@ function GameBoard({ game, myId, onMove, toast }) {
|
||||
|
||||
{/* Legende */}
|
||||
<div style={{ display:'flex', gap:6, marginBottom:4, flexWrap:'wrap' }}>
|
||||
{[['⭐','Gold +3','#ffe66d'],['💣','Mine −3','#ff6b9d'],['🪨','Felsen','rgba(255,255,255,0.35)'],['🌫️','Nebel','rgba(255,255,255,0.25)']].map(([icon,label,color]) => (
|
||||
{[['⭐','Gold +3','#ffe66d'],['💣','Mine 💥','#ff6b9d'],['🪨','Felsen','rgba(255,255,255,0.35)'],['🌫️','Nebel','rgba(255,255,255,0.25)']].map(([icon,label,color]) => (
|
||||
<div key={label} style={{ display:'flex', alignItems:'center', gap:4 }}>
|
||||
<span style={{ fontSize:12 }}>{icon}</span>
|
||||
<span style={{ color, fontFamily:'monospace', fontSize:10 }}>{label}</span>
|
||||
|
||||
Reference in New Issue
Block a user