Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
28 changes: 22 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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!
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<div class='maxCenter'><div class='btn btn-info' onclick='cancelTooltip()'>Got it</div></div>";
elem.style.left = "32.5%";
elem.style.top = "25%";
}
if (isItIn == "jobs"){
if (game.global.firing){
Expand Down