-
Notifications
You must be signed in to change notification settings - Fork 1
/
deuterv.html
645 lines (633 loc) · 41.2 KB
/
deuterv.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Deuter V</title>
<link rel="stylesheet" type="text/css" href="css/browser_reset.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<style>
html {
background: url("images/Deuter_V.jpeg") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
<script>
var dialoguecount = 0;
function stats() {
if (sessionStorage.getItem("ship") == "bloodstar") {
document.getElementById("shipicon").innerHTML = "<img src='images/Bloodstar.jpeg' width='150' alt='The Bloodstar ship' /><p style='font-size: 15px;'>Ship: Bloodstar</p><p style='font-size: 15px;'>HP: " + hp + "</p><p style='font-size: 15px;'>Bonus: Extra HP</p>";
} else if (sessionStorage.getItem("ship") == "blue fyre") {
document.getElementById("shipicon").innerHTML = "<img src='images/Blue_Fyre.png' width='150' alt='The Blue Fyre ship' /><p style='font-size: 15px;'>Ship: Blue Fyre</p><p style='font-size: 15px;'>HP: " + hp + "</p><p style='font-size: 10px;'>Bonus: 50% chance to attack twice</p>";
} else if (sessionStorage.getItem("ship") == "gator custom") {
document.getElementById("shipicon").innerHTML = "<img src='images/Gator_Custom.png' width='150' alt='The Gator Custom ship' /><p style='font-size: 15px;'>Ship: Gator Custom</p><p style='font-size: 15px;'>HP: " + hp + "</p><p style='font-size: 8px;'>Bonus: 100% more dmg with missiles</p>";
} else if (sessionStorage.getItem("ship") == "amboss") {
document.getElementById("shipicon").innerHTML = "<img src='images/Amboss.png' width='150' alt='The Amboss ship' /><p style='font-size: 15px;'>Ship: Amboss</p><p style='font-size: 15px;'>HP: " + hp + "</p><p style='font-size: 10px;'>Bonus: 40% dodge chance</p>";
} else if (sessionStorage.getItem("ship") == "dark angel") {
document.getElementById("shipicon").innerHTML = "<img src='images/Dark_Angel.jpeg' width='150' alt='The Dark Angel ship' /><p style='font-size: 15px;'>Ship: Dark Angel</p><p style='font-size: 15px;'>HP: " + hp + "</p><p style='font-size: 8px;'>Bonus: 300% more dmg under 50% HP</p>";
}
return false;
}
function continuebutton() {
dialoguecount += 1;
if (sessionStorage.getItem("victorydeuterv") == null) {
gamestart();
} else {
afterbattle();
}
return false;
}
function gamestart() {
if (sessionStorage.getItem("victorydeuterv") == "beaten") {
dialoguecount = -1;
}
if (dialoguecount == 0) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The Narrator<img src='images/Narrator.png' width='60' alt='The narrator' style='margin-right: 20px; margin-left: 20px;'/>Our hero is lost in space. Finally, he wakes up and regains consciousness.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 1) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Keith T. Maxwell<img src='images/Keith_T_Maxwell.png' width='50' alt='Keith T Maxwell icon' style='margin-right: 20px; margin-left: 20px;'/>Ughh, where am I?<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 2) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The Narrator<img src='images/Narrator.png' width='60' alt='The narrator' style='margin-right: 20px; margin-left: 20px;'/>He doesn't know what solar system he's in. He locates the nearest space station and goes there.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 3) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>Welcome, stranger. I'm Gunant Breh, a Midorian ore trader. And the owner of this station.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 4) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Keith T. Maxwell<img src='images/Keith_T_Maxwell.png' width='50' alt='Keith T Maxwell icon' style='margin-right: 20px; margin-left: 20px;'/>Keith T. Maxwell. Midorian? Never heard of it. Wait, where am I, exactly?<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 5) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>Are you lost, son? Perhaps the Nivelian civil war wasn't too long ago, I reckon not everybody even knows of it.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 6) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>You're in the Mido System, on Deuter V station. Sector 44.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 7) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Keith T. Maxwell<img src='images/Keith_T_Maxwell.png' width='50' alt='Keith T Maxwell icon' style='margin-right: 20px; margin-left: 20px;'/>Oh. Wait, hold on. SECTOR 44!? That's hundreds of thousands of light years from Eden Prime!<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 8) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>You're trying to get to Eden Prime? Ha! Good luck, stranger. That's on the other side of the galaxy.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 9) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Keith T. Maxwell<img src='images/Keith_T_Maxwell.png' width='50' alt='Keith T Maxwell icon' style='margin-right: 20px; margin-left: 20px;'/>And I've never heard of a Nivelian civil war. Blast, what year is it?<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 10) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>Heh, you're quite strange, stranger. It's 3550 AD.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 11) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Keith T. Maxwell<img src='images/Keith_T_Maxwell.png' width='50' alt='Keith T Maxwell icon' style='margin-right: 20px; margin-left: 20px;'/>3550 AD!? No, this can't be. I've been shot 35 years into the future!<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 12) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The Narrator<img src='images/Narrator.png' width='60' alt='The narrator' style='margin-right: 20px; margin-left: 20px;'/>It is here our hero realizes this was the result of his malfunctioned hyperdrive. He breaks down, knowing it is impossible to return home.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 13) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>Heh. Calm down, son. You must have just went near a black hole or something.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 14) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Station AI<img src='images/Ship_AI.jpeg' width='60' alt='icon of Station AI' style='margin-right: 20px; margin-left: 20px;'/>ALERT! ALERT! PIRATES ATTACKING! CALLING ALL ABLE-FIGHTERS!<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 15) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>No! My fortune! I'm sorry Keith, whatever your problem is, it has to wait. I have to go defend this station!<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 16) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Keith T. Maxwell<img src='images/Keith_T_Maxwell.png' width='50' alt='Keith T Maxwell icon' style='margin-right: 20px; margin-left: 20px;'/>I understand. I'm going to help drive them off. My ship's still mostly intact, after all.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
} else if (dialoguecount == 17) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The Narrator<img src='images/Narrator.png' width='60' alt='The narrator' style='margin-right: 20px; margin-left: 20px;'/>And so our hero suits up and gets ready to fight the pirates... Click \"continue\" and click \"Battle\"<button id='continuebutton' onclick='displayBattle()'>Continue</button><button id='continuebutton' onclick='displayBattle()'>Skip</button></div>";
}
return false;
}
function displayBattle() {
document.getElementById("displaybattle").innerHTML = "<button onclick='battle()' class='centrebutton'>Battle</button>";
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>BATTLE UNLOCKED</div>";
return false;
}
function randomInt(pmin, pmax) {
var randomnumber = Math.floor(Math.random() * (pmax - pmin + 1) + pmin);
return(randomnumber);
}
function autowin() {
victory = true;
victorycheck();
return false;
}
function getship() {
if (sessionStorage.getItem("ship") == "bloodstar") {
shipname = "Bloodstar";
shipimg = "Bloodstar.jpeg";
shipalt = "The Bloodstar ship";
} else if (sessionStorage.getItem("ship") == "blue fyre") {
shipname = "Blue Fyre";
shipimg = "Blue_Fyre.png";
shipalt = "The Blue Fyre ship";
} else if (sessionStorage.getItem("ship") == "gator custom") {
shipname = "Gator Custom";
shipimg = "Gator_Custom.png";
shipalt = "The Gator Custom ship";
} else if (sessionStorage.getItem("ship") == "amboss") {
shipname = "Amboss";
shipimg = "Amboss.png";
shipalt = "The Amboss ship";
} else if (sessionStorage.getItem("ship") == "dark angel") {
shipname = "Dark Angel";
shipimg = "Dark_Angel.jpeg";
shipalt = "The Dark Angel ship";
}
return false;
}
function createbattlefield() {
shields();
document.getElementById("dialoguebox").innerHTML = "";
document.getElementById("displaybattle").innerHTML = "<button onclick='battle()' class='centrebutton'>Battle</button><br><button onclick='autowin()' class='centrebutton'>Auto-Win</button>";
document.getElementById("shipicon").innerHTML = "<img src='images/'" + shipimg + " width='150' alt='" + shipalt + "' /><p style='font-size: 15px;'>Ship: " + shipname + "</p><p style='font-size: 15px;'>HP: " + hp + "</p><p style='font-size: 15px;'>Bonus: Extra HP</p>";
document.getElementById("battlefield").innerHTML = "<h2>Battlefield</h2><table id='battlefieldbox'><tr><td><img src='images/Pirate_Enemy.png' width='150' alt='Enemy pirate spaceship' style='" + enemyshieldup + "'/><p>Pirate</p><p>HP: " + enemyhp + "</p></td></tr><tr><td><img src='images/" + shipimg + "' width='150' alt='" + shipalt + "' style='" + shieldup + "'><p>" + shipname + "</p><p>HP: " + hp + "</td></tr></table>";
document.getElementById("turnmenu").innerHTML = "<table><tr><td><p>Attack Menu</p><form id='attackmenu' name='Attack Menu' method='post'><p><input checked type='radio' id='Lasers' name='attack' value='lasers' />Lasers</p><p><input type='radio' id='Missiles' name='attack' value='missiles' />Missiles</p><p><input type='radio' id='Repair' name='attack' value='repair' />Repair</p></form></td><td><p>Defend Menu</p><form id='defend menu' name='Defend Menu' method='post'><p><input checked type='radio' id='Shield' name='defend' value='shield' />Shield</p><p><input type='radio' id='Hull' name='defend' value='hull' />Hull</p><p><input type='radio' id='Charge' name='defend' value='charge' />Charge</p></form></td></tr></table><br><p><button onclick='endturn()' class='centrebutton'>End Turn</button></p>";
stats();
return false;
}
function shields() {
if (charge == true) {
shieldup = "border: solid; border-color: red; border-width: 5px;";
} else if (shield == true) {
shieldup = "border: solid; border-color: blue; border-width: 5px;";
} else if (shield == false) {
shieldup = "";
}
if (enemycharge == true) {
enemyshieldup = "border: solid; border-color: red; border-width: 5px;";
} else if (enemyshield == true) {
enemyshieldup = "border: solid; border-color: blue; border-width: 5px;";
} else if (enemyshield == false) {
enemyshieldup = "";
}
return false;
}
function bloodstar() {
if (sessionStorage.getItem("ship") == "bloodstar") {
hp = 100;
maxhp = 100;
}
return false;
}
function bluefyre() {
if (sessionStorage.getItem("ship") == "blue fyre") {
if (randomInt(1, 2) == 1) {
enemyhp -= dmg;
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The Blue Fyre struck twice! You dealt " + dmg + " damage again!<button id='continuebutton' onclick='enemyturn()'>Continue</button></div>";
victorycheck();
} else {
enemyturn();
}
} else {
enemyturn();
}
return false;
}
function darkangel() {
if (sessionStorage.getItem("ship") == "dark angel") {
if (hp < (maxhp * 0.5)) {
dmg *= 4;
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The Dark Angel has powered up!<button id='continuebutton' onclick='enemyturn()'>Continue</button></div>";
}
}
return false;
}
function gatorcustom() {
if (sessionStorage.getItem("ship") == "gator custom") {
dmg *= 2;
}
return false;
}
function amboss() {
if (sessionStorage.getItem("ship") == "amboss") {
dodgechance = randomInt(1, 10);
if (dodgechance >= 1 && dodgechance <= 4) {
ambossdodge = true;
enemydmg = 0;
}
}
return false;
}
function raccoon() {
if (sessionStorage.getItem("devweapon") == "raccoon") {
dmg = enemyhp;
}
return false;
}
function enemyhplimit() {
if (enemyhp < 0) {
enemyhp = 0;
}
return false;
}
function hplimit() {
if (hp < 0) {
hp = 0;
}
return false;
}
function maxhplimit() {
if (hp > maxhp) {
hp = maxhp;
}
return false;
}
function lasers() {
if (charge == true || enemycharge == true) {
dmg = 10;
darkangel();
if (charge == true) {
if (randomInt(1, 4) == 1) {
dmg *= 5;
}
}
raccoon();
enemyhp -= dmg;
enemyhplimit();
if (charge == true) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>You used lasers while charged! You dealt " + dmg + " damage!<button id='continuebutton' onclick='bluefyre()'>Continue</button></div>";
} else if (enemycharge == true) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>You used lasers while the enemy was charged! You dealt " + dmg + " damage!<button id='continuebutton' onclick='bluefyre()'>Continue</button></div>";
}
victorycheck();
} else if (enemyshield == true) {
dmg = 10;
raccoon();
darkangel();
enemyhp -= dmg;
enemyhplimit();
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>You used lasers! You dealt " + dmg + " damage!<button id='continuebutton' onclick='bluefyre()'>Continue</button></div>";
victorycheck();
} else if (enemyshield == false) {
dmg = 5;
raccoon();
darkangel();
enemyhp -= dmg;
enemyhplimit();
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>You used lasers! You dealt " + dmg + " damage!<button id='continuebutton' onclick='bluefyre()'>Continue</button></div>";
victorycheck();
}
return false;
}
function missiles() {
if (charge == true || enemycharge == true) {
dmg = 10;
darkangel();
gatorcustom();
if (charge == true) {
if (randomInt(1, 4) == 1) {
dmg *= 5;
}
}
enemyhp -= dmg;
enemyhplimit();
if (charge == true) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>You used missiles while charged! You dealt " + dmg + " damage!<button id='continuebutton' onclick='bluefyre()'>Continue</button></div>";
} else if (enemycharge == true) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>You used missiles while the enemy was charged! You dealt " + dmg + " damage!<button id='continuebutton' onclick='bluefyre()'>Continue</button></div>";
}
victorycheck();
} else if (enemyshield == true) {
dmg = 5;
darkangel();
gatorcustom();
enemyhp -= dmg;
enemyhplimit();
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>You used missiles! You dealt " + dmg + " damage!<button id='continuebutton' onclick='bluefyre()'>Continue</button></div>";
victorycheck();
} else if (enemyshield == false) {
dmg = 10;
darkangel();
gatorcustom();
enemyhp -= dmg;
enemyhplimit();
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>You used missiles! You dealt " + dmg + " damage!<button id='continuebutton' onclick='bluefyre()'>Continue</button></div>";
victorycheck();
}
return false;
}
function repair() {
var healchance = randomInt(1, 10);
if (healchance == 1) {
hp += 20;
maxhplimit();
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>You used repair and got lucky! You healed 20 HP!<button id='continuebutton' onclick='enemyturn()'>Continue</button></div>";
} else {
hp += 10;
maxhplimit();
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>You used repair! You healed 10 HP!<button id='continuebutton' onclick='enemyturn()'>Continue</button></div>";
}
return false;
}
function shieldZ() {
shield = true;
return false;
}
function hullZ() {
shield = false;
return false;
}
function chargeZ() {
charge = true;
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>You are charging up!<button id='continuebutton' onclick='enemyturn()'>Continue</button></div>";
return false;
}
function enemylasers() {
if (enemycharge == true || charge == true) {
enemydmg = 10;
if (enemycharge == true) {
if (randomInt(1, 4) == 1) {
enemydmg *= 3;
}
}
amboss();
hp -= enemydmg;
hplimit();
defeatcheck();
if (enemycharge == true) {
if (ambossdodge == true) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used lasers while charged! You dodged the attack!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
} else {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used lasers while charged! The enemy dealt " + enemydmg + " damage!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
}
} else if (charge == true) {
if (ambossdodge == true) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used lasers while you were charged! You dodged the attack!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
} else {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used lasers while you were charged! The enemy dealt " + enemydmg + " damage!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
}
}
} else if (shield == true) {
enemydmg = 10;
amboss();
hp -= enemydmg;
hplimit();
defeatcheck();
if (ambossdodge == true) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used lasers! You dodged the attack!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
} else {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used lasers! The enemy dealt " + enemydmg + " damage!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
}
defeatcheck();
} else if (shield == false) {
enemydmg = 5;
amboss();
hp -= enemydmg;
hplimit();
defeatcheck();
if (ambossdodge == true) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used lasers! You dodged the attack!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
} else {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used lasers! The enemy dealt " + enemydmg + " damage!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
}
}
ambossdodge = false;
return false;
}
function enemymissiles() {
if (enemycharge == true || charge == true) {
enemydmg = 10;
if (enemycharge == true) {
if (randomInt(1, 4) == 1) {
enemydmg *= 3;
}
}
amboss();
hp -= enemydmg;
hplimit();
defeatcheck();
if (enemycharge == true) {
if (ambossdodge == true) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used lasers while charged! You dodged the attack!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
} else {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used lasers while charged! The enemy dealt " + enemydmg + " damage!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
}
} else if (charge == true) {
if (ambossdodge == true) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used lasers while you were charged! You dodged the attack!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
} else {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used lasers while you were charged! The enemy dealt " + enemydmg + " damage!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
}
}
} else if (shield == true) {
enemydmg = 5;
amboss();
hp -= enemydmg;
hplimit();
defeatcheck();
if (ambossdodge == true) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used missiles! You dodged the attack!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
} else {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used missiles! The enemy dealt " + enemydmg + " damage!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
}
} else if (shield == false) {
enemydmg = 10;
amboss();
hp -= enemydmg;
hplimit();
defeatcheck();
if (ambossdodge == true) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used missiles! You dodged the attack!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
} else {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy used missiles! The enemy dealt " + enemydmg + " damage!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
}
}
ambossdodge = false;
return false;
}
function enemyshieldZ() {
enemyshield = true;
enemycharge = false;
return false;
}
function enemyhullZ() {
enemyshield = false;
enemycharge = false;
return false;
}
function enemychargeZ() {
enemycharge = true;
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The enemy is charging up!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
return false;
}
function endturn() {
if (document.getElementById("Charge").checked) {
chargeZ();
} else if (document.getElementById("Lasers").checked) {
lasers();
} else if (document.getElementById("Missiles").checked) {
missiles();
} else if (document.getElementById("Repair").checked) {
repair();
}
if (document.getElementById("Shield").checked) {
charge = false;
shieldZ();
} else if (document.getElementById("Hull").checked) {
charge = false;
hullZ();
}
return false;
}
function enemyturn() {
createbattlefield();
defendchance = randomInt(1, 100);
if (defendchance >= 1 && defendchance <= 42) {
enemyshieldZ();
} else if (defendchance >= 43 && defendchance <= 85) {
enemyhullZ();
} else if (defendchance >= 86 && defendchance <= 100 && enemycharge == false) {
enemychargeZ();
}
if (enemycharge == false) {
attackchance = randomInt(1, 2);
if (attackchance == 1) {
enemylasers();
} else if (attackchance == 2) {
enemymissiles();
}
}
return false;
}
function victorycheck() {
enemyhplimit();
if (enemyhp == 0) {
enemycount -= 1;
enemyhp = 50;
justkilledenemy = true;
document.getElementById("battlefield").innerHTML = "<h2>Battlefield</h2><table id='battlefieldbox'><tr><td><img src='images/explosion.png' width='150' alt='explosion, a very dead enemy'</p></td></tr><tr><td><img src='images/" + shipimg + "' width='150' alt='" + shipalt + "' style='" + shieldup + "'><p>" + shipname + "</p><p>HP: " + hp + "</td></tr></table>";
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>You defeated an enemy!<button id='continuebutton' onclick='battle()'>Continue</button></div>";
if (enemycount == 0) {
victory = true;
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>VICTORY.<button id='continuebutton' onclick='afterbattle()'>Continue</button></div>";
afterbattle();
}
}
if (victory == true) {
dialoguecount = 0;
document.getElementById("battlefield").innerHTML = "<h2>Battlefield</h2><table id='battlefieldbox'><tr><td><img src='images/explosion.png' width='150' alt='explosion, a very dead enemy'</p></td></tr><tr><td><img src='images/" + shipimg + "' width='150' alt='" + shipalt + "' style='" + shieldup + "'><p>" + shipname + "</p><p>HP: " + hp + "</td></tr></table>";
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>VICTORY.<button id='continuebutton' onclick='afterbattle()'>Continue</button></div>";
}
return false;
}
function defeatcheck() {
if (hp == 0) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>GAME OVER.<button id='continuebutton' onclick='battle()'>Restart</button></div>";
document.getElementById("shipicon").innerHTML = "<img src='images/" + shipimg + "' width='150' alt='" + shipalt + "' /><p style='font-size: 15px;'>Ship: " + shipname + "</p><p style='font-size: 15px;'>HP: " + hp + "</p><p style='font-size: 15px;'>Bonus: Extra HP</p>";
document.getElementById("battlefield").innerHTML = "<h2>Battlefield</h2><table id='battlefieldbox'><tr><td><img src='images/Pirate_Enemy.png' width='150' alt='Enemy pirate spaceship' style='" + enemyshieldup + "'/><p>Pirate</p><p>HP: " + enemyhp + "</p></td></tr><tr><td><img src='images/explosion.png' width='150' alt='explosion, you are dead'><p>" + shipname + "</p><p>HP: " + hp + "</td></tr></table>";
document.getElementById("turnmenu").innerHTML = "";
victory = false;
justkilledenemy = false;
hp = 50;
maxhp = 50;
bloodstar();
dmg;
shield = true;
shieldup = "";
charge = false;
ambossdodge = false;
enemycount = 2;
enemyhp = 50;
enemydmg;
enemyshield = true;
enemyshieldup = "";
enemycharge = false;
}
return false;
}
function battle() {
music.play();
if (justkilledenemy == true) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>NEW ENEMY!<button id='continuebutton' onclick='createbattlefield()'>Continue</button></div></div>";
justkilledenemy = false;
enemyshield = true;
enemycharge = false;
} else {
createbattlefield();
}
return false;
}
function afterbattle() {
music.pause();
sessionStorage.setItem("victorydeuterv", "beaten");
if (dialoguecount == 0) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Keith T. Maxwell<img src='images/Keith_T_Maxwell.png' width='50' alt='Keith T Maxwell icon' style='margin-right: 20px; margin-left: 20px;'/>Great, that was the last of them.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
} else if (dialoguecount == 1) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>Keith? Checking in. Is everything okay?<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
} else if (dialoguecount == 2) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Keith T. Maxwell<img src='images/Keith_T_Maxwell.png' width='50' alt='Keith T Maxwell icon' style='margin-right: 20px; margin-left: 20px;'/>All is fine, Gunant. I've dealt with the pirates.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
} else if (dialoguecount == 3) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>What a relief. I cannot thank you enough for protecting this station.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
} else if (dialoguecount == 4) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Keith T. Maxwell<img src='images/Keith_T_Maxwell.png' width='50' alt='Keith T Maxwell icon' style='margin-right: 20px; margin-left: 20px;'/>There's no need to thank me, it's my job.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
} else if (dialoguecount == 5) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>Say, you are in need of a hyperdrive, right? Your current one's broken and you can't go far without one.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
} else if (dialoguecount == 6) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>How about I give you one? It's the least I can do for you helping us.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
} else if (dialoguecount == 7) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Keith T. Maxwell<img src='images/Keith_T_Maxwell.png' width='50' alt='Keith T Maxwell icon' style='margin-right: 20px; margin-left: 20px;'/>That'd be great, Gunant. I'd be honored. I do badly need one, after all...<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
} else if (dialoguecount == 8) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>Yes. However, hyperdrives are seriously expensive. Do you mind doing me a last tiny favour in return for the drive?<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
} else if (dialoguecount == 9) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Keith T. Maxwell<img src='images/Keith_T_Maxwell.png' width='50' alt='Keith T Maxwell icon' style='margin-right: 20px; margin-left: 20px;'/>I'd be obliged. What is it?<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
} else if (dialoguecount == 10) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>Just a simple task, really. A few days ago I've lost radio contact with a late convoy shipment to this station.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
} else if (dialoguecount == 11) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>All you have to do is go to Yrdal Gedal, where they should be, and find them.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
} else if (dialoguecount == 12) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>If you do, just tell them to tell me they're fine, okay? Then you're as free as a bird after.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
} else if (dialoguecount == 13) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Gunant Breh<img src='images/Gunant_Breh.png' width='60' alt='Gunant Breh' style='margin-right: 20px; margin-left: 20px;'/>I'll install the hyperdrive into your ship now. You should stay here for a while. All free, on me.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
} else if (dialoguecount == 14) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>Keith T. Maxwell<img src='images/Keith_T_Maxwell.png' width='50' alt='Keith T Maxwell icon' style='margin-right: 20px; margin-left: 20px;'/>Thanks, Gunant. I'll take your offer. I'm pretty tired, it's been a long day.<button id='continuebutton' onclick='continuebutton()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
} else if (dialoguecount == 15) {
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>The Narrator<img src='images/Narrator.png' width='60' alt='The narrator' style='margin-right: 20px; margin-left: 20px;'/>And so our hero, after his first battle in this new life, rests for his task tomorrow...<button id='continuebutton' onclick='nextroom()'>Continue</button><button id='continuebutton' onclick='nextroom()'>Skip</button></div>";
}
return false;
}
function nextroom() {
sessionStorage.setItem("yrdalgedal", "yrdalgedal");
document.getElementById("mapbox").innerHTML = "<img src='images/Yrdal_Gedal.jpeg' width='60' alt='Yrdal Gedal icon' style='margin-right: 20px; margin-left: 20px; '/><a href='yrdalgedal.html'>Yrdal Gedal</a>";
document.getElementById("dialoguebox").innerHTML = "<div class='dialogue'>NEW MAP LOCATION UNLOCKED: Yrdal Gedal</div>";
return false;
}
var shipname;
var shipimg;
var shipalt;
getship();
var victory = false;
var justkilledenemy = false;
var hp = 50;
var maxhp = 50;
bloodstar();
var dmg;
var shield = true;
var shieldup;
var charge = false;
var ambossdodge = false;
var enemycount = 2;
var enemyhp = 50;
var enemydmg;
var enemyshield = true;
var enemyshieldup;
var enemycharge = false;
</script>
</head>
<body>
<div class="box">
<h1>Deuter V</h1>
<p>A plain and average planet in the Mido System, known for its rich asteroid fields and extensive mining industry. Danger Level: Mild</p>
</div>
<div class="box">
<h2>Map</h2>
<p><img src='images/background.jpg' width='60' alt='Home page icon' style='margin-right: 20px; margin-left: 20px; '/><a href='index.html'>Home</a></p>
<p><img src='images/Deuter_V.jpeg' width='60' alt='Deuter V icon' style='margin-right: 20px; margin-left: 20px; '/><a href='deuterv.html'>Deuter V</a></p>
<div id="mapbox"></div>
</div>
<div class="box">
<h2>Battle</h2>
<div id="displaybattle"></div>
<div id="battlefield"></div>
<div id="turnmenu"></div>
</div>
<div id="dialoguebox"></div>
<div id="shipicon"></div>
<div id="charactericon"></div>
<audio id="music" controls loop>
<source src="sound/Interception.mp3" type="audio/mpeg">
</audio>
</body>
</html>
<script>
if (sessionStorage.getItem("yrdalgedal") != null) {
document.getElementById("mapbox").innerHTML = "<img src='images/Yrdal_Gedal.jpeg' width='60' alt='Yrdal Gedal icon' style='margin-right: 20px; margin-left: 20px; '/><a href='yrdalgedal.html'>Yrdal Gedal</a>";
}
document.getElementById("charactericon").innerHTML = "<img src='images/Keith_T_Maxwell.png' width='75' alt='Character icon of Keith T. Maxwell' /><p style='font-size: 10px;'>Name: Keith T. Maxwell</p><p style='font-size: 10px;'>Sex: Male</p><p style='font-size: 10px;'>Race: Terran</p>";
stats();
gamestart();
</script>