Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 144 additions & 1 deletion src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
.game-board__background {
position: absolute;
inset: 0;
background-size: cover;
background-size: 100% 100%;
background-position: center;
filter: saturate(1.05) contrast(1.05);
}
Expand All @@ -78,6 +78,13 @@
justify-content: center;
padding-bottom: 10px;
cursor: pointer;
transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.game-board__slot:hover {
border-color: rgba(56, 189, 248, 0.7);
box-shadow: 0 0 18px rgba(56, 189, 248, 0.35);
background: rgba(15, 23, 42, 0.55);
}

.game-board__slot span {
Expand All @@ -90,9 +97,28 @@
display: flex;
align-items: stretch;
justify-content: stretch;
border: 2px solid rgba(15, 23, 42, 0.45);
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
cursor: pointer;
overflow: hidden;
background: rgba(15, 23, 42, 0.15);
transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.game-board__card::after {
content: '';
position: absolute;
inset: 6px;
border-radius: 12px;
border: 1px solid rgba(148, 163, 184, 0.25);
pointer-events: none;
opacity: 0.8;
}

.game-board__card:hover {
transform: translateY(-4px);
border-color: rgba(56, 189, 248, 0.6);
box-shadow: 0 18px 30px rgba(0, 0, 0, 0.45), 0 0 18px rgba(56, 189, 248, 0.3);
}

.game-board__card img {
Expand All @@ -106,6 +132,24 @@
box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.3), 0 12px 24px rgba(0, 0, 0, 0.4);
}

.game-board__card--spawn {
animation: card-surge 0.9s ease-out;
}

.game-board__card--spawn::before {
content: '';
position: absolute;
inset: -15%;
background:
radial-gradient(circle at 20% 30%, rgba(148, 197, 255, 0.8), rgba(148, 197, 255, 0) 60%),
radial-gradient(circle at 80% 20%, rgba(250, 204, 21, 0.9), rgba(250, 204, 21, 0) 55%),
radial-gradient(circle at 50% 80%, rgba(59, 130, 246, 0.8), rgba(59, 130, 246, 0) 65%);
mix-blend-mode: screen;
opacity: 0.9;
animation: card-flash 1s ease-out;
pointer-events: none;
}

.game-board__activate {
position: absolute;
bottom: 10px;
Expand All @@ -126,6 +170,79 @@
box-shadow: 0 0 20px rgba(251, 191, 36, 0.45);
}

.game-board__card--corruption-success {
animation: corruption-success 1.2s ease-out;
border-color: rgba(34, 197, 94, 0.7);
box-shadow: 0 0 26px rgba(34, 197, 94, 0.6), 0 12px 28px rgba(0, 0, 0, 0.45);
}

.game-board__card--corruption-fail {
animation: corruption-fail 0.9s ease-out;
border-color: rgba(248, 113, 113, 0.7);
box-shadow: 0 0 24px rgba(248, 113, 113, 0.5), 0 12px 28px rgba(0, 0, 0, 0.45);
}

@keyframes card-surge {
0% {
transform: scale(0.96);
box-shadow: 0 0 0 rgba(59, 130, 246, 0.0);
}
45% {
transform: scale(1.02);
box-shadow: 0 0 30px rgba(59, 130, 246, 0.45);
}
100% {
transform: scale(1);
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}
}

@keyframes card-flash {
0% {
opacity: 0;
transform: scale(0.6);
}
30% {
opacity: 1;
}
100% {
opacity: 0;
transform: scale(1.1);
}
}

@keyframes corruption-success {
0% {
transform: scale(0.95) rotate(-1deg);
filter: brightness(1.4);
}
40% {
transform: scale(1.05) rotate(1deg);
}
100% {
transform: scale(1);
filter: brightness(1);
}
}

@keyframes corruption-fail {
0% {
transform: translateX(0);
}
25% {
transform: translateX(-6px);
}
50% {
transform: translateX(6px);
}
75% {
transform: translateX(-4px);
}
100% {
transform: translateX(0);
}
}

.game-dice {
position: fixed;
left: 16px;
Expand All @@ -140,6 +257,32 @@
border: 2px solid rgba(251, 191, 36, 0.7);
}

.game-dice--rolling {
animation: dicePulse 0.9s ease-in-out;
}

.game-dice--success {
border: 2px solid rgba(34, 197, 94, 0.85);
box-shadow: 0 0 18px rgba(34, 197, 94, 0.65), 0 0 36px rgba(34, 197, 94, 0.35);
}

