Implement visual and DiceSoNice effects for critical hits in Daggerheart.

This commit is contained in:
CPTN Cosmo 2026-02-10 01:17:05 +01:00
commit a1a3e74ea7
No known key found for this signature in database
3 changed files with 463 additions and 0 deletions

227
styles/immersive-crits.css Normal file
View file

@ -0,0 +1,227 @@
/* Critical Hit Animations */
.dh-critical-hit {
position: relative;
overflow: hidden;
/* Ensure effects stay within the card */
z-index: 0;
}
/* Ensure content stays above effects */
.dh-critical-hit>* {
position: relative;
z-index: 1;
}
/* Embers Animation - Refactored for softer look */
/* Embers Animation - JS Particles */
.dh-crit-embers {
position: relative;
/* Container styles if needed */
}
.dh-particle-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 0;
/* Behind text but visible */
overflow: visible;
/* Let them drift out a bit if needed, or hidden to clip */
overflow: hidden;
}
.dh-ember-particle {
position: absolute;
bottom: -10px;
/* Start just below */
left: var(--dh-left, 50%);
width: var(--dh-size, 4px);
height: var(--dh-size, 4px);
background: radial-gradient(circle, #ffcc00, #ff4500);
border-radius: 50%;
opacity: 0;
mix-blend-mode: screen;
box-shadow: 0 0 4px #ff4500;
/* Animation */
animation: ember-float var(--dh-anim-duration, 3s) linear infinite;
animation-delay: var(--dh-anim-delay, 0s);
}
@keyframes ember-float {
0% {
transform: translate(0, 0) scale(1);
opacity: 0;
}
10% {
opacity: var(--dh-opacity-peak, 1);
}
80% {
opacity: var(--dh-opacity-peak, 1);
}
100% {
/* Drift right and up */
transform: translate(var(--dh-drift, 50px), -150px) scale(0.5);
opacity: 0;
}
}
/* Pulse Animation - Replaces Glow */
.dh-crit-pulse {
/* --dh-crit-pulse-color is set via JS */
box-shadow: 0 0 15px var(--dh-crit-pulse-color, #ff0000), inset 0 0 15px var(--dh-crit-pulse-color, #ff0000);
animation: pulse-effect 2s infinite ease-in-out;
}
@keyframes pulse-effect {
0%,
100% {
box-shadow: 0 0 15px var(--dh-crit-pulse-color, #ff0000), inset 0 0 15px var(--dh-crit-pulse-color, #ff0000);
}
50% {
box-shadow: 0 0 25px var(--dh-crit-pulse-color, #ff0000), inset 0 0 25px var(--dh-crit-pulse-color, #ff0000);
}
}
/* Arcane Animation */
.dh-crit-arcane::before {
content: "";
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: conic-gradient(from 0deg, transparent 0%, rgba(138, 43, 226, 0.2) 20%, transparent 40%);
animation: arcane-spin 6s infinite linear;
pointer-events: none;
z-index: -1;
mix-blend-mode: color-dodge;
}
.dh-crit-arcane {
box-shadow: 0 0 10px rgba(138, 43, 226, 0.4);
}
@keyframes arcane-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/* Holy Animation */
.dh-crit-holy::before {
content: "";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(var(--dh-holy-scale, 1));
width: 0;
height: 0;
box-shadow: 0 0 40px 20px rgba(255, 255, 200, 0.6);
animation: holy-burst 4s infinite ease-in-out;
/* Slower */
pointer-events: none;
z-index: -1;
border-radius: 50%;
}
.dh-crit-holy {
background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 215, 0, 0.1) 100%);
border: 1px solid rgba(255, 215, 0, 0.5);
}
@keyframes holy-burst {
0%,
100% {
box-shadow: 0 0 30px 10px rgba(255, 255, 200, 0.4);
}
50% {
box-shadow: 0 0 50px 30px rgba(255, 215, 0, 0.6);
}
}
/* Necrotic Animation */
.dh-crit-necrotic::before {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
/* Seamless Gradient: Transparent -> Color -> Transparent */
background: linear-gradient(0deg, transparent 0%, rgba(0, 255, 0, 0.2) 50%, transparent 100%);
background-size: 100% 200%;
animation: necrotic-fumes 6s infinite linear;
pointer-events: none;
z-index: -1;
filter: blur(3px) hue-rotate(90deg) contrast(1.2);
mix-blend-mode: hard-light;
}
.dh-crit-necrotic {
box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
border: 1px solid rgba(46, 139, 87, 0.5);
/* Softer border */
}
@keyframes necrotic-fumes {
0% {
background-position: 0 0;
}
100% {
background-position: 0 -200%;
}
}
/* Nature Animation */
.dh-crit-nature::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image:
radial-gradient(circle at 20% 30%, rgba(34, 139, 34, 0.3) 0%, transparent 20%),
radial-gradient(circle at 80% 70%, rgba(107, 142, 35, 0.3) 0%, transparent 20%);
animation: nature-breathe 4s infinite ease-in-out;
pointer-events: none;
z-index: -1;
filter: blur(5px);
}
.dh-crit-nature {
border-left: 2px solid #228b22;
border-right: 2px solid #228b22;
}
@keyframes nature-breathe {
0%,
100% {
opacity: 0.4;
transform: scale(1);
}
50% {
opacity: 0.8;
transform: scale(1.05);
}
}