-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzork_mini.html
103 lines (99 loc) · 2.99 KB
/
zork_mini.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<html>
<head>
<title>Mini Zork</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="../lib/iokranf.js"></script>
</head>
<body>
<h1>Mini Zork</h1>
<pre id="iokranf_container" style="height: 530px; width: 75%; font-size:16pt;"></pre>
<div style="position:absolute; width:20%; left:78%; top:45px ">
<pre id="container2" style="height: 350px; font-size:16pt;">
</pre>
</div>
<script>
"use strict";
var io=new IOKranf('iokranf_container');
var io2=new IOKranf('container2');
var status="naked";
async function pageCourt()
{
io.printhr();
new Audio("media/tetrisk_move.mp3").play();
io.printImage("media/zork_castle_court.jpg","300px");
io.println("\nYou are standing in the interior court of the castle.");
var x=await io.click("Go to the Castle Gate","Enter the armory");
if (x=="Enter the armory") await pageArmory();
else if (x=="Go to the Castle Gate") pageGate();
}
async function pageArmory()
{
new Audio("media/tetrisk_move.mp3").play();
io.printhr();
io.printImage("media/zork_castle_armory.jpg","300px");
io.println("\nYou are in the armory.There are plenty of weapons and a bottle.");
for(;;)
{
var x=await io.click("Take a weapon","Drink the bottle","Go back in the court");
if (x=="Take a weapon")
{
if (status=="naked")
{
new Audio("media/tetrisk_land.mp3").play();
io2.clr();
io2.printImage("media/zork_inventory2.png","120px");
io.println("You now have a weapon.");
status="armed";
} else if (status=="armed")
{
io.println("You already have a weapon.");
} else if (status=="grue")
{
io.println("You don't have hands to take any weapons.");
}
} else if (x=="Drink the bottle")
{
if (status=="grue")
{
io.println("Nothing happens.");
} else
{
new Audio("media/tetrisk_tetris.mp3").play();
io2.clr();
io2.printImage("media/zork_grue.png","120px");
io.println("You are transformed in a <a target='_blank' href='https://zork.fandom.com/wiki/Grue'>Grue</a>!");
status="grue";
}
}
else if (x=="Go back in the court") break;
}
await pageCourt();
}
function pageGate()
{
io.printhr();
io.printImage("media/zork_castle_gate.jpg","300px");
io.println("\nYou arrrive at the gate.\n"+
"There is an <a target='_blank' href='https://zork.fandom.com/wiki/Grue'>Evil Grue</a> waiting for you there!");
if (status=="grue")
{
io.println("The Grue look at you and let you pass.\nYou escaped the castle!\nYou win.");
new Audio("media/tetrisk_line.mp3").play();
} else
{
new Audio("media/tetrisk_gameover.mp3").play();
io.println("The Grue kills you!\nYou Lost.");
}
io.close();
}
{
// start of the game!
io.autoScroll(true);
io.println("OBJECTIVE: You need to escape from the castle.\n");
io2.printImage("media/zork_inventory1.png","120px");
pageCourt();
}
</script>
</body>
</html>