From 2a7bb4ba1a4c4f93b0ff929a5fe4d1848f6b9f5f Mon Sep 17 00:00:00 2001 From: genBTC Date: Sun, 5 Nov 2023 07:09:00 -0500 Subject: [PATCH] Redo Gathers for Trap/Trimps --- modules/buildings.js | 4 +-- modules/gather.js | 60 +++++++++++++++++++++++--------------------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/modules/buildings.js b/modules/buildings.js index e30006db0..421994cee 100644 --- a/modules/buildings.js +++ b/modules/buildings.js @@ -2,8 +2,8 @@ MODULES["buildings"] = {}; //These can be changed (in the console) if you know what you're doing: MODULES["buildings"].nursCostRatio = 0.05; //nursery to warpstation/collector cost ratio. Also for extra gems. MODULES["buildings"].storageMainCutoff = 0.85; //when to buy more storage. (85% ) -MODULES["buildings"].storageLowlvlCutoff1 = 0.7; //when to buy more storage at zone 1 -MODULES["buildings"].storageLowlvlCutoff2 = 0.5; //when to buy more storage from zone 2-10 (more leeway so it doesnt fill up) +MODULES["buildings"].storageLowlvlCutoff1 = 0.67; //when to buy more storage at zone 1 +MODULES["buildings"].storageLowlvlCutoff2 = 0.70; //when to buy more storage from zone 2-10 (more leeway so it doesnt fill up) var housingList = ['Hut', 'House', 'Mansion', 'Hotel', 'Resort', 'Gateway', 'Collector', 'Warpstation']; diff --git a/modules/gather.js b/modules/gather.js index 7a26aff38..c7bae3adc 100644 --- a/modules/gather.js +++ b/modules/gather.js @@ -1,8 +1,10 @@ MODULES["gather"] = {}; //These can be changed (in the console) if you know what you're doing: -MODULES["gather"].minTraps = 5; +MODULES["gather"].minTraps = 500; MODULES["gather"].minScienceAmount = 100; MODULES["gather"].minScienceSeconds = 60; +MODULES["gather"].minBreedingTrimps = 6; +MODULES["gather"].alwaysGoFullTrap = true; //OLD: "Auto Gather/Build" function manualLabor() { @@ -18,7 +20,7 @@ function manualLabor() { var hasTurkimp = game.talents.turkimp2.purchased || game.global.turkimpTimer > 0; //FRESH GAME NO HELIUM CODE. - if (game.global.world <=3 && game.global.totalHeliumEarned<=5000) { + if (game.global.world <= 3 && game.global.totalHeliumEarned<=5000) { if (game.global.buildingsQueue.length == 0 && (game.global.playerGathering != 'trimps' || game.buildings.Trap.owned == 0)){ if (!game.triggers.wood.done || game.resources.food.owned < 10 || Math.floor(game.resources.food.owned) < Math.floor(game.resources.wood.owned)) setGather('food'); @@ -27,15 +29,17 @@ function manualLabor() { } } - if(watchJumpstartTraps || trapTrimpsOK && (breedingTrimps < 5 || trapperTrapUntilFull) && game.buildings.Trap.owned == 0 && canAffordBuilding('Trap')) { + var wannaTrapTrimps = (breedingTrimps < MODULES["gather"].minBreedingTrimps || trapperTrapUntilFull || watchJumpstartTraps); + //Traps and Trimps: //build trap when at 0 traps //try buying in the if + if(trapTrimpsOK && wannaTrapTrimps && game.buildings.Trap.owned == 0 && canAffordBuilding('Trap') && !safeBuyBuilding('Trap')) { //safeBuyBuilding returns false if item is already in queue - if(!safeBuyBuilding('Trap')) - setGather('buildings'); + setGather('buildings'); //then build if it bought } - else if (watchJumpstartTraps || trapTrimpsOK && (breedingTrimps < 5 || trapperTrapUntilFull) && game.buildings.Trap.owned > 0) { + //BuildTrap/CheckTrap > 1 + else if (trapTrimpsOK && wannaTrapTrimps && game.buildings.Trap.owned > 0) { setGather('trimps'); - if (trapperTrapUntilFull && (game.global.buildingsQueue.length == 0 || game.buildings.Trap.owned == 1) && !game.global.trapBuildAllowed && canAffordBuilding('Trap')) - safeBuyBuilding('Trap'); //get ahead on trap building since it is always needed for Trapper + if (trapperTrapUntilFull && (game.global.buildingsQueue.length == 0 || game.buildings.Trap.owned == 1) && !game.global.trapBuildAllowed && canAffordBuilding('Trap') && safeBuyBuilding('Trap')) //get ahead on trap building since it is always needed for Trapper + return; } else if (getPageSetting('ManualGather2') != 2 && game.resources.science.owned < MODULES["gather"].minScienceAmount && document.getElementById('scienceCollectBtn').style.display != 'none' && document.getElementById('science').style.visibility != 'hidden') setGather('science'); @@ -48,8 +52,7 @@ function manualLabor() { setGather('buildings'); } //if we have some upgrades sitting around which we don't have enough science for, gather science - else if (game.resources.science.owned < scienceNeeded && document.getElementById('scienceCollectBtn').style.display != 'none' && document.getElementById('science').style.visibility != 'hidden') { - // debug('Science needed ' + scienceNeeded); + else if (game.resources.science.owned < getScienceNeeded() && document.getElementById('scienceCollectBtn').style.display != 'none' && document.getElementById('science').style.visibility != 'hidden') { if ((getPlayerModifier() < getPerSecBeforeManual('Scientist') && hasTurkimp)||getPageSetting('ManualGather2') == 2){ //if manual is less than science production, switch on turkimp setGather('metal'); @@ -60,7 +63,7 @@ function manualLabor() { } else if (trapTrimpsOK && targetBreed < getBreedTime(true)){ //combined to optimize code. - if (game.buildings.Trap.owned < 100 && canAffordBuilding('Trap')) { + if (game.buildings.Trap.owned < MODULES["gather"].minTraps && canAffordBuilding('Trap')) { safeBuyBuilding('Trap'); setGather('buildings'); } @@ -122,7 +125,7 @@ function manualLabor() { } } -//NEW: #2 "Auto Gather/Build" +//NEW: #2 "Auto Gather/Build" (+no science) function manualLabor2() { if (getPageSetting('ManualGather2')==0) return; //vars @@ -136,7 +139,7 @@ function manualLabor2() { var hasTurkimp = game.talents.turkimp2.purchased || game.global.turkimpTimer > 0; //FRESH GAME LOWLEVEL NOHELIUM CODE. - if (game.global.world <=3 && game.global.totalHeliumEarned<=5000) { + if (game.global.world <= 3 && game.global.totalHeliumEarned<=5000) { if (game.global.buildingsQueue.length == 0 && (game.global.playerGathering != 'trimps' || game.buildings.Trap.owned == 0)){ if (!game.triggers.wood.done || game.resources.food.owned < 10 || Math.floor(game.resources.food.owned) < Math.floor(game.resources.wood.owned)) { setGather('food'); @@ -149,18 +152,18 @@ function manualLabor2() { } } - //Traps and Trimps: - if(trapTrimpsOK && (breedingTrimps < 5 || trapperTrapUntilFull || watchJumpstartTraps) && game.buildings.Trap.owned == 0 && canAffordBuilding('Trap')) { - //safeBuyBuilding returns false if item is already in queue - if(!safeBuyBuilding('Trap')) - setGather('buildings'); + var wannaTrapTrimps = (breedingTrimps < MODULES["gather"].minBreedingTrimps || trapperTrapUntilFull || watchJumpstartTraps); + //Traps and Trimps: //build trap when at 0 traps //try buying in the if + if(trapTrimpsOK && wannaTrapTrimps && game.buildings.Trap.owned == 0 && canAffordBuilding('Trap') && !safeBuyBuilding('Trap')) { + setGather('buildings'); //then build if it bought return; } - else if (trapTrimpsOK && (breedingTrimps < 5 || trapperTrapUntilFull || watchJumpstartTraps) && game.buildings.Trap.owned > 0) { + //BuildTrap/CheckTrap > 1 + else if (trapTrimpsOK && wannaTrapTrimps && game.buildings.Trap.owned > 0) { setGather('trimps'); - if (trapperTrapUntilFull && (game.global.buildingsQueue.length == 0 || game.buildings.Trap.owned == 1) && !game.global.trapBuildAllowed && canAffordBuilding('Trap')) - safeBuyBuilding('Trap'); //get ahead on trap building since it is always needed for Trapper - return; + //get ahead on trap building since it is always needed for Trapper + if (trapperTrapUntilFull && (game.global.buildingsQueue.length == 0 || game.buildings.Trap.owned == 1) && !game.global.trapBuildAllowed && canAffordBuilding('Trap') && safeBuyBuilding('Trap')) + return; } //Buildings: @@ -181,13 +184,12 @@ function manualLabor2() { //if we have some upgrades sitting around which we don't have enough science for, gather science if (document.getElementById('scienceCollectBtn').style.display != 'none' && document.getElementById('science').style.visibility != 'hidden') { //if we have less than (100) science or less than a minute of science - if (game.resources.science.owned < MODULES["gather"].minScienceAmount || - (game.resources.science.owned < getPsString('science', true) * MODULES["gather"].minScienceSeconds && game.global.turkimpTimer < 1)) - if (getPageSetting('ManualGather2') != 2) { - setGather('science'); - return; - } - if (game.resources.science.owned < scienceNeeded) { + if (getPageSetting('ManualGather2') != 2 && game.resources.science.owned < MODULES["gather"].minScienceAmount || + (game.resources.science.owned < getPsString('science', true) * MODULES["gather"].minScienceSeconds && game.global.turkimpTimer < 1)) { + setGather('science'); + return; + } + if (game.resources.science.owned < getScienceNeeded()) { //if manual is less than science production and turkimp, metal. (or science is set as disallowed) if ((getPlayerModifier() < getPerSecBeforeManual('Scientist') && hasTurkimp) || getPageSetting('ManualGather2') == 2) setGather('metal');