|
|
|
@@ -19,6 +19,23 @@ let clickVictim = "micro"; |
|
|
|
|
|
|
|
let lastTime = 0; |
|
|
|
|
|
|
|
const activePowerups = []; |
|
|
|
|
|
|
|
function tickPowerups(delta) { |
|
|
|
// I love mutating arrays as I traverse them. |
|
|
|
for (let i = activePowerups.length-1; i >= 0; i--) { |
|
|
|
activePowerups[i].lifetime -= delta; |
|
|
|
if (activePowerups[i].lifetime <= 0) { |
|
|
|
clickPopup("OOF", "info", [500, 500]); |
|
|
|
activePowerups.splice(i, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function addPowerup(powerup) { |
|
|
|
activePowerups.push({powerup: powerup, lifetime: powerup.duration}); |
|
|
|
} |
|
|
|
|
|
|
|
function applyGlobalProdBonuses(productivity) { |
|
|
|
for (let effect of effects["prod-all"]) { |
|
|
|
|
|
|
|
@@ -109,6 +126,7 @@ function updateDisplay() { |
|
|
|
displayResources(); |
|
|
|
displayBuildings(); |
|
|
|
displayUpgrades(showOwnedUpgrades); |
|
|
|
tickPowerups(delta); |
|
|
|
|
|
|
|
setTimeout(updateDisplay, 1000/updateRate); |
|
|
|
} |
|
|
|
|