diff --git a/constants.js b/constants.js index d866a48..0d10a21 100644 --- a/constants.js +++ b/constants.js @@ -192,11 +192,32 @@ const effect_types = { "desc": function(effect) { return round(effect.amount * 100) + "% of food/sec gained per click"; } + }, + "click-victim": { + "desc": function(effect) { + return "Devour larger prey"; + } } } let upgrades = { - + "click-anthro": { + "name": "Same-Size Prey", + "desc": "Devour an anthro with every click", + "icon": "fa-male", + "cost": { + "food": 1000 + }, + "effects": [ + { + "type": "click-victim", + "id": "anthro" + } + ], + "prereqs": { + + } + } } function createTemplateUpgrades() { diff --git a/gorge.js b/gorge.js index 90024f9..32c183d 100644 --- a/gorge.js +++ b/gorge.js @@ -15,6 +15,7 @@ let updateRate = 60; let currentProductivity = {}; let clickBonus = 0; +let clickVictim = "micro"; let lastTime = 0; @@ -249,6 +250,14 @@ function updateClickBonus() { clickBonus = bonus; } +function updateClickVictim() { + for (let effect of effects["click-victim"]) { + if (ownedUpgrades[effect.parent]) { + clickVictim = effect.id; + } + } +} + function buyUpgrade(id, e) { if (ownedUpgrades[id]) { return; @@ -270,10 +279,11 @@ function buyUpgrade(id, e) { updateProductivity(); updateClickBonus(); + updateClickVictim(); } -function eatMicro() { - const add = productivityMultiplierOf("micro") + clickBonus; +function eatPrey() { + const add = buildings[clickVictim]["prod"] * 10 * productivityMultiplierOf(clickVictim) + clickBonus; resources.food += add; return add; } @@ -359,7 +369,7 @@ function initializeData() { function registerListeners() { document.querySelector("#tasty-micro").addEventListener("click", (e) => { - const add = eatMicro(); + const add = eatPrey(); const text = "+" + round(add, 1) + " food"; const gulp = "*glp*"; clickPopup(text, "food", [e.clientX, e.clientY]); @@ -660,10 +670,6 @@ function upgradeTooltip(id, event) { yTrans = Math.min(yTrans, height - tooltipSize - 150); - console.log(height); - console.log(yOffset); - console.log(yTrans); - tooltip.style.setProperty("transform", "translate(-220px, " + yTrans + "px)"); }