Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Dream Dealer Deck</title>
- <style>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- body {
- font-family: 'Georgia', serif;
- background: linear-gradient(135deg, #1a0033, #330066, #000033);
- color: #e0d5ff;
- min-height: 100vh;
- overflow-x: hidden;
- position: relative;
- }
- /* Animated background particles */
- body::before {
- content: '';
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-image:
- radial-gradient(circle at 20% 50%, rgba(120, 119, 255, 0.3) 0%, transparent 50%),
- radial-gradient(circle at 80% 80%, rgba(255, 119, 168, 0.3) 0%, transparent 50%),
- radial-gradient(circle at 40% 20%, rgba(119, 255, 247, 0.3) 0%, transparent 50%);
- animation: dreamFloat 20s ease-in-out infinite;
- pointer-events: none;
- }
- @keyframes dreamFloat {
- 0%, 100% { transform: translate(0, 0) rotate(0deg); }
- 33% { transform: translate(-20px, -20px) rotate(120deg); }
- 66% { transform: translate(20px, 10px) rotate(240deg); }
- }
- .game-container {
- max-width: 1400px;
- margin: 0 auto;
- padding: 20px;
- position: relative;
- z-index: 1;
- }
- .header {
- text-align: center;
- margin-bottom: 30px;
- animation: fadeIn 1s ease-out;
- }
- h1 {
- font-size: 3em;
- background: linear-gradient(45deg, #ff79c6, #bd93f9, #8be9fd);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- background-clip: text;
- text-shadow: 0 0 30px rgba(189, 147, 249, 0.5);
- margin-bottom: 10px;
- animation: glow 3s ease-in-out infinite;
- }
- @keyframes glow {
- 0%, 100% { filter: brightness(1); }
- 50% { filter: brightness(1.2); }
- }
- .stats {
- display: flex;
- justify-content: center;
- gap: 30px;
- margin-bottom: 20px;
- flex-wrap: wrap;
- }
- .stat {
- background: rgba(255, 255, 255, 0.1);
- padding: 10px 20px;
- border-radius: 20px;
- backdrop-filter: blur(10px);
- border: 1px solid rgba(255, 255, 255, 0.2);
- transition: all 0.3s;
- }
- .stat:hover {
- transform: translateY(-2px);
- box-shadow: 0 5px 20px rgba(189, 147, 249, 0.3);
- }
- .dreamscape {
- background: radial-gradient(ellipse at center, rgba(189, 147, 249, 0.1), transparent);
- border: 2px solid rgba(189, 147, 249, 0.3);
- border-radius: 20px;
- padding: 30px;
- margin-bottom: 30px;
- min-height: 200px;
- position: relative;
- overflow: hidden;
- backdrop-filter: blur(5px);
- }
- .dreamscape::before {
- content: '';
- position: absolute;
- top: -50%;
- left: -50%;
- width: 200%;
- height: 200%;
- background: radial-gradient(circle, transparent, rgba(189, 147, 249, 0.1), transparent);
- animation: dreamPulse 4s ease-in-out infinite;
- }
- @keyframes dreamPulse {
- 0%, 100% { transform: scale(1) rotate(0deg); }
- 50% { transform: scale(1.1) rotate(180deg); }
- }
- .narrative {
- position: relative;
- z-index: 1;
- font-size: 1.2em;
- line-height: 1.8;
- color: #f8f8f2;
- text-align: center;
- font-style: italic;
- animation: fadeIn 0.5s ease-out;
- }
- .dream-symbol {
- display: inline-block;
- margin: 0 5px;
- padding: 2px 8px;
- background: linear-gradient(135deg, rgba(189, 147, 249, 0.3), rgba(255, 121, 198, 0.3));
- border-radius: 10px;
- animation: symbolFloat 3s ease-in-out infinite;
- }
- @keyframes symbolFloat {
- 0%, 100% { transform: translateY(0); }
- 50% { transform: translateY(-3px); }
- }
- .card-area {
- display: flex;
- gap: 30px;
- margin-bottom: 30px;
- flex-wrap: wrap;
- justify-content: center;
- }
- .hand, .deck-area {
- flex: 1;
- min-width: 300px;
- }
- .section-title {
- text-align: center;
- margin-bottom: 15px;
- color: #bd93f9;
- font-size: 1.3em;
- }
- .hand-cards {
- display: flex;
- gap: 15px;
- flex-wrap: wrap;
- justify-content: center;
- min-height: 250px;
- padding: 20px;
- background: rgba(0, 0, 0, 0.3);
- border-radius: 15px;
- border: 1px solid rgba(189, 147, 249, 0.2);
- }
- .card {
- width: 140px;
- height: 200px;
- background: linear-gradient(135deg, #2a0845, #1a0033);
- border: 2px solid rgba(189, 147, 249, 0.5);
- border-radius: 15px;
- padding: 15px;
- cursor: pointer;
- transition: all 0.3s;
- position: relative;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- animation: cardAppear 0.5s ease-out;
- }
- @keyframes cardAppear {
- from {
- opacity: 0;
- transform: scale(0.8) rotateY(90deg);
- }
- to {
- opacity: 1;
- transform: scale(1) rotateY(0);
- }
- }
- .card::before {
- content: '';
- position: absolute;
- top: -50%;
- left: -50%;
- width: 200%;
- height: 200%;
- background: radial-gradient(circle, transparent, rgba(255, 255, 255, 0.1), transparent);
- animation: cardShimmer 3s linear infinite;
- pointer-events: none;
- }
- @keyframes cardShimmer {
- 0% { transform: rotate(0deg); }
- 100% { transform: rotate(360deg); }
- }
- .card:hover {
- transform: translateY(-10px) scale(1.05);
- box-shadow: 0 10px 30px rgba(189, 147, 249, 0.5);
- border-color: #ff79c6;
- }
- .card-symbol {
- font-size: 3em;
- text-align: center;
- margin-bottom: 10px;
- filter: drop-shadow(0 0 10px currentColor);
- animation: symbolRotate 10s linear infinite;
- }
- @keyframes symbolRotate {
- 0% { transform: rotate(0deg); }
- 100% { transform: rotate(360deg); }
- }
- .card-name {
- font-size: 1em;
- font-weight: bold;
- text-align: center;
- color: #f8f8f2;
- margin-bottom: 5px;
- }
- .card-power {
- text-align: center;
- color: #8be9fd;
- font-size: 0.9em;
- }
- .deck {
- width: 160px;
- height: 220px;
- margin: 0 auto;
- background: linear-gradient(135deg, #1a0033, #000033);
- border: 3px solid #bd93f9;
- border-radius: 15px;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- position: relative;
- transition: all 0.3s;
- box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
- }
- .deck:hover {
- transform: scale(1.05);
- box-shadow: 0 10px 30px rgba(189, 147, 249, 0.5);
- }
- .deck-count {
- font-size: 2em;
- color: #ff79c6;
- text-shadow: 0 0 20px rgba(255, 121, 198, 0.8);
- }
- .controls {
- display: flex;
- gap: 20px;
- justify-content: center;
- margin-top: 30px;
- flex-wrap: wrap;
- }
- button {
- padding: 12px 30px;
- background: linear-gradient(135deg, #ff79c6, #bd93f9);
- border: none;
- border-radius: 25px;
- color: white;
- font-size: 1.1em;
- cursor: pointer;
- transition: all 0.3s;
- box-shadow: 0 5px 15px rgba(189, 147, 249, 0.3);
- }
- button:hover {
- transform: translateY(-3px);
- box-shadow: 0 8px 25px rgba(189, 147, 249, 0.5);
- }
- button:active {
- transform: translateY(-1px);
- }
- button:disabled {
- opacity: 0.5;
- cursor: not-allowed;
- transform: none;
- }
- .collapse-warning {
- color: #ff5555;
- text-align: center;
- font-size: 1.2em;
- margin-top: 10px;
- animation: warningPulse 1s ease-in-out infinite;
- }
- @keyframes warningPulse {
- 0%, 100% { opacity: 0.7; }
- 50% { opacity: 1; }
- }
- @keyframes fadeIn {
- from { opacity: 0; }
- to { opacity: 1; }
- }
- .modal {
- display: none;
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background: rgba(0, 0, 0, 0.8);
- z-index: 1000;
- animation: fadeIn 0.3s;
- }
- .modal-content {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- background: linear-gradient(135deg, #2a0845, #1a0033);
- border: 2px solid #bd93f9;
- border-radius: 20px;
- padding: 30px;
- text-align: center;
- box-shadow: 0 0 50px rgba(189, 147, 249, 0.5);
- }
- .modal h2 {
- color: #ff79c6;
- margin-bottom: 20px;
- font-size: 2em;
- }
- .modal p {
- margin-bottom: 20px;
- font-size: 1.2em;
- }
- </style>
- </head>
- <body>
- <div class="game-container">
- <div class="header">
- <h1>Dream Dealer Deck</h1>
- <div class="stats">
- <div class="stat">Stability: <span id="stability">100</span>%</div>
- <div class="stat">Cards Played: <span id="cards-played">0</span></div>
- <div class="stat">Dream Depth: <span id="dream-depth">0</span></div>
- </div>
- </div>
- <div class="dreamscape">
- <div class="narrative" id="narrative">
- The dreamscape awaits your first fragment...
- </div>
- </div>
- <div class="card-area">
- <div class="hand">
- <h2 class="section-title">Your Dream Fragments</h2>
- <div class="hand-cards" id="hand-cards"></div>
- </div>
- <div class="deck-area">
- <h2 class="section-title">Dream Deck</h2>
- <div class="deck" id="deck" onclick="drawCard()">
- <div class="deck-count" id="deck-count">â</div>
- </div>
- </div>
- </div>
- <div class="controls">
- <button onclick="drawCard()">Draw Fragment</button>
- <button onclick="resetDream()">New Dream</button>
- </div>
- <div class="collapse-warning" id="warning" style="display: none;">
- â The dream grows unstable...
- </div>
- </div>
- <div class="modal" id="game-over-modal">
- <div class="modal-content">
- <h2>The Dream Collapses!</h2>
- <p id="final-narrative"></p>
- <button onclick="resetDream()">Dream Again</button>
- </div>
- </div>
- <script>
- const dreamFragments = [
- { symbol: 'ð', name: 'Lunar Echo', power: 3, theme: 'celestial', sentiment: 'positive' },
- { symbol: 'ðĶ', name: 'Morphing Wings', power: 2, theme: 'transformation', sentiment: 'positive' },
- { symbol: 'ðŪ', name: 'Crystal Vision', power: 4, theme: 'prophecy', sentiment: 'positive' },
- { symbol: 'ð', name: 'Tide Memory', power: 3, theme: 'flow', sentiment: 'neutral' },
- { symbol: 'ðïļ', name: 'Watcher\'s Gaze', power: 5, theme: 'awareness', sentiment: 'negative' },
- { symbol: 'ðļ', name: 'Bloom Decay', power: 2, theme: 'cycle', sentiment: 'negative' },
- { symbol: 'âĄ', name: 'Static Whisper', power: 4, theme: 'energy', sentiment: 'neutral' },
- { symbol: 'ð', name: 'Masked Truth', power: 3, theme: 'identity', sentiment: 'neutral' },
- { symbol: 'ð', name: 'Spiral Dance', power: 3, theme: 'chaos', sentiment: 'negative' },
- { symbol: 'âĻ', name: 'Star Dust', power: 2, theme: 'wonder', sentiment: 'positive' },
- { symbol: 'ð·ïļ', name: 'Web Weaver', power: 4, theme: 'connection', sentiment: 'positive' },
- { symbol: 'ð', name: 'Spore Dream', power: 3, theme: 'growth', sentiment: 'positive' },
- { symbol: 'ðĨ', name: 'Ember Memory', power: 4, theme: 'passion', sentiment: 'positive' },
- { symbol: 'âïļ', name: 'Frost Pattern', power: 3, theme: 'stillness', sentiment: 'neutral' },
- { symbol: 'ð', name: 'Spectrum Shift', power: 2, theme: 'change', sentiment: 'neutral' },
- { symbol: 'ðïļ', name: 'Lost Key', power: 5, theme: 'mystery', sentiment: 'negative' },
- { symbol: 'âģ', name: 'Sand Fall', power: 4, theme: 'time', sentiment: 'neutral' },
- { symbol: 'ðŠķ', name: 'Feather Float', power: 1, theme: 'lightness', sentiment: 'positive' },
- { symbol: 'ð', name: 'Prism Heart', power: 5, theme: 'refraction', sentiment: 'positive' },
- { symbol: 'ð', name: 'Void Whisper', power: 6, theme: 'emptiness', sentiment: 'negative' }
- ];
- // Dynamic narrative generation components
- const narrativeComponents = {
- openings: [
- "The dream begins with",
- "In the haze of sleep emerges",
- "From the depths of slumber comes",
- "A vision forms of",
- "The subconscious reveals"
- ],
- transitions: [
- "As the dream unfolds,",
- "Shifting subtly,",
- "With a gentle transition,",
- "As reality warps,",
- "In the flow of consciousness,"
- ],
- connections: [
- "echoing the earlier",
- "building upon the",
- "contrasting with the previous",
- "harmonizing with the",
- "transforming the essence of the"
- ],
- themeDescriptors: {
- celestial: ["starlit", "cosmic", "ethereal", "lunar", "astral"],
- transformation: ["shifting", "metamorphic", "evolving", "changing", "mutating"],
- prophecy: ["visionary", "oracular", "predictive", "fateful", "divinatory"],
- flow: ["fluid", "current-like", "streaming", "wavelike", "rhythmic"],
- awareness: ["observant", "conscious", "perceptive", "mindful", "cognizant"],
- cycle: ["recurring", "circular", "repeating", "cyclical", "periodic"],
- energy: ["vibrant", "dynamic", "electrifying", "powerful", "intense"],
- identity: ["personal", "individual", "characteristic", "defining", "distinctive"],
- chaos: ["disorderly", "turbulent", "random", "unpredictable", "entropic"],
- wonder: ["marvelous", "astonishing", "amazing", "awe-inspiring", "miraculous"],
- connection: ["linking", "bonding", "unifying", "relational", "interconnected"],
- growth: ["expanding", "developing", "maturing", "blossoming", "flourishing"],
- passion: ["intense", "fervent", "ardent", "emotional", "fiery"],
- stillness: ["calm", "peaceful", "tranquil", "serene", "quiet"],
- change: ["altering", "modifying", "varying", "transforming", "shifting"],
- mystery: ["enigmatic", "puzzling", "cryptic", "secretive", "unknown"],
- time: ["temporal", "chronological", "sequential", "progressive", "historic"],
- lightness: ["airy", "buoyant", "weightless", "floating", "ethereal"],
- refraction: ["splintered", "divided", "dispersed", "scattered", "fragmented"],
- emptiness: ["void-like", "hollow", "vacant", "unfilled", "desolate"]
- },
- actions: {
- celestial: ["illuminates", "guides", "shines upon", "blesses", "watches over"],
- transformation: ["alters", "reshapes", "transforms", "metamorphoses", "evolves"],
- prophecy: ["foretells", "predicts", "reveals", "divines", "envisions"],
- flow: ["streams", "courses", "washes over", "flows through", "meanders"],
- awareness: ["observes", "perceives", "notices", "discerns", "recognizes"],
- cycle: ["repeats", "cycles", "returns", "revolves", "recurs"],
- energy: ["energizes", "electrifies", "vibrates", "powers", "animates"],
- identity: ["defines", "characterizes", "personifies", "represents", "embodies"],
- chaos: ["disrupts", "scrambles", "randomizes", "jumbles", "disorganizes"],
- wonder: ["amazes", "astonishes", "marvels", "awes", "impresses"],
- connection: ["links", "connects", "binds", "unites", "joins"],
- growth: ["grows", "expands", "develops", "blossoms", "flourishes"],
- passion: ["ignites", "inflames", "drives", "motivates", "compels"],
- stillness: ["calms", "quiets", "stillens", "pacifies", "settles"],
- change: ["changes", "alters", "modifies", "varies", "shifts"],
- mystery: ["mystifies", "puzzles", "baffles", "perplexes", "intrigues"],
- time: ["passes", "progresses", "advances", "unfolds", "transpires"],
- lightness: ["lightens", "floats", "rises", "ascends", "soars"],
- refraction: ["refracts", "splits", "disperses", "scatters", "divides"],
- emptiness: ["empties", "voids", "clears", "vacates", "hollows"]
- },
- environments: {
- celestial: ["the starry expanse", "the cosmic void", "the lunar landscape", "the astral plane", "the heavenly spheres"],
- transformation: ["the shifting sands", "the mutable realm", "the changing tides", "the fluid reality", "the evolving space"],
- prophecy: ["the oracle's chamber", "the vision pool", "the future's edge", "the divination circle", "the foresight realm"],
- flow: ["the river of time", "the stream of consciousness", "the ocean of thought", "the current of being", "the tide of existence"],
- awareness: ["the observatory", "the mind's eye", "the perception field", "the consciousness plane", "the awareness sphere"],
- cycle: ["the eternal return", "the wheel of fate", "the circle of life", "the recurring dream", "the cyclical realm"],
- energy: ["the power source", "the vibrant core", "the energetic field", "the dynamic space", "the electric atmosphere"],
- identity: ["the self's reflection", "the mirror of being", "the identity chamber", "the persona realm", "the essence space"],
- chaos: ["the turbulent void", "the disorderly realm", "the random chaos", "the entropic field", "the unpredictable space"],
- wonder: ["the marvel garden", "the amazing vista", "the awe-inspiring landscape", "the miraculous realm", "the astonishing dimension"],
- connection: ["the web of life", "the network of being", "the interconnected space", "the relational field", "the unity realm"],
- growth: ["the fertile ground", "the blossoming field", "the developing space", "the growth chamber", "the flourishing realm"],
- passion: ["the fiery heart", "the emotional core", "the ardent space", "the intense realm", "the fervent dimension"],
- stillness: ["the calm center", "the peaceful haven", "the tranquil space", "the serene realm", "the quiet dimension"],
- change: ["the shifting ground", "the altering reality", "the changing space", "the mutable dimension", "the transforming realm"],
- mystery: ["the enigmatic chamber", "the puzzling labyrinth", "the cryptic space", "the secretive realm", "the unknown dimension"],
- time: ["the temporal flow", "the chronological stream", "the time river", "the historic space", "the progression realm"],
- lightness: ["the airy expanse", "the buoyant space", "the weightless realm", "the floating dimension", "the ethereal plane"],
- refraction: ["the prismatic chamber", "the fragmented space", "the scattered realm", "the divided dimension", "the splintered plane"],
- emptiness: ["the void chamber", "the hollow space", "the vacant realm", "the unfilled dimension", "the desolate plane"]
- },
- conclusions: [
- "weaving itself into the fabric of the dream.",
- "becoming an integral part of the subconscious landscape.",
- "altering the course of the dreaming mind.",
- "reshaping the reality of the slumbering world.",
- "leaving an indelible mark on the dreamer's psyche."
- ]
- };
- let gameState = {
- hand: [],
- stability: 100,
- cardsPlayed: 0,
- dreamDepth: 0,
- narrative: [],
- themes: [],
- lastCards: [] // Track the sequence of played cards for narrative context
- };
- function initGame() {
- drawCard();
- drawCard();
- drawCard();
- updateDisplay();
- }
- function drawCard() {
- if (gameState.hand.length >= 7) {
- return;
- }
- const card = {...dreamFragments[Math.floor(Math.random() * dreamFragments.length)]};
- gameState.hand.push(card);
- renderHand();
- // Deck animation
- const deck = document.getElementById('deck');
- deck.style.transform = 'scale(0.95)';
- setTimeout(() => deck.style.transform = 'scale(1)', 200);
- }
- function playCard(index) {
- if (gameState.stability <= 0) return;
- const card = gameState.hand[index];
- gameState.hand.splice(index, 1);
- // Update game state
- gameState.cardsPlayed++;
- gameState.dreamDepth += card.power;
- gameState.themes.push(card.theme);
- // Add to last cards for narrative context (keep last 3)
- gameState.lastCards.unshift(card);
- if (gameState.lastCards.length > 3) {
- gameState.lastCards.pop();
- }
- // Calculate stability change
- const change = calculateStabilityChange(card);
- gameState.stability = Math.max(0, Math.min(100, gameState.stability + change));
- // Generate dynamic narrative
- addToNarrative(card);
- // Update display
- updateDisplay();
- renderHand();
- // Check game over
- if (gameState.stability <= 0) {
- endDream();
- } else if (gameState.stability < 30) {
- document.getElementById('warning').style.display = 'block';
- } else {
- document.getElementById('warning').style.display = 'none';
- }
- // Auto-draw if hand is getting empty
- if (gameState.hand.length < 2) {
- setTimeout(drawCard, 500);
- }
- }
- function calculateStabilityChange(card) {
- // Base stability drain increases with dream depth
- let change = - (3 + Math.floor(gameState.dreamDepth / 10));
- // Sentiment effect - POSITIVE CARDS NOW INCREASE STABILITY
- if (card.sentiment === 'positive') {
- change += 8 + Math.floor(card.power / 2);
- } else if (card.sentiment === 'negative') {
- change -= 5 + card.power;
- } else {
- change -= 2; // slight drain for neutral
- }
- // Theme coherence (flow) - matching themes provide stability
- const recentThemes = gameState.themes.slice(-3);
- if (recentThemes.length >= 2) {
- const uniqueThemes = new Set(recentThemes);
- if (uniqueThemes.size === 1) {
- change += 8; // strong flow bonus for consistent themes
- } else if (uniqueThemes.size === recentThemes.length) {
- change -= 3; // slight penalty for complete theme changes
- }
- }
- return change;
- }
- function addToNarrative(card) {
- let narrativeFragment = generateNarrativeFragment(card);
- gameState.narrative.push(narrativeFragment);
- // Keep only recent narrative
- if (gameState.narrative.length > 5) {
- gameState.narrative.shift();
- }
- document.getElementById('narrative').innerHTML = gameState.narrative.join(' ');
- }
- function generateNarrativeFragment(currentCard) {
- const components = narrativeComponents;
- let narrative = '';
- // Determine the context based on previously played cards
- const prevCard1 = gameState.lastCards[1]; // Card before current
- const prevCard2 = gameState.lastCards[2]; // Card two before current
- // Opening for first card
- if (gameState.cardsPlayed === 1) {
- const opening = components.openings[Math.floor(Math.random() * components.openings.length)];
- const descriptor = components.themeDescriptors[currentCard.theme][Math.floor(Math.random() * components.themeDescriptors[currentCard.theme].length)];
- const environment = components.environments[currentCard.theme][Math.floor(Math.random() * components.environments[currentCard.theme].length)];
- narrative = `<span class="dream-symbol">${currentCard.symbol} ${currentCard.name}</span> ${opening} a ${descriptor} presence in ${environment}, `;
- }
- // Subsequent cards with context awareness
- else {
- const transition = components.transitions[Math.floor(Math.random() * components.transitions.length)];
- narrative = `${transition} `;
- // Check for theme repetition or contrast
- if (prevCard1 && prevCard1.theme === currentCard.theme) {
- // Same theme as previous card
- const connection = components.connections[Math.floor(Math.random() * 2)]; // First two connections work for repetition
- narrative += `<span class="dream-symbol">${currentCard.symbol} ${currentCard.name}</span> appears, ${connection} ${prevCard1.theme} theme, `;
- } else if (prevCard1 && prevCard2 && prevCard1.theme === prevCard2.theme && prevCard1.theme !== currentCard.theme) {
- // Breaking a pattern of same themes
- narrative += `<span class="dream-symbol">${currentCard.symbol} ${currentCard.name}</span> disrupts the pattern, introducing a new ${currentCard.theme} element, `;
- } else if (prevCard1) {
- // Different theme from previous
- const connection = components.connections[2 + Math.floor(Math.random() * 3)]; // Last three connections work for contrast
- narrative += `<span class="dream-symbol">${currentCard.symbol} ${currentCard.name}</span> emerges, ${connection} ${prevCard1.theme} energy, `;
- } else {
- // Fallback
- narrative += `<span class="dream-symbol">${currentCard.symbol} ${currentCard.name}</span> manifests, `;
- }
- }
- // Add action and environment based on current card
- const action = components.actions[currentCard.theme][Math.floor(Math.random() * components.actions[currentCard.theme].length)];
- const environment = components.environments[currentCard.theme][Math.floor(Math.random() * components.environments[currentCard.theme].length)];
- narrative += `${action} ${environment} and ${components.conclusions[Math.floor(Math.random() * components.conclusions.length)]}`;
- return narrative;
- }
- function renderHand() {
- const handElement = document.getElementById('hand-cards');
- handElement.innerHTML = '';
- gameState.hand.forEach((card, index) => {
- const cardElement = document.createElement('div');
- cardElement.className = 'card';
- cardElement.onclick = () => playCard(index);
- // Add sentiment-based border color
- let borderColor = '#bd93f9'; // default
- if (card.sentiment === 'positive') borderColor = '#50fa7b';
- if (card.sentiment === 'negative') borderColor = '#ff5555';
- cardElement.style.borderColor = borderColor;
- cardElement.innerHTML = `
- <div class="card-symbol">${card.symbol}</div>
- <div class="card-name">${card.name}</div>
- <div class="card-power">Power: ${card.power}</div>
- <div class="card-power">${card.sentiment}</div>
- `;
- handElement.appendChild(cardElement);
- });
- }
- function updateDisplay() {
- document.getElementById('stability').textContent = gameState.stability;
- document.getElementById('cards-played').textContent = gameState.cardsPlayed;
- document.getElementById('dream-depth').textContent = gameState.dreamDepth;
- // Update stability color
- const stabilityElement = document.getElementById('stability');
- if (gameState.stability > 60) {
- stabilityElement.style.color = '#50fa7b';
- } else if (gameState.stability > 30) {
- stabilityElement.style.color = '#f1fa8c';
- } else {
- stabilityElement.style.color = '#ff5555';
- }
- }
- function endDream() {
- const modal = document.getElementById('game-over-modal');
- const finalNarrative = document.getElementById('final-narrative');
- finalNarrative.innerHTML = `
- Your dream lasted for ${gameState.cardsPlayed} fragments,
- reaching a depth of ${gameState.dreamDepth} layers.<br><br>
- Final vision: ${gameState.narrative[gameState.narrative.length - 1]}
- `;
- modal.style.display = 'block';
- }
- function resetDream() {
- gameState = {
- hand: [],
- stability: 100,
- cardsPlayed: 0,
- dreamDepth: 0,
- narrative: [],
- themes: [],
- lastCards: []
- };
- document.getElementById('narrative').innerHTML = 'The dreamscape awaits your first fragment...';
- document.getElementById('warning').style.display = 'none';
- document.getElementById('game-over-modal').style.display = 'none';
- initGame();
- }
- // Start game on load
- window.onload = initGame;
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment