Added towns/cities/metropolises

This commit is contained in:
Josh Mudge 2017-09-15 21:40:20 -06:00
parent 5808156e10
commit 286656de4e
2 changed files with 22 additions and 1 deletions

View File

@ -33,6 +33,18 @@ Enter 1 if you have a capital. (2.5% bonus)
<br><br> <br><br>
<input type="number" id="capital"></input> <input type="number" id="capital"></input>
<br><br> <br><br>
Enter the number of towns in your empire. (See: https://ltlto.com/josh/mcserver/wiki/Rent for the definition of a town.) (0.5% bonus)
<br><br>
<input type="number" id="town"></input>
<br><br>
Enter the number of cities in your empire. (See: https://ltlto.com/josh/mcserver/wiki/Rent for the definition of a city.) (1.0% bonus)
<br><br>
<input type="number" id="city"></input>
<br><br>
Enter the number of metropolises in your empire. (See: https://ltlto.com/josh/mcserver/wiki/Rent for the definition of a metropolis.) (1.5% bonus)
<br><br>
<input type="number" id="metro"></input>
<br><br>
<input type="button" value="Calculate Income" onclick="calculate()" /> <input type="button" value="Calculate Income" onclick="calculate()" />
<p id="Answer"></p> <p id="Answer"></p>

View File

@ -18,6 +18,9 @@ function calculate() {
var embassies = document.getElementById("embassies").value; var embassies = document.getElementById("embassies").value;
var capital = document.getElementById("capital").value; var capital = document.getElementById("capital").value;
var infra = document.getElementById("infra").value; var infra = document.getElementById("infra").value;
var town = document.getElementById("town").value;
var city = document.getElementById("city").value;
var metro = document.getElementById("metro").value;
if (blocks.match(numReg)) if (blocks.match(numReg))
{ {
@ -44,7 +47,13 @@ function calculate() {
console.log(capital) console.log(capital)
var infra = +infra * 0.005 var infra = +infra * 0.005
console.log(infra) console.log(infra)
var percent = +one + +two + +design + +embassies + +capital var town = +town * 0.005
console.log(town)
var city = +city * 0.01
console.log(city)
var metro = +metro * 0.01
console.log(metro)
var percent = +one + +design + +gov + +embassies + +capital + +infra
console.log(percent) console.log(percent)
var total = +emeralds * +percent +emeralds var total = +emeralds * +percent +emeralds
var total = total.toFixed(4); var total = total.toFixed(4);