Spaces:
Running
Running
Add 3 files
Browse filesFiles changed (3)
- README.md+6-4
- index.html+1055-19
- prompts.txtAdded
12345678910---title: Epic Questemoji: 💻colorFrom: purplecolorTo: greensdk: staticpinned: false---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference123456789101112---title: epic-questemoji: 🐳colorFrom: bluecolorTo: greensdk: staticpinned: falsetags:- deepsite---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
12345678910111213141516171819<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width" /><title>My static Space</title><link rel="stylesheet" href="style.css" /></head><body><div class="card"><h1>Welcome to your static Space!</h1><p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p><p>Also don't forget to check the<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.</p></div></body></html>12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Epic Quest RPG</title><script src="https://cdn.tailwindcss.com"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"><style>@keyframes pulse {0%, 100% { transform: scale(1); }50% { transform: scale(1.05); }}.animate-pulse-slow {animation: pulse 3s infinite;}.health-bar {transition: width 0.5s ease;}.fade-in {animation: fadeIn 0.5s;}@keyframes fadeIn {from { opacity: 0; }to { opacity: 1; }}.damage-popup {animation: popup 1s forwards;}@keyframes popup {0% { transform: translateY(0); opacity: 1; }100% { transform: translateY(-50px); opacity: 0; }}</style></head><body class="bg-gray-900 text-white min-h-screen"><div class="container mx-auto px-4 py-8"><!-- Game Title --><header class="text-center mb-8"><h1 class="text-5xl font-bold text-yellow-400 mb-2">Epic Quest</h1><p class="text-xl text-gray-300">A JavaScript RPG Adventure</p></header><!-- Game Container --><div class="grid grid-cols-1 lg:grid-cols-3 gap-6"><!-- Left Panel - Character Info --><div id="characterPanel" class="bg-gray-800 rounded-lg p-6 shadow-lg hidden"><h2 class="text-2xl font-bold text-yellow-400 mb-4 border-b border-gray-700 pb-2">Character</h2><div class="flex items-center mb-6"><div class="w-20 h-20 bg-gray-700 rounded-full flex items-center justify-center text-4xl mr-4"><span id="characterIcon">👤</span></div><div><h3 id="characterName" class="text-xl font-bold">Unknown Hero</h3><div class="flex items-center"><span id="characterLevel" class="bg-blue-600 text-xs px-2 py-1 rounded mr-2">Lvl 1</span><span id="characterClass" class="bg-purple-600 text-xs px-2 py-1 rounded">Class</span></div></div></div><div class="mb-4"><div class="flex justify-between mb-1"><span>Health</span><span id="healthText">100/100</span></div><div class="w-full bg-gray-700 rounded-full h-4"><div id="healthBar" class="health-bar bg-red-600 h-4 rounded-full" style="width: 100%"></div></div></div><div class="mb-4"><div class="flex justify-between mb-1"><span>Experience</span><span id="expText">0/100</span></div><div class="w-full bg-gray-700 rounded-full h-4"><div id="expBar" class="health-bar bg-blue-500 h-4 rounded-full" style="width: 0%"></div></div></div><div class="grid grid-cols-2 gap-4 mb-6"><div class="bg-gray-700 p-3 rounded"><div class="text-sm text-gray-400">Strength</div><div id="strengthStat" class="text-xl font-bold">10</div></div><div class="bg-gray-700 p-3 rounded"><div class="text-sm text-gray-400">Dexterity</div><div id="dexterityStat" class="text-xl font-bold">10</div></div><div class="bg-gray-700 p-3 rounded"><div class="text-sm text-gray-400">Intellect</div><div id="intellectStat" class="text-xl font-bold">10</div></div><div class="bg-gray-700 p-3 rounded"><div class="text-sm text-gray-400">Defense</div><div id="defenseStat" class="text-xl font-bold">10</div></div></div><div class="mb-6"><h3 class="text-lg font-semibold mb-2 text-gray-300">Equipment</h3><div class="grid grid-cols-3 gap-2"><div class="equip-slot bg-gray-700 p-2 rounded text-center" data-slot="weapon"><div class="text-xs text-gray-400">Weapon</div><div id="weaponSlot" class="text-xl">-</div></div><div class="equip-slot bg-gray-700 p-2 rounded text-center" data-slot="armor"><div class="text-xs text-gray-400">Armor</div><div id="armorSlot" class="text-xl">-</div></div><div class="equip-slot bg-gray-700 p-2 rounded text-center" data-slot="shield"><div class="text-xs text-gray-400">Shield</div><div id="shieldSlot" class="text-xl">-</div></div></div></div><div><h3 class="text-lg font-semibold mb-2 text-gray-300">Inventory</h3><div id="inventory" class="bg-gray-700 p-3 rounded max-h-40 overflow-y-auto"><p class="text-gray-500 text-center py-4">Empty</p></div></div></div><!-- Center Panel - Game Content --><div class="lg:col-span-2"><!-- Character Creation --><div id="characterCreation" class="bg-gray-800 rounded-lg p-6 shadow-lg mb-6"><h2 class="text-2xl font-bold text-yellow-400 mb-6 text-center">Create Your Hero</h2><div class="mb-6"><label for="heroName" class="block text-gray-300 mb-2">Hero Name</label><input type="text" id="heroName" class="w-full bg-gray-700 border border-gray-600 rounded py-2 px-3 focus:outline-none focus:ring-2 focus:ring-yellow-500" placeholder="Enter your hero's name"></div><div class="mb-6"><label class="block text-gray-300 mb-3">Choose a Class</label><div class="grid grid-cols-1 md:grid-cols-3 gap-4"><div class="class-option bg-gray-700 p-4 rounded-lg border-2 border-transparent hover:border-yellow-500 cursor-pointer transition-all" data-class="warrior"><div class="text-4xl mb-2">🛡️</div><h3 class="font-bold text-lg">Warrior</h3><p class="text-sm text-gray-400">Strong and tough, excels in melee combat</p><div class="mt-3 text-xs"><div>+5 Strength</div><div>+3 Defense</div></div></div><div class="class-option bg-gray-700 p-4 rounded-lg border-2 border-transparent hover:border-yellow-500 cursor-pointer transition-all" data-class="rogue"><div class="text-4xl mb-2">🗡️</div><h3 class="font-bold text-lg">Rogue</h3><p class="text-sm text-gray-400">Quick and deadly, specializes in critical hits</p><div class="mt-3 text-xs"><div>+5 Dexterity</div><div>+3 Strength</div></div></div><div class="class-option bg-gray-700 p-4 rounded-lg border-2 border-transparent hover:border-yellow-500 cursor-pointer transition-all" data-class="mage"><div class="text-4xl mb-2">🔮</div><h3 class="font-bold text-lg">Mage</h3><p class="text-sm text-gray-400">Master of arcane arts, powerful spells</p><div class="mt-3 text-xs"><div>+5 Intellect</div><div>+3 Dexterity</div></div></div></div></div><button id="startGameBtn" class="w-full bg-yellow-600 hover:bg-yellow-700 text-white font-bold py-3 px-4 rounded-lg transition-all animate-pulse-slow">Begin Your Adventure</button></div><!-- Game Display --><div id="gameDisplay" class="hidden"><div class="bg-gray-800 rounded-lg p-6 shadow-lg mb-6 min-h-64"><div id="gameText" class="mb-4 text-lg"><p>Welcome to the world of Aetheria! Your adventure begins now...</p></div><div id="combatLog" class="bg-gray-900 p-3 rounded max-h-32 overflow-y-auto mb-4 hidden"><!-- Combat messages will appear here --></div><div id="enemyDisplay" class="hidden text-center mb-6"><div class="inline-block bg-gray-700 p-4 rounded-lg"><div id="enemyIcon" class="text-6xl mb-2">👹</div><h3 id="enemyName" class="text-xl font-bold">Enemy</h3><div class="w-full bg-gray-600 rounded-full h-3 mt-2"><div id="enemyHealthBar" class="health-bar bg-red-600 h-3 rounded-full" style="width: 100%"></div></div><div id="enemyHealthText" class="text-xs mt-1">100/100</div></div></div><div id="damageContainer" class="relative h-20"><!-- Damage numbers will appear here --></div></div><!-- Action Buttons --><div id="actionButtons" class="grid grid-cols-2 gap-4 hidden"><button id="exploreBtn" class="bg-green-600 hover:bg-green-700 text-white font-bold py-3 px-4 rounded-lg transition-all"><i class="fas fa-binoculars mr-2"></i> Explore</button><button id="inventoryBtn" class="bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition-all"><i class="fas fa-backpack mr-2"></i> Inventory</button><button id="questsBtn" class="bg-purple-600 hover:bg-purple-700 text-white font-bold py-3 px-4 rounded-lg transition-all"><i class="fas fa-scroll mr-2"></i> Quests</button><button id="restBtn" class="bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-3 px-4 rounded-lg transition-all"><i class="fas fa-campground mr-2"></i> Rest</button></div><!-- Combat Buttons --><div id="combatButtons" class="grid grid-cols-2 gap-4 hidden"><button id="attackBtn" class="bg-red-600 hover:bg-red-700 text-white font-bold py-3 px-4 rounded-lg transition-all"><i class="fas fa-sword mr-2"></i> Attack</button><button id="specialBtn" class="bg-yellow-600 hover:bg-yellow-700 text-white font-bold py-3 px-4 rounded-lg transition-all"><i class="fas fa-fire mr-2"></i> Special</button><button id="defendBtn" class="bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition-all"><i class="fas fa-shield-alt mr-2"></i> Defend</button><button id="fleeBtn" class="bg-gray-600 hover:bg-gray-700 text-white font-bold py-3 px-4 rounded-lg transition-all"><i class="fas fa-running mr-2"></i> Flee</button></div><!-- Quest Log --><div id="questLog" class="bg-gray-800 rounded-lg p-6 shadow-lg hidden"><div class="flex justify-between items-center mb-4"><h2 class="text-2xl font-bold text-yellow-400">Quests</h2><button id="closeQuestsBtn" class="text-gray-400 hover:text-white"><i class="fas fa-times"></i></button></div><div id="activeQuests" class="mb-6"><h3 class="text-lg font-semibold mb-2 text-gray-300">Active Quests</h3><div id="questList" class="space-y-3"><div class="quest bg-gray-700 p-3 rounded border-l-4 border-yellow-500"><div class="flex justify-between"><h4 class="font-bold">First Steps</h4><span class="text-xs bg-blue-600 px-2 py-1 rounded">New</span></div><p class="text-sm text-gray-400 mt-1">Defeat 3 enemies to prove your worth</p><div class="w-full bg-gray-600 rounded-full h-2 mt-2"><div class="bg-blue-500 h-2 rounded-full" style="width: 0%"></div></div><div class="text-xs text-right mt-1">0/3</div></div></div></div></div><!-- Inventory Modal --><div id="inventoryModal" class="bg-gray-800 rounded-lg p-6 shadow-lg hidden"><div class="flex justify-between items-center mb-4"><h2 class="text-2xl font-bold text-yellow-400">Inventory</h2><button id="closeInventoryBtn" class="text-gray-400 hover:text-white"><i class="fas fa-times"></i></button></div><div class="grid grid-cols-2 gap-4"><div><h3 class="text-lg font-semibold mb-2 text-gray-300">Items</h3><div id="inventoryItems" class="bg-gray-700 p-3 rounded max-h-64 overflow-y-auto"><!-- Items will be listed here --></div></div><div><h3 class="text-lg font-semibold mb-2 text-gray-300">Item Info</h3><div id="itemInfo" class="bg-gray-700 p-4 rounded h-64 flex items-center justify-center"><p class="text-gray-500">Select an item to view details</p></div></div></div></div></div></div></div></div><script>// Game Stateconst gameState = {player: {name: '',class: '',level: 1,exp: 0,maxExp: 100,health: 100,maxHealth: 100,stats: {strength: 10,dexterity: 10,intellect: 10,defense: 10},equipment: {weapon: null,armor: null,shield: null},inventory: [],quests: [{id: 1,name: 'First Steps',description: 'Defeat 3 enemies to prove your worth',completed: false,progress: 0,required: 3,reward: { exp: 50, gold: 20, items: ['health_potion'] }}],enemiesDefeated: 0},inCombat: false,currentEnemy: null,gameMessages: [],locations: ['Dark Forest','Misty Mountains','Forgotten Ruins','Haunted Castle','Dragon\'s Lair'],enemies: [{ name: 'Goblin', health: 30, maxHealth: 30, attack: 8, defense: 3, exp: 15, icon: '👺' },{ name: 'Orc', health: 50, maxHealth: 50, attack: 12, defense: 5, exp: 25, icon: '👹' },{ name: 'Skeleton', health: 25, maxHealth: 25, attack: 10, defense: 2, exp: 20, icon: '💀' },{ name: 'Troll', health: 80, maxHealth: 80, attack: 15, defense: 8, exp: 40, icon: '🧌' },{ name: 'Dragon', health: 150, maxHealth: 150, attack: 25, defense: 15, exp: 100, icon: '🐉' }],items: {health_potion: { name: 'Health Potion', effect: 'Restores 30 HP', icon: '🧪', type: 'consumable', value: 10 },sword: { name: 'Iron Sword', effect: '+5 Attack', icon: '⚔️', type: 'weapon', stat: 'strength', value: 5 },armor: { name: 'Leather Armor', effect: '+5 Defense', icon: '🛡️', type: 'armor', stat: 'defense', value: 5 },shield: { name: 'Wooden Shield', effect: '+3 Defense', icon: '🛡️', type: 'shield', stat: 'defense', value: 3 },spellbook: { name: 'Spellbook', effect: '+5 Intellect', icon: '📖', type: 'weapon', stat: 'intellect', value: 5 }}};// DOM Elementsconst characterCreation = document.getElementById('characterCreation');const gameDisplay = document.getElementById('gameDisplay');const characterPanel = document.getElementById('characterPanel');const heroNameInput = document.getElementById('heroName');const classOptions = document.querySelectorAll('.class-option');const startGameBtn = document.getElementById('startGameBtn');const characterName = document.getElementById('characterName');const characterLevel = document.getElementById('characterLevel');const characterClass = document.getElementById('characterClass');const characterIcon = document.getElementById('characterIcon');const healthBar = document.getElementById('healthBar');const healthText = document.getElementById('healthText');const expBar = document.getElementById('expBar');const expText = document.getElementById('expText');const strengthStat = document.getElementById('strengthStat');const dexterityStat = document.getElementById('dexterityStat');const intellectStat = document.getElementById('intellectStat');const defenseStat = document.getElementById('defenseStat');const weaponSlot = document.getElementById('weaponSlot');const armorSlot = document.getElementById('armorSlot');const shieldSlot = document.getElementById('shieldSlot');const inventory = document.getElementById('inventory');const gameText = document.getElementById('gameText');const combatLog = document.getElementById('combatLog');const enemyDisplay = document.getElementById('enemyDisplay');const enemyName = document.getElementById('enemyName');const enemyIcon = document.getElementById('enemyIcon');const enemyHealthBar = document.getElementById('enemyHealthBar');const enemyHealthText = document.getElementById('enemyHealthText');const damageContainer = document.getElementById('damageContainer');const actionButtons = document.getElementById('actionButtons');const exploreBtn = document.getElementById('exploreBtn');const inventoryBtn = document.getElementById('inventoryBtn');const questsBtn = document.getElementById('questsBtn');const restBtn = document.getElementById('restBtn');const combatButtons = document.getElementById('combatButtons');const attackBtn = document.getElementById('attackBtn');const specialBtn = document.getElementById('specialBtn');const defendBtn = document.getElementById('defendBtn');const fleeBtn = document.getElementById('fleeBtn');const questLog = document.getElementById('questLog');const questList = document.getElementById('questList');const closeQuestsBtn = document.getElementById('closeQuestsBtn');const inventoryModal = document.getElementById('inventoryModal');const inventoryItems = document.getElementById('inventoryItems');const itemInfo = document.getElementById('itemInfo');const closeInventoryBtn = document.getElementById('closeInventoryBtn');// Event ListenersstartGameBtn.addEventListener('click', startGame);classOptions.forEach(option => {option.addEventListener('click', selectClass);});exploreBtn.addEventListener('click', explore);inventoryBtn.addEventListener('click', openInventory);questsBtn.addEventListener('click', openQuests);restBtn.addEventListener('click', rest);attackBtn.addEventListener('click', playerAttack);specialBtn.addEventListener('click', specialAttack);defendBtn.addEventListener('click', defend);fleeBtn.addEventListener('click', flee);closeQuestsBtn.addEventListener('click', closeQuests);closeInventoryBtn.addEventListener('click', closeInventory);// Game Functionsfunction startGame() {const name = heroNameInput.value.trim();if (!name) {alert('Please enter a name for your hero!');return;}if (!gameState.player.class) {alert('Please select a class for your hero!');return;}gameState.player.name = name;// Apply class bonusesswitch(gameState.player.class) {case 'warrior':gameState.player.stats.strength += 5;gameState.player.stats.defense += 3;gameState.player.inventory.push('sword');gameState.player.inventory.push('armor');break;case 'rogue':gameState.player.stats.dexterity += 5;gameState.player.stats.strength += 3;gameState.player.inventory.push('sword');break;case 'mage':gameState.player.stats.intellect += 5;gameState.player.stats.dexterity += 3;gameState.player.inventory.push('spellbook');break;}// Start with a health potiongameState.player.inventory.push('health_potion');// Equip starting itemsequipStartingItems();// Hide character creation, show gamecharacterCreation.classList.add('hidden');gameDisplay.classList.remove('hidden');characterPanel.classList.remove('hidden');// Update UIupdateCharacterUI();// Add welcome messageaddGameMessage(`Welcome, ${gameState.player.name} the ${gameState.player.class}! Your adventure begins...`);// Show action buttonsactionButtons.classList.remove('hidden');}function selectClass(e) {const selectedClass = e.currentTarget.dataset.class;gameState.player.class = selectedClass;// Update UIclassOptions.forEach(option => {option.classList.remove('border-yellow-500');if (option.dataset.class === selectedClass) {option.classList.add('border-yellow-500');}});}function equipStartingItems() {if (gameState.player.class === 'warrior') {gameState.player.equipment.weapon = 'sword';gameState.player.equipment.armor = 'armor';} else if (gameState.player.class === 'rogue') {gameState.player.equipment.weapon = 'sword';} else if (gameState.player.class === 'mage') {gameState.player.equipment.weapon = 'spellbook';}}function updateCharacterUI() {characterName.textContent = gameState.player.name;characterLevel.textContent = `Lvl ${gameState.player.level}`;characterClass.textContent = gameState.player.class.charAt(0).toUpperCase() + gameState.player.class.slice(1);// Set class iconlet icon = '👤';if (gameState.player.class === 'warrior') icon = '🛡️';if (gameState.player.class === 'rogue') icon = '🗡️';if (gameState.player.class === 'mage') icon = '🔮';characterIcon.textContent = icon;// Update statshealthBar.style.width = `${(gameState.player.health / gameState.player.maxHealth) * 100}%`;healthText.textContent = `${gameState.player.health}/${gameState.player.maxHealth}`;expBar.style.width = `${(gameState.player.exp / gameState.player.maxExp) * 100}%`;expText.textContent = `${gameState.player.exp}/${gameState.player.maxExp}`;strengthStat.textContent = gameState.player.stats.strength;dexterityStat.textContent = gameState.player.stats.dexterity;intellectStat.textContent = gameState.player.stats.intellect;defenseStat.textContent = gameState.player.stats.defense;// Update equipmentweaponSlot.textContent = gameState.player.equipment.weapon ? gameState.items[gameState.player.equipment.weapon].icon : '-';armorSlot.textContent = gameState.player.equipment.armor ? gameState.items[gameState.player.equipment.armor].icon : '-';shieldSlot.textContent = gameState.player.equipment.shield ? gameState.items[gameState.player.equipment.shield].icon : '-';// Update inventoryupdateInventoryUI();}function updateInventoryUI() {inventoryItems.innerHTML = '';if (gameState.player.inventory.length === 0) {inventoryItems.innerHTML = '<p class="text-gray-500 text-center py-4">Empty</p>';return;}// Count itemsconst itemCounts = {};gameState.player.inventory.forEach(item => {itemCounts[item] = (itemCounts[item] || 0) + 1;});// Display itemsObject.keys(itemCounts).forEach(itemKey => {const item = gameState.items[itemKey];const itemElement = document.createElement('div');itemElement.className = 'flex justify-between items-center p-2 hover:bg-gray-600 rounded cursor-pointer';itemElement.dataset.item = itemKey;itemElement.innerHTML = `<div class="flex items-center"><span class="text-xl mr-3">${item.icon}</span><span>${item.name}</span></div><span class="bg-gray-800 px-2 py-1 rounded text-xs">x${itemCounts[itemKey]}</span>`;itemElement.addEventListener('click', () => showItemInfo(itemKey));inventoryItems.appendChild(itemElement);});}function showItemInfo(itemKey) {const item = gameState.items[itemKey];itemInfo.innerHTML = `<div class="text-center"><span class="text-5xl mb-2">${item.icon}</span><h3 class="text-xl font-bold mb-1">${item.name}</h3><p class="text-gray-300 mb-3">${item.effect}</p>${item.type === 'consumable' ?`<button class="use-item bg-green-600 hover:bg-green-700 text-white font-bold py-2 px-4 rounded" data-item="${itemKey}">Use</button>` :(!gameState.player.equipment[item.type] || gameState.player.equipment[item.type] !== itemKey) ?`<button class="equip-item bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded" data-item="${itemKey}" data-type="${item.type}">Equip</button>` :`<button class="unequip-item bg-gray-600 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded" data-item="${itemKey}" data-type="${item.type}">Unequip</button>`}</div>`;// Add event listeners to buttonsconst useBtn = itemInfo.querySelector('.use-item');const equipBtn = itemInfo.querySelector('.equip-item');const unequipBtn = itemInfo.querySelector('.unequip-item');if (useBtn) {useBtn.addEventListener('click', () => useItem(itemKey));}if (equipBtn) {equipBtn.addEventListener('click', () => equipItem(itemKey, item.type));}if (unequipBtn) {unequipBtn.addEventListener('click', () => unequipItem(itemKey, item.type));}}function useItem(itemKey) {const item = gameState.items[itemKey];if (item.type === 'consumable') {if (itemKey === 'health_potion') {const healAmount = 30;gameState.player.health = Math.min(gameState.player.health + healAmount, gameState.player.maxHealth);addGameMessage(`You used a Health Potion and recovered ${healAmount} HP!`);// Remove item from inventoryconst index = gameState.player.inventory.indexOf(itemKey);if (index !== -1) {gameState.player.inventory.splice(index, 1);}// Update UIupdateCharacterUI();showItemInfo(itemKey);}}}function equipItem(itemKey, itemType) {// Unequip current item if anyif (gameState.player.equipment[itemType]) {unequipItem(gameState.player.equipment[itemType], itemType);}// Equip new itemgameState.player.equipment[itemType] = itemKey;const item = gameState.items[itemKey];// Apply stat bonusif (item.stat) {gameState.player.stats[item.stat] += item.value;}addGameMessage(`You equipped ${item.name}!`);updateCharacterUI();showItemInfo(itemKey);}function unequipItem(itemKey, itemType) {const item = gameState.items[itemKey];// Remove stat bonusif (item.stat) {gameState.player.stats[item.stat] -= item.value;}gameState.player.equipment[itemType] = null;addGameMessage(`You unequipped ${item.name}!`);updateCharacterUI();showItemInfo(itemKey);}function addGameMessage(message) {const messageElement = document.createElement('p');messageElement.className = 'fade-in';messageElement.textContent = message;gameText.insertBefore(messageElement, gameText.firstChild);// Limit number of messagesif (gameText.children.length > 5) {gameText.removeChild(gameText.lastChild);}}function addCombatMessage(message) {const messageElement = document.createElement('p');messageElement.className = 'text-sm fade-in';messageElement.textContent = message;combatLog.insertBefore(messageElement, combatLog.firstChild);// Limit number of messagesif (combatLog.children.length > 5) {combatLog.removeChild(combatLog.lastChild);}}function showDamage(value, isPlayer, isCritical = false) {const damageElement = document.createElement('div');damageElement.className = `damage-popup absolute ${isPlayer ? 'right-10' : 'left-10'} text-2xl font-bold ${isCritical ? 'text-yellow-400' : isPlayer ? 'text-red-500' : 'text-green-500'}`;damageElement.textContent = `${isPlayer ? '-' : '+'}${value}`;damageContainer.appendChild(damageElement);// Remove after animationsetTimeout(() => {damageElement.remove();}, 1000);}function explore() {if (gameState.inCombat) return;const location = gameState.locations[Math.floor(Math.random() * gameState.locations.length)];addGameMessage(`You explore the ${location}...`);// 60% chance of combatif (Math.random() < 0.6) {startCombat();} else {// 30% chance of finding an itemif (Math.random() < 0.3) {const items = Object.keys(gameState.items);const randomItem = items[Math.floor(Math.random() * items.length)];gameState.player.inventory.push(randomItem);addGameMessage(`You found a ${gameState.items[randomItem].name}!`);updateCharacterUI();} else {addGameMessage('You find nothing of interest.');}}}function startCombat() {gameState.inCombat = true;const enemyIndex = Math.min(Math.floor(gameState.player.level / 2), gameState.enemies.length - 1);gameState.currentEnemy = {...gameState.enemies[enemyIndex]};// Scale enemy stats based on player levelgameState.currentEnemy.maxHealth += (gameState.player.level - 1) * 10;gameState.currentEnemy.health = gameState.currentEnemy.maxHealth;gameState.currentEnemy.attack += (gameState.player.level - 1) * 2;gameState.currentEnemy.defense += (gameState.player.level - 1);gameState.currentEnemy.exp += (gameState.player.level - 1) * 5;// Update UIenemyName.textContent = gameState.currentEnemy.name;enemyIcon.textContent = gameState.currentEnemy.icon;enemyHealthBar.style.width = '100%';enemyHealthText.textContent = `${gameState.currentEnemy.health}/${gameState.currentEnemy.maxHealth}`;enemyDisplay.classList.remove('hidden');combatLog.classList.remove('hidden');actionButtons.classList.add('hidden');combatButtons.classList.remove('hidden');addGameMessage(`A wild ${gameState.currentEnemy.name} appears!`);addCombatMessage(`Combat begins!`);}function endCombat(playerWon) {gameState.inCombat = false;if (playerWon) {const expGained = gameState.currentEnemy.exp;gameState.player.exp += expGained;gameState.player.enemiesDefeated++;// Check for level upcheckLevelUp();addGameMessage(`You defeated the ${gameState.currentEnemy.name} and gained ${expGained} EXP!`);// Update quest progressupdateQuestProgress();} else {addGameMessage(`You were defeated by the ${gameState.currentEnemy.name}!`);// Lose some EXP on defeatconst expLost = Math.floor(gameState.player.exp * 0.1);gameState.player.exp = Math.max(0, gameState.player.exp - expLost);if (expLost > 0) {addGameMessage(`You lost ${expLost} EXP!`);}// Recover some health after defeatgameState.player.health = Math.floor(gameState.player.maxHealth * 0.3);}// Update UIupdateCharacterUI();enemyDisplay.classList.add('hidden');combatLog.classList.add('hidden');actionButtons.classList.remove('hidden');combatButtons.classList.add('hidden');// Clear combat logcombatLog.innerHTML = '';}function playerAttack() {if (!gameState.inCombat) return;// Calculate damagelet baseDamage = Math.floor(gameState.player.stats.strength * 0.8 + gameState.player.stats.dexterity * 0.2);// Check for critical hit (10% chance)const isCritical = Math.random() < 0.1;if (isCritical) {baseDamage *= 2;addCombatMessage('Critical hit!');}// Apply enemy defenseconst finalDamage = Math.max(1, baseDamage - Math.floor(gameState.currentEnemy.defense * 0.5));// Apply damagegameState.currentEnemy.health -= finalDamage;// Update UIenemyHealthBar.style.width = `${(gameState.currentEnemy.health / gameState.currentEnemy.maxHealth) * 100}%`;enemyHealthText.textContent = `${Math.max(0, gameState.currentEnemy.health)}/${gameState.currentEnemy.maxHealth}`;// Show damageshowDamage(finalDamage, false, isCritical);addCombatMessage(`You hit the ${gameState.currentEnemy.name} for ${finalDamage} damage!`);// Check if enemy is defeatedif (gameState.currentEnemy.health <= 0) {endCombat(true);return;}// Enemy attacks backsetTimeout(enemyAttack, 1000);}function specialAttack() {if (!gameState.inCombat) return;// Different special attacks based on classlet baseDamage = 0;let specialMessage = '';switch(gameState.player.class) {case 'warrior':baseDamage = Math.floor(gameState.player.stats.strength * 1.5);specialMessage = 'You unleash a mighty swing!';break;case 'rogue':baseDamage = Math.floor(gameState.player.stats.dexterity * 1.2);// Rogues have higher crit chance on specialif (Math.random() < 0.3) {baseDamage *= 2;specialMessage = 'You strike a vulnerable spot! (Critical hit)';} else {specialMessage = 'You perform a precise strike!';}break;case 'mage':baseDamage = Math.floor(gameState.player.stats.intellect * 1.3);specialMessage = 'You cast a powerful spell!';break;}// Apply enemy defense (less effective against special attacks)const finalDamage = Math.max(1, baseDamage - Math.floor(gameState.currentEnemy.defense * 0.3));// Apply damagegameState.currentEnemy.health -= finalDamage;// Update UIenemyHealthBar.style.width = `${(gameState.currentEnemy.health / gameState.currentEnemy.maxHealth) * 100}%`;enemyHealthText.textContent = `${Math.max(0, gameState.currentEnemy.health)}/${gameState.currentEnemy.maxHealth}`;// Show damageshowDamage(finalDamage, false, true);addCombatMessage(specialMessage);addCombatMessage(`You hit the ${gameState.currentEnemy.name} for ${finalDamage} damage!`);// Check if enemy is defeatedif (gameState.currentEnemy.health <= 0) {endCombat(true);return;}// Enemy attacks backsetTimeout(enemyAttack, 1000);}function defend() {if (!gameState.inCombat) return;// Reduce incoming damage by 50%const defenseMultiplier = 0.5;addCombatMessage('You take a defensive stance!');// Enemy attackssetTimeout(() => {enemyAttack(defenseMultiplier);}, 1000);}function flee() {if (!gameState.inCombat) return;// 70% chance to flee successfullyif (Math.random() < 0.7) {addCombatMessage('You successfully fled from battle!');endCombat(false);} else {addCombatMessage('You failed to flee!');// Enemy attackssetTimeout(enemyAttack, 1000);}}function enemyAttack(defenseMultiplier = 1) {if (!gameState.inCombat) return;// Calculate damagelet baseDamage = Math.floor(gameState.currentEnemy.attack * (0.8 + Math.random() * 0.4));// Apply player defenseconst finalDamage = Math.max(1, Math.floor(baseDamage * defenseMultiplier - gameState.player.stats.defense * 0.3));// Apply damagegameState.player.health -= finalDamage;// Update UIhealthBar.style.width = `${(gameState.player.health / gameState.player.maxHealth) * 100}%`;healthText.textContent = `${Math.max(0, gameState.player.health)}/${gameState.player.maxHealth}`;// Show damageshowDamage(finalDamage, true);addCombatMessage(`The ${gameState.currentEnemy.name} hits you for ${finalDamage} damage!`);// Check if player is defeatedif (gameState.player.health <= 0) {endCombat(false);}}function checkLevelUp() {if (gameState.player.exp >= gameState.player.maxExp) {gameState.player.level++;gameState.player.exp -= gameState.player.maxExp;gameState.player.maxExp = Math.floor(gameState.player.maxExp * 1.5);// Increase statsgameState.player.maxHealth += 10 + gameState.player.level;gameState.player.health = gameState.player.maxHealth;gameState.player.stats.strength += 2;gameState.player.stats.dexterity += 2;gameState.player.stats.intellect += 2;gameState.player.stats.defense += 2;// Class-specific bonusesswitch(gameState.player.class) {case 'warrior':gameState.player.stats.strength += 2;gameState.player.stats.defense += 2;break;case 'rogue':gameState.player.stats.dexterity += 3;gameState.player.stats.strength += 1;break;case 'mage':gameState.player.stats.intellect += 3;gameState.player.stats.dexterity += 1;break;}addGameMessage(`Level up! You are now level ${gameState.player.level}!`);updateCharacterUI();// Check for another level up (unlikely but possible)checkLevelUp();}}function updateQuestProgress() {const quest = gameState.player.quests[0]; // Only one quest in this simple versionif (!quest.completed) {quest.progress++;if (quest.progress >= quest.required) {quest.completed = true;addGameMessage(`Quest completed: ${quest.name}!`);// Give rewardsgameState.player.exp += quest.reward.exp;addGameMessage(`You gained ${quest.reward.exp} EXP!`);if (quest.reward.items) {quest.reward.items.forEach(item => {gameState.player.inventory.push(item);addGameMessage(`You received a ${gameState.items[item].name}!`);});}// Check for level up from quest rewardscheckLevelUp();// Update inventory UI if it's openif (!inventoryModal.classList.contains('hidden')) {updateInventoryUI();}}// Update quest UI if it's openif (!questLog.classList.contains('hidden')) {updateQuestUI();}}}function openQuests() {updateQuestUI();questLog.classList.remove('hidden');}function closeQuests() {questLog.classList.add('hidden');}function updateQuestUI() {questList.innerHTML = '';gameState.player.quests.forEach(quest => {const questElement = document.createElement('div');questElement.className = 'quest bg-gray-700 p-3 rounded border-l-4 border-yellow-500';questElement.innerHTML = `<div class="flex justify-between"><h4 class="font-bold">${quest.name}</h4>${quest.completed ?'<span class="text-xs bg-green-600 px-2 py-1 rounded">Completed</span>' :'<span class="text-xs bg-blue-600 px-2 py-1 rounded">In Progress</span>'}</div><p class="text-sm text-gray-400 mt-1">${quest.description}</p><div class="w-full bg-gray-600 rounded-full h-2 mt-2"><div class="bg-blue-500 h-2 rounded-full" style="width: ${(quest.progress / quest.required) * 100}%"></div></div><div class="text-xs text-right mt-1">${quest.progress}/${quest.required}</div>`;questList.appendChild(questElement);});}function openInventory() {updateInventoryUI();inventoryModal.classList.remove('hidden');}function closeInventory() {inventoryModal.classList.add('hidden');}function rest() {const healAmount = Math.floor(gameState.player.maxHealth * 0.5);gameState.player.health = Math.min(gameState.player.health + healAmount, gameState.player.maxHealth);addGameMessage(`You rest and recover ${healAmount} HP.`);updateCharacterUI();}</script><p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Timasthedev/epic-quest" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body></html>
README.md+6-4
index.html+1055-19
prompts.txtAdded