genbtc / AutoTrimps

Automation for the idle incremental game 'Trimps'
36 stars 51 forks source link

Auto Stance 3 bug #171

Open Patashu opened 6 years ago

Patashu commented 6 years ago

If both Scryer and Auto Stance 3 are selected but you haven't reached z180 yet, Automaps breaks.

    if (getPageSetting('UseScryerStance'))  useScryerStance();  //"Use Scryer Stance"   (scryer.js)
     else if (getPageSetting('AutoStance')<=1) autoStance();     //"Auto Stance"       (autostance.js)
-    else if (getPageSetting('AutoStance')==2) autoStance2();    //"Auto Stance #2"         (")
+    else if (getPageSetting('AutoStance')===2) autoStance2();    //"Auto Stance #2"         (")
+    else if (getPageSetting('AutoStance')===3) autoStance3();   //"Auto Stance #3"         (")

This if/else if means that only useScryerStance() runs, autoStance3() doesn't.

However, useScryerStance() does not run autoStance code if you're in Auto Stance 3 and haven't reached z180 yet, because it doesn't have a check for Auto Stance 3:

function useScryerStance() {
    var AutoStance = getPageSetting('AutoStance');
    function autostancefunction() {
        if (AutoStance<=1) autoStance();    //"Auto Stance"
        else if (AutoStance==2) autoStance2();   //"Auto Stance #2"
    };
    //check preconditions   (exit quick, if impossible to use)
    var use_auto = game.global.preMapsActive || game.global.gridArray.length === 0 || game.global.highestLevelCleared < 180;
    use_auto = use_auto || game.global.world <= 60;
    use_auto = use_auto || game.global.mapsActive && getCurrentMapObject().location == "Void" && getPageSetting('ScryerUseinVoidMaps2') == 2;
    if (use_auto) {
        autostancefunction();
        wantToScry = false;
        return;
    }

The solution is to edit autostancefunction() to add a check for Auto Stance 3.

Forks like Slivers will also have to apply this fix.

Patashu commented 6 years ago

Fix you can cherry pick https://github.com/slivermasterz/AutoTrimps/commit/49ca01f824e36f62c017d5f4fefb9bbd7717a252