-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
111 lines (97 loc) · 2.95 KB
/
index.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
<html>
<head>
<!--
# TODO
- Save state automatically updated in base64 url string. Note does not save current board, reloading it restarts your current mission (same as losing a match).
-->
<link rel="stylesheet" href="styles.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<div id='content'></div>
<br>
<br>
<center><a href='https://github.com/emeth-/invasion-of-meridell' target='_blank'>View Source Code On Github</a></center>
<script>
function rand(min,max) {
// From https://stackoverflow.com/a/7228322/8967723
// min and max included
//mimics php's rand(min, max)
return Math.floor(Math.random()*(max-min+1)+min);
}
function array_rand(array, num) {
// From http://locutus.io/php/array/array_rand/
var keys = Object.keys(array);
if (typeof num === 'undefined' || num === null) {
num = 1;
} else {
num = +num;
}
if (isNaN(num) || num < 1 || num > keys.length) {
return null;
}
// shuffle the array of keys
for (var i = keys.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1)); // 0 ≤ j ≤ i
var tmp = keys[j];
keys[j] = keys[i];
keys[i] = tmp;
}
return num === 1 ? keys[0] : keys.slice(0, num);
}
</script>
<script>
var saved_details = {
'my_team': [],
'villages_unturned': 6,
'villages_total': 6,
'lost_items_retrieved_by_mission': {
"1": "",
"2": "",
"3": "",
"4": "",
"5": "",
"6": "",
"7": "",
"8": "",
"9": "",
"10": "",
}
};
var my_team, enemies, mission, battle, turns_left, player_name;
//mission = rand(1,10);
//battle = rand(1,3);
player_name = "Guest";
mission = 1;
battle = 1;
villages_unturned = 6;
villages_total = 6;
turns_left = 5;
//Shortcut key, hit P to 'pass', equivalent to clicking 'End Turn Now'
function doc_keyUp(e) {
if (e.keyCode == 80) { // 'p'
move_enemies();
}
}
document.addEventListener('keyup', doc_keyUp, false);
</script>
<script src='data.js?v=2'></script>
<script src='team_select.js?v=2'></script>
<script>
window.my_team = generate_new_team();
team_select();
</script>
<script src='gameplay_invader.js?v=2'></script>
<script src='gameplay_team.js?v=2'></script>
<script src='board.js?v=2'></script>
<script>
var saved_ls_session = localStorage.getItem('saved_ls_session');
if(saved_ls_session) {
start_mission();
window.saved_details = JSON.parse(saved_ls_session);
window.mission = window.saved_details['mission'];
restart_mission();
}
</script>
</body>
</html>