Show emeralds and the efficiency bonus.

This commit is contained in:
Josh Mudge 2017-09-19 17:34:52 -06:00
parent 568a41f0d9
commit 864ac46469
2 changed files with 12 additions and 5 deletions

View File

@ -1,6 +1,6 @@
"use strict"; "use strict";
//Licensed under the Apache License 2.0. See license file for information. //Licensed under the Apache License 2.0. See license file for information.
// Ardon Income Calculator v3.1.1 stable. // Ardon Income Calculator v3.2 stable.
// Written by Josh Mudge // Written by Josh Mudge
// Ad Mejorem Dei Glorium // Ad Mejorem Dei Glorium
@ -57,17 +57,23 @@ function calculate() {
console.log(metro) console.log(metro)
var percent = +one + +design + +gov + +embassies + +capital + +infra + +chain + +town + +city + +metro var percent = +one + +design + +gov + +embassies + +capital + +infra + +chain + +town + +city + +metro
console.log(percent) console.log(percent)
var bonus = +percent * 100
var bonus = bonus.toFixed(2);
console.log(bonus)
var total = +gold * +percent var total = +gold * +percent
console.log(total) console.log(total)
var total = +total + +gold var total = +total + +gold
console.log(total) console.log(total)
var total = total.toFixed(0); var total = total.toFixed(0);
console.log(total) console.log(total)
var date = Date(); var emeralds = +total / 100
console.log(date) console.log(emeralds)
//var date = Date();
//console.log(date)
//Show result //Show result
alert("Your income is " + total + " Gold"); alert("Your Income is " + total + " Gold (or " + emeralds + " emeralds) per Minecraft Year (5 days)");
document.getElementById("Income").innerHTML = "Your Income is " + total + " Gold per Minecraft Year (5 days)"; document.getElementById("Bonus").innerHTML = "Your Efficiency bonus is " + bonus + "%";
document.getElementById("Income").innerHTML = "Your Income is " + total + " Gold (or " + emeralds + " emeralds) per Minecraft Year (5 days)";
} }

View File

@ -52,6 +52,7 @@ Enter the number of metropolises in your empire. (See: https://ltlto.com/josh/mc
<br><br> <br><br>
<input type="button" value="Calculate Income" onclick="calculate()" /> <input type="button" value="Calculate Income" onclick="calculate()" />
<p id="Income"></p> <p id="Income"></p>
<p id="Bonus"></p>
<br><br><br><br><br> <br><br><br><br><br>
<script src="calculate.js"></script> <script src="calculate.js"></script>
<p>&copy; Copyright 2017 Joshua Mudge</p> <p>&copy; Copyright 2017 Joshua Mudge</p>