|
|
@@ -78,6 +78,7 @@ function buyBuilding(type) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
updateProductivity(); |
|
|
updateProductivity(); |
|
|
|
|
|
updateClickBonus(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
// update stuff |
|
|
// update stuff |
|
|
@@ -235,8 +236,11 @@ function buyUpgrade(id) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function eatMicro() { |
|
|
function eatMicro() { |
|
|
resources.food += productivityMultiplierOf("micro") + clickBonus; |
|
|
|
|
|
|
|
|
const add = productivityMultiplierOf("micro") + clickBonus; |
|
|
|
|
|
resources.food += add; |
|
|
|
|
|
return add; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// setup stuff lol |
|
|
// setup stuff lol |
|
|
|
|
|
|
|
|
// we'll initialize the dict of buildings we can own |
|
|
// we'll initialize the dict of buildings we can own |
|
|
@@ -316,7 +320,10 @@ function initializeData() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function registerListeners() { |
|
|
function registerListeners() { |
|
|
document.querySelector("#tasty-micro").addEventListener("click", eatMicro); |
|
|
|
|
|
|
|
|
document.querySelector("#tasty-micro").addEventListener("click", (e) => { |
|
|
|
|
|
const add = eatMicro(); |
|
|
|
|
|
clickPopup("+" + round(add, 1) + " food", [e.clientX, e.clientY]); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
document.querySelector("#save").addEventListener("click", save); |
|
|
document.querySelector("#save").addEventListener("click", save); |
|
|
|
|
|
|
|
|
@@ -532,6 +539,24 @@ function renderEffects(effectList) { |
|
|
return renderLines(list); |
|
|
return renderLines(list); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function clickPopup(text, location) { |
|
|
|
|
|
const div = document.createElement("div"); |
|
|
|
|
|
div.textContent = text; |
|
|
|
|
|
|
|
|
|
|
|
div.classList.add("click-popup"); |
|
|
|
|
|
|
|
|
|
|
|
div.style.left = location[0] + "px"; |
|
|
|
|
|
div.style.top = location[1] + "px"; |
|
|
|
|
|
|
|
|
|
|
|
const body = document.querySelector("body"); |
|
|
|
|
|
|
|
|
|
|
|
body.appendChild(div); |
|
|
|
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
body.removeChild(div); |
|
|
|
|
|
}, 2000); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function fillTooltip(type, field, content) { |
|
|
function fillTooltip(type, field, content) { |
|
|
let item = document.querySelector("#" + type + "-tooltip-" + field); |
|
|
let item = document.querySelector("#" + type + "-tooltip-" + field); |
|
|
if (typeof(content) === "string") { |
|
|
if (typeof(content) === "string") { |
|
|
|