awacke1 commited on
Commit
80693d2
·
1 Parent(s): d9c0229

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +77 -16
index.html CHANGED
@@ -1,19 +1,80 @@
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>
3
+ <head>
4
+ <title>Dungeons & Dragons</title>
5
+ <style>
6
+ body {
7
+ font-family: Arial, sans-serif;
8
+ }
9
+ #output {
10
+ white-space: pre-wrap;
11
+ background-color: #f0f0f0;
12
+ padding: 10px;
13
+ margin-top: 10px;
14
+ border-radius: 5px;
15
+ }
16
+ </style>
17
+ </head>
18
+ <body>
19
+ <h1>Dungeons & Dragons: Adventure Awaits</h1>
20
+ <button id="createCharacter">Create Character</button>
21
+ <button id="startAdventure">Start Adventure</button>
22
+ <button id="attack">Attack</button>
23
+ <button id="castSpell">Cast Spell</button>
24
+ <div id="output"></div>
25
+
26
+ <script>
27
+ let character = {};
28
+
29
+ document.getElementById("createCharacter").addEventListener("click", createCharacter);
30
+ document.getElementById("startAdventure").addEventListener("click", startAdventure);
31
+ document.getElementById("attack").addEventListener("click", attack);
32
+ document.getElementById("castSpell").addEventListener("click", castSpell);
33
+
34
+ function createCharacter() {
35
+ character = {
36
+ name: "Hero",
37
+ class: "Warrior",
38
+ level: 1,
39
+ health: 100,
40
+ magic: 50,
41
+ strength: 10,
42
+ intelligence: 5
43
+ };
44
+ display(`Character Created: ${character.name}, the ${character.class}`);
45
+ }
46
+
47
+ function startAdventure() {
48
+ const encounters = ["a wild beast", "a mysterious traveler", "a hidden treasure"];
49
+ const encounter = encounters[Math.floor(Math.random() * encounters.length)];
50
+ display(`You encounter ${encounter} on your adventure.`);
51
+ }
52
+
53
+ function attack() {
54
+ if (!character.name) {
55
+ display("You need to create a character first!");
56
+ return;
57
+ }
58
+
59
+ const damage = Math.floor(Math.random() * character.strength);
60
+ display(`You attack dealing ${damage} damage.`);
61
+ }
62
+
63
+ function castSpell() {
64
+ if (!character.name) {
65
+ display("You need to create a character first!");
66
+ return;
67
+ }
68
+
69
+ const spells = ["Fireball", "Healing Light", "Shadow Strike"];
70
+ const spell = spells[Math.floor(Math.random() * spells.length)];
71
+ display(`You cast ${spell}! It uses 10 magic points.`);
72
+ character.magic -= 10;
73
+ }
74
+
75
+ function display(message) {
76
+ document.getElementById("output").textContent += message + "\n";
77
+ }
78
+ </script>
79
+ </body>
80
  </html>