diff --git a/config.js b/config.js index 4a07a94a..fe033801 100644 --- a/config.js +++ b/config.js @@ -208,15 +208,20 @@ var toReturn = { tooltip: "Pay your Trimps to knock you around a little bit. By learning to not be such a wuss, your Trimps will be less wussy as well. Adds 5% health permanently to your Trimps.", level: 0, }, - //These are gonna be harder than I thought. There's a lot of checks to prices. -/* Cheapskate: { + Cheapskate: { modifier: .05, + priceBase: 1, + heliumSpent: 0, tooltip: "Discuss negotiation tactics with your leading scientists. Permanently reduces the cost of all jobs by 5%", + level: 0, }, Resourcefulness: { modifier: .05, + priceBase: 1, + heliumSpent: 0, tooltip: "Talk to your scientists about more efficient building designs. Each level reduces the cost of all buildings by 5%", - }, */ + level: 0, + }, //rewardResources main Looting: { diff --git a/main.js b/main.js index 3b61197a..721aca48 100644 --- a/main.js +++ b/main.js @@ -366,6 +366,12 @@ function checkOfflineProgress(){ function respecPerks(){ if (!game.global.canRespecPerks) return; + if (game.global.buildingsQueue.length > 0 + && !(game.global.buildingsQueue.length == 1 && game.global.buildingsQueue[0] == "Trap.1")){ + cancelPortal(); + tooltip("Unable to Respec", null, "update"); + return; + } game.global.respecActive = true; displayPortalUpgrades(); game.resources.helium.respecMax = 0; @@ -673,12 +679,14 @@ function canAffordTwoLevel(whatObj, takeEm) { function resolvePow(cost, whatObj, addOwned) { if (!addOwned) addOwned = 0; - var compare; + var compare, + mod = 1; if (typeof whatObj.done !== 'undefined') compare = 'done'; if (typeof whatObj.level !== 'undefined') compare = 'level'; if (typeof whatObj.owned !== 'undefined') compare = 'owned'; if (typeof whatObj.purchased !== 'undefined') compare = 'purchased'; - return (Math.floor(cost[0] * Math.pow(cost[1], (whatObj[compare] + addOwned)))); + if (typeof whatObj.craftTime !== 'undefined') mod = 1 - (game.portal.Resourcefulness.modifier * game.portal.Resourcefulness.level); + return (Math.floor((cost[0] * mod) * Math.pow(cost[1], (whatObj[compare] + addOwned)))); } //Now with equipment! @@ -710,13 +718,17 @@ function getBuildingItemPrice(toBuy, costItem, isEquipment){ var compare = (isEquipment) ? "level" : "purchased"; var thisCost = toBuy.cost[costItem]; if (typeof thisCost[1] !== 'undefined'){ - if (thisCost.lastCheckCount != game.global.buyAmt || thisCost.lastCheckOwned != toBuy[compare]){ + if (thisCost.lastCheckCount != game.global.buyAmt + || thisCost.lastCheckOwned != toBuy[compare] + || (!isEquipment && thisCost.lastCheckResourcefulness != game.portal.Resourcefulness.level) + ){ for (var x = 0; x < game.global.buyAmt; x++){ price += resolvePow(thisCost, toBuy, x); } thisCost.lastCheckCount = game.global.buyAmt; thisCost.lastCheckAmount = price; thisCost.lastCheckOwned = toBuy[compare]; + if (!isEquipment) thisCost.lastCheckResourcefulness = game.portal.Resourcefulness.level; } else price = thisCost.lastCheckAmount; } @@ -850,7 +862,7 @@ function calculatePercentageBuildingCost(what, resourceToCheck, costModifier){ var struct = game.buildings[what]; var res = game.resources[resourceToCheck]; var dif = struct.purchased - struct.owned; - return Math.floor(costModifier * res.max * Math.pow(struct.increase.by, dif)); + return Math.floor(((costModifier * res.max) * (1 - (game.portal.Resourcefulness.modifier * game.portal.Resourcefulness.level))) * Math.pow(struct.increase.by, dif)); } function trapThings() { @@ -920,13 +932,17 @@ function checkJobItem(what, take, costItem, amtOnly) { var job = game.jobs[what]; var cost = job.cost[costItem]; var price = 0; - if (cost.lastCheckCount != game.global.buyAmt || cost.lastCheckOwned != job.owned){ + if (cost.lastCheckCount != game.global.buyAmt + || cost.lastCheckOwned != job.owned + || thisCost.lastCheckCheapskate != game.portal.Cheapskate.level + ){ for (var x = 0; x < game.global.buyAmt; x++) { - price += Math.floor(cost[0] * Math.pow(cost[1], (job.owned + x))); + price += Math.floor((cost[0] * (1 - (game.portal.Cheapskate.modifier * game.portal.Cheapskate.level))) * Math.pow(cost[1], (job.owned + x))); } cost.lastCheckCount = game.global.buyAmt; cost.lastCheckAmount = price; cost.lastCheckOwned = job.owned; + cost.lastCheckCheapskate = game.portal.Cheapskate.level; } else { price = cost.lastCheckAmount; diff --git a/updates.js b/updates.js index ef7ff3d0..05fae9b5 100644 --- a/updates.js +++ b/updates.js @@ -164,6 +164,12 @@ function tooltip(what, isItIn, event, textString) { else tooltipText = "Go back to to the World Map."; costText = ""; + }if (what == "Unable to Respec"){ + tooltipText = "You must empty your building queue before resetting your perks." + game.global.lockTooltip = true; + costText = "