awacke1 commited on
Commit
1f5d9a3
โ€ข
1 Parent(s): dab9c19

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +297 -19
index.html CHANGED
@@ -1,19 +1,297 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>๐ŸŽฒ D20 Dungeon Crawler ๐Ÿฐ</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ display: flex;
11
+ justify-content: center;
12
+ align-items: center;
13
+ min-height: 100vh;
14
+ margin: 0;
15
+ background-color: #2c3e50;
16
+ color: #ecf0f1;
17
+ }
18
+ #game-container {
19
+ background-color: #34495e;
20
+ padding: 20px;
21
+ border-radius: 10px;
22
+ box-shadow: 0 0 20px rgba(0,0,0,0.3);
23
+ max-width: 800px;
24
+ width: 100%;
25
+ }
26
+ button {
27
+ margin: 5px;
28
+ padding: 10px 15px;
29
+ background-color: #3498db;
30
+ color: white;
31
+ border: none;
32
+ border-radius: 5px;
33
+ cursor: pointer;
34
+ transition: background-color 0.3s;
35
+ }
36
+ button:hover {
37
+ background-color: #2980b9;
38
+ }
39
+ select {
40
+ margin: 5px;
41
+ padding: 5px 10px;
42
+ }
43
+ #dungeon-image {
44
+ width: 100%;
45
+ height: 200px;
46
+ background-color: #2c3e50;
47
+ margin-bottom: 20px;
48
+ display: flex;
49
+ justify-content: center;
50
+ align-items: center;
51
+ font-size: 24px;
52
+ text-align: center;
53
+ }
54
+ #choices {
55
+ display: grid;
56
+ grid-template-columns: 1fr 1fr;
57
+ gap: 10px;
58
+ }
59
+ #combat-log {
60
+ max-height: 200px;
61
+ overflow-y: auto;
62
+ background-color: #2c3e50;
63
+ padding: 10px;
64
+ border-radius: 5px;
65
+ margin-top: 20px;
66
+ }
67
+ #monster-trophies {
68
+ display: flex;
69
+ flex-wrap: wrap;
70
+ margin-top: 10px;
71
+ }
72
+ .monster-trophy {
73
+ font-size: 24px;
74
+ margin-right: 5px;
75
+ }
76
+ </style>
77
+ </head>
78
+ <body>
79
+ <div id="game-container">
80
+ <h1>๐ŸŽฒ D20 Dungeon Crawler ๐Ÿฐ</h1>
81
+ <div id="character-creation">
82
+ <h2>๐Ÿ‘ค Character Creation</h2>
83
+ <select id="race">
84
+ <option value="human">๐Ÿ‘จ Human</option>
85
+ <option value="elf">๐Ÿงโ€โ™‚๏ธ Elf</option>
86
+ <option value="dwarf">๐Ÿง” Dwarf</option>
87
+ <option value="halfling">๐Ÿง’ Halfling</option>
88
+ </select>
89
+ <select id="class">
90
+ <option value="warrior">โš”๏ธ Warrior</option>
91
+ <option value="mage">๐Ÿง™โ€โ™‚๏ธ Mage</option>
92
+ <option value="rogue">๐Ÿ—ก๏ธ Rogue</option>
93
+ <option value="cleric">โœจ Cleric</option>
94
+ </select>
95
+ <button onclick="createCharacter()">๐ŸŽญ Create Character</button>
96
+ </div>
97
+ <div id="game-area" style="display: none;">
98
+ <div id="dungeon-image"></div>
99
+ <div id="encounter-description"></div>
100
+ <div id="choices"></div>
101
+ <div id="player-stats"></div>
102
+ <div id="combat-log"></div>
103
+ <div id="monster-trophies"></div>
104
+ </div>
105
+ </div>
106
+ <svg id="d20" width="100" height="100" viewBox="0 0 100 100" style="display: none;">
107
+ <polygon points="50,5 95,75 5,75" fill="#f3f3f3" stroke="#000" stroke-width="2"/>
108
+ <text x="50" y="55" font-size="24" text-anchor="middle" id="roll-result"></text>
109
+ </svg>
110
+ <script>
111
+ let player, currentEncounter, score = 0, monsterTrophies = [];
112
+
113
+ const settingsData = `
114
+ ๐Ÿ›๏ธ๐Ÿฎ,Ancient Temple,A crumbling temple with flickering torches and moss-covered statues
115
+ ๐ŸŒณ๐Ÿ„,Enchanted Forest,A mystical forest filled with glowing mushrooms and whispering trees
116
+ ๐Ÿ”๏ธโ„๏ธ,Frozen Peaks,Treacherous icy mountains with howling winds and hidden crevasses
117
+ ๐Ÿœ๏ธ๐Ÿซ,Desert Ruins,Sun-baked ruins half-buried in shifting sands
118
+ ๐ŸŒ‹๐Ÿ”ฅ,Volcanic Cavern,A scorching cave system with rivers of lava and sulfurous air
119
+ ๐ŸŒŠ๐Ÿš,Sunken City,The remains of an ancient city submerged beneath crystal-clear waters
120
+ ๐Ÿ•ฏ๏ธ๐Ÿ“š,Arcane Library,Towering bookshelves filled with magical tomes and floating candles
121
+ โšฐ๏ธ๐Ÿ’€,Haunted Crypt,A chilling burial chamber echoing with unseen whispers
122
+ ๐ŸŒฟ๐Ÿฆ‹,Fairy Glade,A serene clearing shimmering with magical butterflies and flower petals
123
+ ๐Ÿ•ฐ๏ธโš™๏ธ,Clockwork Maze,An intricate labyrinth of gears, pistons, and ticking mechanisms
124
+ ๐ŸŒ™๐Ÿบ,Shadowy Woods,Dark and foreboding forest where eyes seem to watch from every shadow
125
+ ๐Ÿ”ฎ๐ŸŽญ,Illusory Palace,A grand castle where nothing is as it seems, constantly shifting
126
+ ๐Ÿ•ณ๏ธ๐Ÿฆ‡,Abyssal Chasm,A deep, dark pit with strange echoes and unseen terrors
127
+ ๐ŸŒˆ๐Ÿฆ„,Crystal Cavern,A dazzling cave system filled with luminous, multi-colored crystals
128
+ ๐ŸŽช๐ŸŽญ,Carnival of Souls,An eerie, abandoned fairground with a sinister undercurrent
129
+ ๐Ÿ—ฟ๐ŸŒด,Primal Jungle,A dense, primordial jungle teeming with ancient creatures and ruins
130
+ ๐ŸŒ€๐ŸŒŒ,Astral Plane,A surreal realm of floating islands and swirling cosmic energies
131
+ ๐Ÿดโ€โ˜ ๏ธ๐Ÿฆœ,Ghost Ship,A decrepit vessel sailing through mists, crewed by spectral pirates
132
+ ๐Ÿ•‹๐ŸŽถ,Harmonic Sanctuary,A tranquil temple where magical music fills the air
133
+ ๐Ÿญ๐Ÿ‘พ,Alien Hive,A bizarre, organic structure pulsing with otherworldly life
134
+ `;
135
+
136
+ const monstersData = `
137
+ ๐Ÿ‘น๐Ÿ—ก๏ธ,Goblin,A small, green-skinned creature with a wicked grin and rusty dagger
138
+ ๐Ÿ’€๐Ÿน,Skeleton Archer,A reanimated skeleton wielding a creaky bow with surprising accuracy
139
+ ๐Ÿบ๐ŸŒ™,Dire Wolf,A massive wolf with glowing eyes and razor-sharp fangs
140
+ ๐Ÿ•ท๏ธ๐Ÿ•ธ๏ธ,Giant Spider,A hairy arachnid the size of a horse, with venom dripping from its fangs
141
+ ๐ŸงŸโ€โ™‚๏ธ๐Ÿ”—,Zombie,A shambling corpse with rotting flesh, driven by an insatiable hunger
142
+ ๐Ÿง™โ€โ™€๏ธ๐Ÿ”ฎ,Evil Witch,A cackling hag with gnarled fingers and a bubbling cauldron of curses
143
+ ๐Ÿ‰๐Ÿ”ฅ,Young Dragon,A scaled wyrm with smoke curling from its nostrils, hungry for treasure
144
+ ๐Ÿฆ‡๐Ÿง›โ€โ™‚๏ธ,Vampire,A pale, aristocratic figure with razor-sharp fangs and hypnotic eyes
145
+ ๐ŸŒฟ๐Ÿƒ,Treant,An ancient tree come to life, with bark-covered limbs and mossy beard
146
+ ๐ŸฆŽ๐Ÿ”ฑ,Lizardfolk Warrior,A scaly humanoid with sharp claws and primitive weapons
147
+ ๐Ÿ‘ป๐Ÿ”—,Poltergeist,An invisible spirit that delights in chaos and flying objects
148
+ ๐Ÿ™๐ŸŒŠ,Kraken Spawn,A mass of writhing tentacles emerging from dark waters
149
+ ๐Ÿฆ…๐Ÿฆ,Griffin,A majestic creature with the head and wings of an eagle and body of a lion
150
+ ๐Ÿ—ฟ๐Ÿ”จ,Stone Golem,A hulking figure carved from living rock, nearly impervious to harm
151
+ ๐Ÿฆ„๐ŸŒˆ,Corrupted Unicorn,Once pure, now twisted by dark magic with a deadly horn
152
+ ๐Ÿงœโ€โ™€๏ธ๐ŸŽถ,Siren,A hauntingly beautiful creature with an alluring, deadly song
153
+ ๐Ÿฒโ˜๏ธ,Cloud Giant,A towering humanoid wreathed in mists, with storm-powered magic
154
+ ๐Ÿฆ‚๐Ÿ”ฅ,Infernal Scorpion,A massive scorpion with a carapace of smoldering coals
155
+ ๐Ÿง ๐Ÿ‘๏ธ,Mind Flayer,A tentacle-faced horror with powerful psionic abilities
156
+ ๐ŸŒ‘๐Ÿบ,Shadow Wolf,A beast made of living darkness with glowing red eyes
157
+ `;
158
+
159
+ const settings = parseCSV(settingsData);
160
+ const monsters = parseCSV(monstersData);
161
+
162
+ function parseCSV(data) {
163
+ return data.trim().split('\n').map(line => {
164
+ const [emoji, name, description] = line.split(',');
165
+ return { emoji, name, description };
166
+ });
167
+ }
168
+
169
+ function createCharacter() {
170
+ const race = document.getElementById('race').value;
171
+ const characterClass = document.getElementById('class').value;
172
+ player = {
173
+ race,
174
+ class: characterClass,
175
+ maxHp: 50,
176
+ hp: 50,
177
+ attack: 10,
178
+ defense: 5,
179
+ magic: 8
180
+ };
181
+ document.getElementById('character-creation').style.display = 'none';
182
+ document.getElementById('game-area').style.display = 'block';
183
+ updateStats();
184
+ nextEncounter();
185
+ }
186
+
187
+ function updateStats() {
188
+ document.getElementById('player-stats').innerHTML = `
189
+ ๐Ÿ‘ค Player: โค๏ธ HP ${player.hp}/${player.maxHp}, โš”๏ธ ATK ${player.attack}, ๐Ÿ›ก๏ธ DEF ${player.defense}, ๐Ÿ”ฎ MAG ${player.magic}
190
+ <br>๐Ÿ† Score: ${score}
191
+ `;
192
+ }
193
+
194
+ function nextEncounter() {
195
+ const setting = settings[Math.floor(Math.random() * settings.length)];
196
+ const monster = monsters[Math.floor(Math.random() * monsters.length)];
197
+ currentEncounter = {
198
+ setting,
199
+ monster,
200
+ monsterHp: 30,
201
+ description: `${setting.emoji} You find yourself in ${setting.name}. ${setting.description}
202
+ <br><br>${monster.emoji} Suddenly, a ${monster.name} appears! ${monster.description}`,
203
+ choices: generateChoices()
204
+ };
205
+ document.getElementById('dungeon-image').innerHTML = setting.emoji;
206
+ document.getElementById('encounter-description').innerHTML = currentEncounter.description;
207
+ displayChoices();
208
+ }
209
+
210
+ function generateChoices() {
211
+ return [
212
+ { text: "โš”๏ธ Attack with your weapon", successRate: 0.7, statUsed: "attack" },
213
+ { text: "๐Ÿ”ฎ Cast a spell", successRate: 0.6, statUsed: "magic" },
214
+ { text: "๐Ÿ•ต๏ธ Try to sneak past", successRate: 0.5, statUsed: "defense" },
215
+ { text: "๐Ÿ—ฃ๏ธ Attempt to communicate", successRate: 0.3, statUsed: "magic" }
216
+ ];
217
+ }
218
+
219
+ function displayChoices() {
220
+ const choicesDiv = document.getElementById('choices');
221
+ choicesDiv.innerHTML = "";
222
+ currentEncounter.choices.forEach((choice, index) => {
223
+ const button = document.createElement('button');
224
+ button.textContent = `${String.fromCharCode(65 + index)}. ${choice.text}`;
225
+ button.onclick = () => makeChoice(index);
226
+ choicesDiv.appendChild(button);
227
+ });
228
+ }
229
+
230
+ async function makeChoice(index) {
231
+ const choice = currentEncounter.choices[index];
232
+ const roll = await rollD20();
233
+ const success = roll / 20 <= choice.successRate;
234
+ const statBonus = player[choice.statUsed] / 10;
235
+ const totalSuccessRate = Math.min(choice.successRate + statBonus, 1);
236
+
237
+ if (success) {
238
+ const damage = Math.floor(roll * totalSuccessRate);
239
+ currentEncounter.monsterHp -= damage;
240
+ score += damage;
241
+ log(`โœ… Success! ${choice.text} (๐ŸŽฒ Roll: ${roll}, ๐Ÿ“Š Success Rate: ${(totalSuccessRate * 100).toFixed(1)}%, ๐Ÿ’ฅ Damage: ${damage}, ๐Ÿ† Score: +${damage})`);
242
+ } else {
243
+ player.hp -= 5;
244
+ log(`โŒ Failure... ${choice.text} (๐ŸŽฒ Roll: ${roll}, ๐Ÿ“Š Success Rate: ${(totalSuccessRate * 100).toFixed(1)}%, โค๏ธ HP: -5)`);
245
+ }
246
+
247
+ updateStats();
248
+
249
+ if (player.hp <= 0) {
250
+ log("๐Ÿ’€ Game over! You have been defeated.");
251
+ return;
252
+ }
253
+
254
+ if (currentEncounter.monsterHp <= 0) {
255
+ log(`๐ŸŽ‰ Victory! You defeated the ${currentEncounter.monster.name}!`);
256
+ monsterTrophies.push(currentEncounter.monster.emoji);
257
+ updateMonsterTrophies();
258
+ player.hp = player.maxHp; // Heal to full after battle
259
+ updateStats();
260
+ nextEncounter();
261
+ } else {
262
+ log(`The ${currentEncounter.monster.name} has ${currentEncounter.monsterHp} HP remaining.`);
263
+ }
264
+ }
265
+
266
+ function updateMonsterTrophies() {
267
+ const trophiesDiv = document.getElementById('monster-trophies');
268
+ trophiesDiv.innerHTML = monsterTrophies.map(emoji => `<span class="monster-trophy">${emoji}</span>`).join('');
269
+ }
270
+
271
+ function rollD20() {
272
+ return new Promise(resolve => {
273
+ const d20 = document.getElementById('d20');
274
+ d20.style.display = 'block';
275
+ const result = Math.floor(Math.random() * 20) + 1;
276
+ document.getElementById('roll-result').textContent = result;
277
+ d20.animate([
278
+ { transform: 'rotate(0deg)' },
279
+ { transform: 'rotate(360deg)' }
280
+ ], {
281
+ duration: 1000,
282
+ iterations: 1
283
+ }).onfinish = () => {
284
+ d20.style.display = 'none';
285
+ resolve(result);
286
+ };
287
+ });
288
+ }
289
+
290
+ function log(message) {
291
+ const combatLog = document.getElementById('combat-log');
292
+ combatLog.innerHTML += `<p>${message}</p>`;
293
+ combatLog.scrollTop = combatLog.scrollHeight;
294
+ }
295
+ </script>
296
+ </body>
297
+ </html>