From 81e240b4acbe5dccceae66ed3227c20d290e04e3 Mon Sep 17 00:00:00 2001 From: FlyingKumquat Date: Wed, 22 Jul 2015 10:55:21 -0500 Subject: [PATCH 1/5] Enabled Cheapskate Portal Perk --- config.js | 9 ++++++--- main.js | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/config.js b/config.js index 4a07a94a..fb32adeb 100644 --- a/config.js +++ b/config.js @@ -208,12 +208,15 @@ 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: { + //These are gonna be harder than I thought. There's a lot of checks to prices. + /*Resourcefulness: { modifier: .05, tooltip: "Talk to your scientists about more efficient building designs. Each level reduces the cost of all buildings by 5%", }, */ diff --git a/main.js b/main.js index 3b61197a..253924a5 100644 --- a/main.js +++ b/main.js @@ -922,7 +922,7 @@ function checkJobItem(what, take, costItem, amtOnly) { var price = 0; if (cost.lastCheckCount != game.global.buyAmt || cost.lastCheckOwned != job.owned){ 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; From 4ace1d61a786871ec13bfcf1ee66aab525106f1f Mon Sep 17 00:00:00 2001 From: FlyingKumquat Date: Thu, 23 Jul 2015 00:46:47 -0500 Subject: [PATCH 2/5] Enabled Resourcefulness Portal Perk Also added a check when resetting perks to make sure building queue is empty (ignores auto-building traps). --- config.js | 8 +++++--- main.js | 20 ++++++++++++++++---- updates.js | 6 ++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/config.js b/config.js index fb32adeb..fe033801 100644 --- a/config.js +++ b/config.js @@ -215,11 +215,13 @@ var toReturn = { tooltip: "Discuss negotiation tactics with your leading scientists. Permanently reduces the cost of all jobs by 5%", level: 0, }, - //These are gonna be harder than I thought. There's a lot of checks to prices. - /*Resourcefulness: { + 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 253924a5..8b02e564 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() { 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 = "
Got it
"; + elem.style.left = "32.5%"; + elem.style.top = "25%"; } if (isItIn == "jobs"){ if (game.global.firing){ From f2c79e53da65097f4ffd5f15cd9e276399898b5f Mon Sep 17 00:00:00 2001 From: FlyingKumquat Date: Thu, 23 Jul 2015 03:04:23 -0500 Subject: [PATCH 3/5] Fixed Coordination calculation This issue was reported a few times on the Trimps subreddit. --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index 8b02e564..35297c10 100644 --- a/main.js +++ b/main.js @@ -955,7 +955,7 @@ function checkJobItem(what, take, costItem, amtOnly) { } function buyUpgrade(what) { - if (what == "Coordination" && (Math.ceil(game.resources.trimps.max / 2) < (game.resources.trimps.maxSoldiers * 2))) { + if (what == "Coordination" && (Math.ceil(game.resources.trimps.max / 2) < (game.resources.trimps.maxSoldiers * 1.25))) { message("You should probably expand your territory a bit first.", "Notices"); return; } From 79b8380aec847395fb0b01d15d1772e93b4b3404 Mon Sep 17 00:00:00 2001 From: FlyingKumquat Date: Thu, 23 Jul 2015 06:25:32 -0500 Subject: [PATCH 4/5] Added a check for recalculating if the level of Cheapskate changes --- main.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 35297c10..fcf7023a 100644 --- a/main.js +++ b/main.js @@ -932,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] * (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; From e05a391683a6ebd8502b7ec37cb6b8b969a5d88a Mon Sep 17 00:00:00 2001 From: FlyingKumquat Date: Thu, 23 Jul 2015 12:42:00 -0500 Subject: [PATCH 5/5] Undid previous Coordination calculation "fix" --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index fcf7023a..721aca48 100644 --- a/main.js +++ b/main.js @@ -959,7 +959,7 @@ function checkJobItem(what, take, costItem, amtOnly) { } function buyUpgrade(what) { - if (what == "Coordination" && (Math.ceil(game.resources.trimps.max / 2) < (game.resources.trimps.maxSoldiers * 1.25))) { + if (what == "Coordination" && (Math.ceil(game.resources.trimps.max / 2) < (game.resources.trimps.maxSoldiers * 2))) { message("You should probably expand your territory a bit first.", "Notices"); return; }