Skip to content

Commit

Permalink
first steps of Mi changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Unihedro committed Apr 7, 2017
1 parent 399aa9b commit 4260713
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ buildingfix.js
SpireDiffCheck.txt
debugdynamicprestige.txt
*~
mi.ps
20 changes: 12 additions & 8 deletions AutoTrimps2.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// ==UserScript==
// @name AutoTrimpsV2+unimod
// @namespace https://github.com/unihedro/AutoTrimps
// @version 2.1.5.3u2-unimod-4-07-2017+Modular
// @version 2.1.5.3u3-unimod-4-07-2017+Modular
// @description try to take over the world!
// @author zininzinin, spindrjr, belaith, ishakaru, genBTC, Unihedron
// @include *trimps.github.io*
// @include *kongregate.com/games/GreenSatellite/trimps
// @grant none
// ==/UserScript==
var ATversion = '2.1.5.3u2-unimod-4-07-2017+Modular';
var ATversion = '2.1.5.3u3-unimod-4-07-2017+Modular';

////////////////////////////////////////////////////////////////////////////////
//Main Loader Initialize Function (loads first, load everything else)///////////
Expand Down Expand Up @@ -54,13 +54,15 @@ function initializeAutoTrimps() {

function printChangelog() {
tooltip('confirm', null, 'update', '\
<br><span style="background-color:#552700"><b>4/07 v2.1.5.3u2</b> - new settings TrimpleZ, ScryerDieZ, IgnoreCrits</span>\
<br> Managing Ancient Treasure.\
<br><span style="opacity:.8">You can now set a zone to run Trimple of Doom but it won\'t work until the next patch is out of beta.</span>\
<br><span style="background-color:#6E1236"><b>4/07 v2.1.5.3u3</b> - new settings LinearZ, SupplyWall, OneTimeOnly</span>\
<br> Auto dismiss Magma dialogue\
<br> Auto magmite spending behaviour changes\
<br><span style="opacity:.8">First level of overclock considered as a one-and-done upgrade (do it ASAP!). Buys Supply only when it costs <2x of Capacity (instead of <1x Capacity) <b>configurable with SupplyWall</b>, or buy Supply sooner and only buy Capacity when it costs <Nx of Supply (<b>use negative SupplyWall</b>) zero to use previous behaviour for supply evaluation, one to <b>DISABLE BUYING SUPPLY</b>.</span>\
<br><span style="background-color:#552700;opacity:.6"><b>4/07 v2.1.5.3u2</b> - new settings TrimpleZ, ScryerDieZ, IgnoreCrits\
<br> Managing Ancient Treasure. <span style="opacity:.8">(For next patch)</span>\
<br> Dark theme graphs!\
<br><span style="opacity:.8">Uses a custom stylesheet by Uni (me) for the graph to look dark and awesome. If you don\'t like it, make one yourself. Loaded by default if you use "Dark Theme". (Until a button is added, refresh after setting Dark Theme)</span>\
<br> Fixed bugs caused by "cleaning up settings storage".\
<br><span style="background-color:#277552;opacity:.6"><b>4/06 v2.1.5.3u1</b> - new settings Don\'t buy Coords / Skip challenge maps\
<br> Fixed bugs caused by "cleaning up settings storage".</span>\
<br><span style="background-color:#277552;opacity:.5"><b>4/06 v2.1.5.3u1</b> - new settings Don\'t buy Coords / Skip challenge maps\
<br> Added Spire farming progress as an Auto Maps status.\
<br> Cleaned up settings storage.</span>\
<br><u>Report any bugs/problems please! You can find me on Discord: <span style="background-color:#ddd;color:#222">Uni#8610</span></u>\
Expand Down Expand Up @@ -167,6 +169,8 @@ function mainLoop() {
if(document.getElementById('tipTitle').innerHTML == 'Corruption') cancelTooltip();
//auto-close the Spire notification checkbox
if(document.getElementById('tipTitle').innerHTML == 'Spire') cancelTooltip();
//auto-close the Spire notification checkbox
if(document.getElementById('tipTitle').innerHTML == 'The Magma') cancelTooltip();
setTitle(); //set the browser title
setScienceNeeded(); //determine how much science is needed

Expand Down
7 changes: 7 additions & 0 deletions NewUI2.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ function initializeAllSettings() {
createSetting('ScryerDieZ', 'Scryer Suicide Z', 'You know, Die To Use S is helpful and all, but sometimes it doesn\'t matter in early zones. Don\'t you think so? That was a rhetorical question, don\'t answer it. Like Void Maps config, you can put a decimal value for cell, like 230.60 for after zone 230 for >= 60th cell.', 'value', 230.60, null, 'Uni');
//createSetting('PowerSaving', 'Power Saving', 'Avoid killing your army. Don\'t force abandon trimps when dagger climbing. Will still Die To Use Z and aggressively autostance to aid progression and anything else. Made for Empower daily, you might find it helpful if you\'re doing Workplace Safety feat. Then again with that I strongly recommend doing it fully manually. Anyway, don\'t blame me whatever happens.', 'value', 230, null, 'Uni');
createSetting('IgnoreCrits', ['Safety First', 'Ignore Void Strength', 'Ignore All Crits'], 'No longer switches to B against corrupted precision and/or void strength. <b>Basically we now treat \'crit things\' as regular in both autoStance and autoStance2</b>. In fact it no longer takes precision / strength into account and will manage like a normal enemy, thus retaining X / D depending on your needs. If you\'re certain your block is high enough regardless if you\'re fighting a crit guy in a crit daily, use this! Alternatively, manage the stances yourself.', 'multitoggle', 0, null, 'Uni');
createSetting('LinearZ', 'Linear Prestige Z', 'On and after this zone is reached, always try to prestige for everything immediately, overriding Dynamic Prestige settings. Will not override Prestige Skip mode, but that\'s also because I (ab)use Prestige Skip to force exit prestiges when I need it to stop prestiging.', 'value', -1, null, 'Uni');
createSetting('SupplyWall', 'Throttle Supply (or Capacity)', 'Positive number NOT 1 e.g. 2.5: Consider Supply when its cost * 2.5 is < Capacity, instead of immediately when < Cap. Effectively throttles supply for when you don\t need too many.<br><br>Negative number (-1 is ok) e.g. -2.5: Consider Supply if it costs < Capacity * 2.5, buy more supplys! Effectively throttling capacity instead.<br><br><b>Set to 1: DISABLE SUPPLY only spend magmite on Efficiency, Capacity and Overclocker. (For some end game players, supply is worth probably figuratively nothing.)<br>Set to 0: IGNORE SETTING and use old behaviour (will still try to buy overclocker)</b>', 'valueNegative', 0, null, 'Uni');
createSetting('OneTimeOnly', 'One Time / Overclock Only', 'Makes the magmite spending sequence only buy one time upgrades and overclock, ignoring Efficiency, Capacity and Supply. Intended for manual use. Does not disable itself.', 'boolean', false, null, 'Uni');
createSetting('MagmiteExplain', 'Magmite spending behaviour', '1. Buy one-and-done upgrades, expensive first, then consider 1st level of Overclocker;<br>2. Buy Overclocker IF AND ONLY IF we can afford it;<br>2.5. Exit if OneTimeOnly<br>3. Buy Efficiency if it is better than capacity;<br>4. Buy Capacity or Supply depending on which is cheaper, or based on SupplyWall', 'infoclick', 'MagmiteExplain', null, 'Uni');
// Scryer settings
createSetting('UseScryerStance', 'Use Scryer Stance', '<b>MASTER BUTTON</b> Stay in Scryer stance in z181 and above (Overrides Autostance). Falls back to regular Autostance when not in use (so leave that on). Get 2x resources or Dark Essence. <u>All other buttons have no effect if this one is off.</u>', 'boolean', true, null, 'Scryer');
createSetting('ScryerUseWhenOverkill', 'Use When Overkill', 'Use when we can Overkill in S stance, for double loot with no speed penalty. Recommend this be on. NOTE: This being on, and being able to overkill in S will override ALL other settings <u>(Except never use in spire)</u>. This is a boolean logic shortcut that disregards all the other settings including Min and Max Zone. If you ONLY want to use S during Overkill, as a workaround: turn this on and Min zone: to 9999 and everything else off(red). ', 'boolean', true, null, 'Scryer');
Expand Down Expand Up @@ -346,6 +350,9 @@ function AutoTrimpsTooltip(what, isItIn, event) {
resetModuleVars();
tooltipText = "Autotrimps MODULE variable settings have been successfully reset to its defaults!";
costText = "<div class='maxCenter'><div id='confirmTooltipBtn' class='btn btn-info' onclick='cancelTooltip();'>OK</div></div>";
} else if (what == 'MagmiteExplain') {
tooltipText = "Autotrimps MODULE variable settings have been successfully reset to its defaults!";
costText = "<div class='maxCenter'><div id='confirmTooltipBtn' class='btn btn-info' onclick='cancelTooltip();'>OK</div></div>";
}
game.global.lockTooltip = true;
elem.style.left = "33.75%";
Expand Down
14 changes: 14 additions & 0 deletions mi.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
digraph S {
onetime [label="one time upgrades\noverclocker lv1\n(if hybrid & storage)"];
{ rank=same; onetime; Efficiency; }
onetime -> Overclocker [label="if affordable"];
Overclocker -> Efficiency [label="if better\nthan capacity"];
Overclocker:se -> SupplyWall0 -> { Capacity, Supply } [label="cheapest"];
Overclocker:s -> SupplyWall1 -> Capacity;
Overclocker:w -> { SupplyWallX [color=darkgreen] } [color=darkgreen];
SupplyWallX -> Capacity [label="if cap > (N * sup)", color=darkgreen];
Capacity -> Supply [label="else", color=darkgreen];
Overclocker:e -> { SupplyWallN [color=red] } [color=red];
SupplyWallN -> Supply [label="if (cap * N) > sup)", color=red] ;
Supply -> Capacity [label="else", color=red];
}
Binary file added mi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 29 additions & 9 deletions modules/other.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,16 @@ function autoMagmiteSpender() {
didSpend = true;
}
}
// then consider overclocker if we can afford it
var hasOv = game.permanentGeneratorUpgrades.Hybridization.owned && game.permanentGeneratorUpgrades.Storage.owned;
var ovclock = game.generatorUpgrades.Overclocker;
if (hasOv && (game.global.magmite >= ovclock.cost())) {
debug("Auto Spending " + ovclock.cost() + " Magmite on: Overclocker" + (ovclock.upgrades ? " #" + (ovclock.upgrades + 1) : ""), "general");
buyGeneratorUpgrade('Overclocker');
}
//Part #2
var repeat = true;

var repeat = !getPageSetting('OneTimeOnly');
while (repeat) {
try {
if (MODULES["magmite"].algorithm == 2) {
Expand All @@ -93,7 +100,6 @@ function autoMagmiteSpender() {
var eff = game.generatorUpgrades["Efficiency"];
var cap = game.generatorUpgrades["Capacity"];
var sup = game.generatorUpgrades["Supply"];
var ovclock = game.generatorUpgrades["Overclocker"];
if ((typeof eff === 'undefined')||(typeof cap === 'undefined')||(typeof sup === 'undefined'))
return; //error-resistant
var EffObj = {};
Expand All @@ -116,16 +122,30 @@ function autoMagmiteSpender() {
if (EffObj.miCostPerPct <= CapObj.miCostPerPct)
item = EffObj.name;
//if not, (try to) Buy Capacity if its cheaper than the cost of Supply.
else if (CapObj.cost <= sup.cost())
item = CapObj.name;
//if not, (try to) Buy Supply.
else
item = "Supply"
else {
const supCost = sup.cost();
var wall = getPageSetting('SupplyWall');
// If no wall, try to buy Capacity if it's cheaper.
if (!wall)
item = (CapObj.cost <= supCost)
? CapObj.name : "Supply";
// If 1, disable Supply
else if (wall == 1)
item = "Capacity";
// If negative, prioritize Supply after applying cap.
else if (wall < 0)
item = (supCost <= CapObj.cost * -wall)
? "Supply" : "Capacity";
// If positive, throttle Supply after applying cap.
else
item = (CapObj.cost <= supCost * wall)
? "Capacity" : "Supply";
}
upgrade = game.generatorUpgrades[item];
//IF we can afford anything, buy it:
if (game.global.magmite >= upgrade.cost()) {
debug("Auto Spending " + upgrade.cost() + " Magmite on: " + item + " #" + (game.generatorUpgrades[item].upgrades+1), "general");
buyGeneratorUpgrade(item);
buyGeneratorUpgrade(item);
didSpend = true;
}
//if we can't, exit the loop
Expand Down

0 comments on commit 4260713

Please sign in to comment.