-
Notifications
You must be signed in to change notification settings - Fork 0
/
civ.html
85 lines (81 loc) · 2.97 KB
/
civ.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
<html>
<head>
<TITLE>Civ 5 Randomiser</TITLE>
<style>
body{
font-family: "Arial"
}
</style>
<script type="text/javascript">
function genCivs()
{
var civs=["America","Arabia","Assyria","Austria","Aztecs","Babylon", //5
"Brazil","Byzantium","Carthage","Celts","China","Denmark",
"Netherlands",//12
"Egypt","England","Ethiopia","France","Germany","Greece","Huns", //19
"Inca","India","Indonesia","Iroquois","Japan","Korea", //25
"Maya","Mongolia","Morrocco", "Ottomans","Persia","Poland", //31
"Polynesia","Portugal","Rome","Russia", //35
"Shoshone","Siam","Songhai","Spain","Sweden","Venice","Zulu"];
var n=document.getElementById("numCivs").value;
document.getElementById("out").innerHTML="";
//checking numbers, update to be more dynamic later
if(n>18 || n<1)
{
alert("Invalid Number.");
return;
}
//remove invalid civs
if(!document.getElementById("gk").checked)
{
civs[3]=null; civs[8]=null; civs[9]=null; civs[26]=null; civs[7]=null; civs[19]=null; civs[15]=null; civs[40]=null; civs[12]=null;
}
if(!document.getElementById("bnw").checked)
{
civs[31]=null; civs[2]=null; civs[6]=null; civs[42]=null; civs[33]=null; civs[22]=null; civs[28]=null; civs[41]=null; civs[36]=null;
}
if(!document.getElementById("gk").checked && !document.getElementById("si".checked))
civs[39]=null;
if(!document.getElementById("bnw").checked && !document.getElementById("gk".checked))
civs[15]=null;
if(!document.getElementById("bab").checked)
civs[5]=null;
if(!document.getElementById("si").checked)
civs[20]=null;
if(!document.getElementById("po").checked)
civs[32]=null;
if(!document.getElementById("da").checked)
civs[11]=null;
if(!document.getElementById("dprk").checked)
civs[25]=null;
//now time to choose
for(var i=0; i<n; i++)
{
do
{
var rand=civs[Math.floor(Math.random()*43)];
//alert(rand);
}while(rand==null);
document.getElementById("out").innerHTML+="<li>"+rand+"</li>";
}
}
</script>
</head>
<body>
<h1>Civ 5 Random Civ Combo Generator</h1>
<h2>Options:</h2>
<label for="numCivs">Number of Civs: </label><input type="number" id="numCivs"></input><br/>
<h3>DLCs Owned:</h3>
<label for="gk">Gods and Kings: </label><input type="checkbox" id="gk"></input><br/>
<label for="bnw">Brave New World: </label><input type="checkbox" id="bnw"></input><br/>
<label for="bab">Babylon: </label><input type="checkbox" id="bab"></input><br/>
<label for="si">Spain & Inca: </label><input type="checkbox" id="si"></input><br/>
<label for="po">Polynesia: </label><input type="checkbox" id="po"></input><br/>
<label for="da">Denmark: </label><input type="checkbox" id="da"></input><br/>
<label for="dprk">Korea: </label><input type="checkbox" id="dprk"></input><br/>
<button type="button" onclick="genCivs()">Go!</button>
<h2>Results:</h2>
<ol id="out">
</ol>
</body>
</html>