Skip to content

Commit

Permalink
Add Permanent Upgrade Support to autoMagmiteSpender
Browse files Browse the repository at this point in the history
  • Loading branch information
gen BTC authored and gen BTC committed Nov 22, 2016
1 parent 0c3b887 commit af16aaa
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
28 changes: 24 additions & 4 deletions AutoTrimps2.js
Original file line number Diff line number Diff line change
Expand Up @@ -2887,10 +2887,30 @@ function useScryerStance() {

//Auto Magmite spender before portal
function autoMagmiteSpender() {
//Part #1:
//list of available permanent one-and-done upgrades
var permanames = ["Slowburn","Shielding","Storage","Hybridization"];
//cycle through:
for (var i=0; i < permanames.length; i++) {
var item = permanames[i];
var upgrade = game.permanentGeneratorUpgrades[item];
if (typeof upgrade === 'undefined')
return; //error-resistant
//skip owned perma-upgrades
if (upgrade.owned)
continue;
var cost = upgrade.cost();
//if we can afford anything, buy it:
if (game.global.magmite >= cost) {
buyPermanentGeneratorUpgrade(item);
debug("Auto Spending " + cost + " Magmite on: " + item, "general");
}
}
//Part #2
var repeat = true;
while (repeat) {
try {
//list of available upgrades (doesnt handle one-time upgrades)
//list of available multi upgrades
var names = ["Efficiency","Capacity","Supply"];
var lowest = [null,null]; //keep track of cheapest one
//cycle through:
Expand All @@ -2908,11 +2928,11 @@ function autoMagmiteSpender() {
lowest = [item,cost];
}
//if we can afford anything, buy it:
if (game.global.magmite > lowest[1]) {
if (game.global.magmite >= lowest[1]) {
buyGeneratorUpgrade(lowest[0]);
debug("Auto Spending " + lowest[1] + " Magmite on: " + lowest[0] + " #" + game.generatorUpgrades[lowest[0]].upgrades, "general");
}
//if we can't. exit the loop
//if we can't, exit the loop
else
repeat = false;
}
Expand Down Expand Up @@ -2963,7 +2983,7 @@ function delayStart() {
function delayStartAgain(){
setInterval(mainLoop, runInterval);
updateCustomButtons();
tooltip('confirm', null, 'update', '<b>ChangeLog: -Please Read- </b><br><b>11/21 Patch 4.0 fixes are happening!<br>-Auto Spend Magmite before portaling - setting in genBTC page - (buys cheapest non-permanent upgrade)<br>Buy 2 buildings instead of 1 if we have the mastery.<br>Entirely remove high lumberjack ratio during Spire.<br>During Magma with 3000+ Tributes, switch to 1/2/2 auto-worker-ratios instead of 1/2/22.<br>Add a 10 second timeout Popup window that can postpone Autoportal when clicked.<br>Added a No Nurseries Until setting in genBTC page</b>', 'cancelTooltip()', 'Script Update Notice ' + ATversion);
tooltip('confirm', null, 'update', '<b>ChangeLog: -Please Read- </b><br><b>11/21 Patch 4.0 fixes are happening!<br>-Auto Spend Magmite before portaling - setting in genBTC page (read tooltip)<br>Buy 2 buildings instead of 1 if we have the mastery.<br>Entirely remove high lumberjack ratio during Spire.<br>During Magma with 3000+ Tributes, switch to 1/2/2 auto-worker-ratios instead of 1/2/22.<br>Add a 10 second timeout Popup window that can postpone Autoportal when clicked.<br>Added a No Nurseries Until setting in genBTC page</b>', 'cancelTooltip()', 'Script Update Notice ' + ATversion);
document.getElementById('Prestige').value = autoTrimpSettings.PrestigeBackup.selected;
}

Expand Down
2 changes: 1 addition & 1 deletion NewUI2.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ createSetting('AutoHeirlooms2', 'Auto Heirlooms2', 'IMPORTANT SETTING. New algor
createSetting('AutoUpgradeHeirlooms', 'Auto Upgrade Heirlooms', 'Automatically buys the upgrades the script advises for the Equipped shield and staff, until we are out of nullifium.', 'boolean', null, null,'genBTC');
createSetting('TrainerCaptoTributes', 'Cap Trainers to a % of Tributes', 'Only Buy a Trainer when its cost is LESS than X% of cost of a tribute. This setting can work in combination with the other one, or set the other one to -1 and this will take full control. Default: -1 (Disabled). 50% is close to the point where the cap does nothing. You can go as low as you want but recommended is 10% to 1%. (example: Trainer cost of 5001, Tribute cost of 100000, @ 5%, it would NOT buy the trainer.)', 'value', '-1', null, 'genBTC');
createSetting('NoNurseriesUntil', 'No Nurseries Until z', 'For Magma z230+ purposes. Nurseries get shut down, and wasting nurseries early on is probably a bad idea. Might want to set this to 230+ for now.', 'value', 0, null, 'genBTC');
createSetting('AutoMagmiteSpender', 'Auto Spend Magmite', 'Auto Spends any unspent Magmite immediately before portaling. Buys cheapest non-permanent upgrade. For Magma z230+ purposes. EXPERIMENTAL.', 'boolean', false, null, 'genBTC');
createSetting('AutoMagmiteSpender', 'Auto Spend Magmite', 'Auto Spends any unspent Magmite immediately before portaling. Part 1 buys any permanent one-and-done upgrades in order from most expensive to least. Part 2 then finds/buys the cheapest non-permanent multi-upgrade and repeats itself until you cant buy anymore. For Magma z230+ purposes. EXPERIMENTAL.', 'boolean', false, null, 'genBTC');

// Scryer settings
createSetting('UseScryerStance', 'Use Scryer Stance', 'Stay in Scryer stance in z181 and above (Overrides Autostance). Falls back to regular Autostance when not in use (so leave that on). Current point is to get Dark Essence. EXPERIMENTAL. This is the Master button. All other buttons have no effect if this one is off.', 'boolean',true,null,'Scryer');
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Feel free to submit any bugs/suggestions as issues here on github.

## Current feature changes by genBTC (up to date as of 11/22/2016):
- 11/21 Patch 4.0 fixes are happening!
- Auto Spend Magmite before portaling - setting in genBTC page - (buys cheapest non-permanent upgrade)
- Auto Spend Magmite before portaling - (setting in genBTC page)- Part 1 buys any permanent one-and-done upgrades in order from most expensive to least. Part 2 then finds/buys the cheapest non-permanent multi-upgrade and repeats itself until you cant buy anymore.
- Buy 2 buildings instead of 1 if we have the mastery
- Entirely remove high lumberjack ratio during Spire.
- During Magma with 3000+ Tributes, switch to 1/2/2 auto-worker-ratios instead of 1/2/22.
Expand Down

0 comments on commit af16aaa

Please sign in to comment.