.game-dice--fail {
border: 2px solid rgba(248, 113, 113, 0.9);
box-shadow: 0 0 18px rgba(248, 113, 113, 0.65), 0 0 36px rgba(248, 113, 113, 0.35);
}

@keyframes dicePulse {
0% {
transform: scale(1);
}
45% {
transform: scale(1.08);
}
100% {
transform: scale(1);
}
}

.action-hint {
position: fixed;
bottom: 24px;
Expand Down
54 changes: 52 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ function AppContent() {

// 🎲 DICE: Toggle zwischen 3D und einfachem Würfel (Standard: einfacher Würfel für bessere Kompatibilität)
const [useSimpleDice, setUseSimpleDice] = useState(true);
const [diceOutcome, setDiceOutcome] = useState<'success' | 'fail' | null>(null);
const diceOutcomeTimer = useRef<number | null>(null);
const [diceRolling, setDiceRolling] = useState(false);
const diceRollingTimer = useRef<number | null>(null);

// UI Layout Editor Route
const [currentRoute, setCurrentRoute] = useState<'game' | 'ui-editor' | 'test-suite' | 'qte' | 'sprite-demo'>('game');
Expand All @@ -60,12 +64,51 @@ function AppContent() {
startMatchVsAI,
playCard,
activateInstantInitiative,
startNewGame,
runAITurn,
selectHandCard,
passTurn,
nextTurn,
} = useGameState();
const corruptionActive = (gameState as any).pendingAbilitySelect?.type === 'corruption_steal';
const pendingAbility = (gameState as any).pendingAbilitySelect?.type;
const corruptionActive = pendingAbility === 'corruption_steal';
const maulwurfActive = pendingAbility === 'maulwurf_steal';

useEffect(() => {
const handleCorruptionResolved = (event: Event) => {
const detail = (event as CustomEvent).detail as { success?: boolean };
const success = Boolean(detail?.success);
setDiceOutcome(success ? 'success' : 'fail');
if (diceOutcomeTimer.current) window.clearTimeout(diceOutcomeTimer.current);
diceOutcomeTimer.current = window.setTimeout(() => {
setDiceOutcome(null);
diceOutcomeTimer.current = null;
}, 1400);
};

const handleCorruptionRoll = () => {
setDiceRolling(true);
if (diceRollingTimer.current) window.clearTimeout(diceRollingTimer.current);
diceRollingTimer.current = window.setTimeout(() => {
setDiceRolling(false);
diceRollingTimer.current = null;
}, 1100);
};

window.addEventListener('pc:corruption_resolved', handleCorruptionResolved as EventListener);
window.addEventListener('pc:corruption_roll_started', handleCorruptionRoll as EventListener);
return () => {
window.removeEventListener('pc:corruption_resolved', handleCorruptionResolved as EventListener);
window.removeEventListener('pc:corruption_roll_started', handleCorruptionRoll as EventListener);
};
}, []);

useEffect(() => (
() => {
if (diceOutcomeTimer.current) window.clearTimeout(diceOutcomeTimer.current);
if (diceRollingTimer.current) window.clearTimeout(diceRollingTimer.current);
}
), []);

const actionHint = useMemo(() => {
if (deckBuilderOpen) return null;
Expand All @@ -75,6 +118,12 @@ function AppContent() {
body: 'Wähle eine gegnerische Regierungs-Karte (gelb markiert) und würfle danach mit dem Dice.',
};
}
if (maulwurfActive) {
return {
title: 'Maulwurf aktiv',
body: 'Ziel ist markiert. Würfle, um die Übernahme zu prüfen.',
};
}
if (selectedHandIndex !== null) {
return {
title: 'Slot wählen',
Expand Down Expand Up @@ -608,6 +657,7 @@ function AppContent() {
onPassTurn={passTurn}
onToggleLog={() => setGameLogModalOpen(!gameLogModalOpen)}
onCardClick={handleCardClick}
onRestartGame={startNewGame}
devMode={devMode}
/>
)}
Expand Down Expand Up @@ -650,7 +700,7 @@ function AppContent() {
<CardHoverInfoPanel hovered={hoveredCard} />

{/* Dice - Dev utility with fallback */}
<div className={corruptionActive ? 'game-dice game-dice--highlight' : 'game-dice'}>
<div className={`game-dice${corruptionActive || maulwurfActive ? ' game-dice--highlight' : ''}${diceOutcome === 'success' ? ' game-dice--success' : ''}${diceOutcome === 'fail' ? ' game-dice--fail' : ''}${diceRolling ? ' game-dice--rolling' : ''}`}>
{useSimpleDice ? (
<SimpleDice
size={120}
Expand Down
Loading