-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
172 lines (144 loc) · 5.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
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
<title>Redstone Flux Machine</title>
</head>
<body>
<form name="_xclick" action="https://www.paypal.com/yt/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="item_name" value="Team In Training">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="amount" value="12.00">
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
Your current energy: <output id="result"></output> RF out of <output id="rfstorage"></output> RF.<br>
Making <output id="totalBonus"></output> RF/t.<br><br>
<button id=buttonA onclick="buy(0);">Buy Survivalist Generator</button><br>
Cost of next one: <output id="costA"></output><br>
You own <output id="amountA"></output> survivalist generators.<br>
They make <output id="bonusA"></output> RF/t.<br>
<output id="canPay"></output><br><br>
<button id=buttonB onclick="buy(1);">Buy Furnace Generator</button><br>
Cost of next one: <output id="costB"></output><br>
You own <output id="amountB"></output> Furnace Generators.<br>
They make <output id="bonusB"></output> RF/t.<br>
<output id="canPay"></output><br><br>
<button id=buttonC onclick="buy(2);">Buy Steam Dynamo</button><br>
Cost of next one: <output id="costC"></output><br>
You own <output id="amountC"></output> Steam Dynamos.<br>
They make <output id="bonusC"></output> RF/t.<br>
<output id="canPay"></output><br><br>
<button id=buttonD onclick="buy(3);">Buy Magmatic Dynamo</button><br>
Cost of next one: <output id="costD"></output><br>
You own <output id="amountD"></output> Magmatics.<br>
They make <output id="bonusD"></output> RF/t.<br>
<output id="canPay"></output><br><br>
<button id=buttonE onclick="buy(4);">Buy Advanced Solar Panel</button><br>
Cost of next one: <output id="costE"></output><br>
You own <output id="amountE"></output> Advanced Solars.<br>
They make <output id="bonusE"></output> RF/t.<br>
<output id="canPay"></output><br><br>
<button id=buttonF onclick="buy(5);">Buy Big Reactor</button><br>
Cost of next one: <output id="costF"></output><br>
You own <output id="amountF"></output> Big Reactors.<br>
They make <output id="bonusF"></output> RF/t.<br>
<output id="canPay"></output><br><br>
<button id=buttonG onclick="buy(6);">Buy Ultimate Hybrid Solar Panel</button><br>
Cost of next one: <output id="costG"></output><br>
You own <output id="amountG"></output> Ultimate Hybrid Solar Panels.<br>
They make <output id="bonusG"></output> RF/t.<br>
<output id="canPay"></output><br><br>
<button id=buttonH onclick="buy(7);">Buy Quantum Solar Panel</button><br>
Cost of next one: <output id="costH"></output><br>
You own <output id="amountH"></output> Quantum Solars.<br>
They make <output id="bonusH"></output> RF/t.<br>
<output id="canPay"></output><br><br>
<button onclick="upgrade(0);">Buy leadstone energy cell</button> Provides 100 more storage. 100RF<br>
<button onclick="upgrade(1);">Buy BatBox</button> Provides 200 more storage. 200RF<br>
<button onclick="upgrade(2);">Buy basic capacitor bank</button> Provides 500 more storage. 500RF<br>
<button onclick="upgrade(3);">Buy overclocker</button> 50% more RF/t! 1kRF<br>
<script language="JavaScript">
var buyCost = 0;
var buildingModifier = 0;
var currentCost = [15, 50, 300, 1000, 2500, 5000, 10000, 25000];
var building = [0, 0, 0, 0, 0, 0, 0, 0];
var money = 15;
var baseBonuses = [1, 2, 5, 10, 50, 100, 250, 500];
var currentBonuses = [0, 0, 0, 0, 0, 0, 0, 0];
var totalBonus = 0;
var level = -1;
var resetCanPayTimeout;
var alphabetArr = ["A","B","C","D","E","F","G","H"];
var upgradeBonus = 0;
var upgradeMult = 1;
var upgradeCost = [100, 200, 500, 1000];
var upgradeMultList = [1, 1, 1, 1.5];
var upgradeRFStorageList = [100, 500, 1000, 100]
var storage = 200
function doAction( )
{
for(var i = 0;i<building.length;i++)
{
money+=building[i]*baseBonuses[i];
}
if(money > storage) {
money = storage
}
document.getElementById("rfstorage").innerHTML = storage;
document.getElementById("result").innerHTML = money;
setTimeout(doAction,1000);
}
function beginGame() {
doAction( );
refreshBonuses();
}
function nlogn(n) {
return n * Math.log10(n) * 0.9;
}
function checkBuyable(cost) {
if(cost > money) {
return false;
}
return true;
}
function buy(buildingID) {
if (checkBuyable(currentCost[buildingID])) {
document.getElementById("result").innerHTML = money;
money-=currentCost[buildingID];
building[buildingID]+=1;
currentCost[buildingID] = Math.ceil(nlogn(currentCost[buildingID]));
} else {
document.getElementById("canPay").innerHTML = "Too Expensive to buy another!";
window.clearTimeout(resetCanPayTimeout);
resetCanPayTimeout = setTimeout(resetCanPay,1000);
}
refreshBonuses();
}
function resetCanPay() {
document.getElementById("canPay").innerHTML = " ";
}
function refreshBonuses() {
document.getElementById("result").innerHTML = money;
totalBonus = 0;
for (var i = 0; i < building.length; i++) {
currentBonuses[i] = baseBonuses[i] * building[i];
totalBonus = totalBonus + currentBonuses[i];
}
setTimeout(function(){
alphabetArr.forEach(function(row, i){
document.getElementById("cost" + row).innerHTML = currentCost[i];
document.getElementById("amount" + row).innerHTML = building[i];
document.getElementById("bonus" + row).innerHTML = currentBonuses[i];
})
}, 1);
totalBonus = totalBonus * upgradeMult;
document.getElementById("totalBonus").innerHTML = totalBonus;
}
function upgrade(upgradeID){
if(checkBuyable(upgradeCost[upgradeID])) {
upgradeMult = upgradeMultList[upgradeID] * upgradeMult;
storage += upgradeRFStorageList[upgradeID];
}
refreshBonuses()
}
beginGame();
</script>
</body>