Skip to content

Commit

Permalink
Fix for Soaring and Walking Mode
Browse files Browse the repository at this point in the history
This adds additional checks to the walking mode in the Gen 6 SR bot to
make sure that the step toward the Mirage Spot or Legendary is taken,
making the bot much more stable.
It also makes the Soaring bot much more reliable because it's now not
going to stop if it gets into a random encounter in the sky anymore.
  • Loading branch information
MichiS97 committed Feb 4, 2017
1 parent 28aaaf3 commit b570241
Showing 1 changed file with 50 additions and 10 deletions.
60 changes: 50 additions & 10 deletions PKMN-NTR/Bot/SoftResetbot6.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ public SoftResetbot6(int botmode, bool botresume, bool orasgame)
pssettingsOff = 0x19C244;
pssettingsIN = 0x830000;
pssettingsOUT = 0x500000;
pssdisableOff = 0x630DA5;
pssdisableY = 120;
pssdisableIN = 0x33000000;
pssdisableOUT = 0x33100000;
pssdisableOff = 0x630DA5;
dialogOff = 0x62C2F4;
dialogIN = 0x0D;
dialogOUT = 0x0A;
Expand All @@ -123,6 +123,9 @@ public SoftResetbot6(int botmode, bool botresume, bool orasgame)

public async Task<int> RunBot()
{
int steps = 0;
bool walk = false;
bool wrong_enc = false;
try
{
while (!botstop)
Expand Down Expand Up @@ -177,10 +180,15 @@ public async Task<int> RunBot()
case 4:
if (resume)
{
steps = 0;
walk = true;
botState = (int)srbotstates.twk_start;

}
else
{
steps = 0;
walk = true;
botState = (int)srbotstates.pssmenush;
}
break;
Expand Down Expand Up @@ -476,6 +484,7 @@ public async Task<int> RunBot()
attempts++;
botresult = 7;
botState = (int)srbotstates.trigger;

}
break;

Expand Down Expand Up @@ -513,13 +522,42 @@ public async Task<int> RunBot()
}
else
{
attempts++;
botresult = 3;
botState = (int)srbotstates.trigger;
if (walk)
{
steps++;
Report("Steps: " + steps);
if (steps >= 10)
{
steps = 0;
attempts++;
botresult = 7;
botState = (int)srbotstates.twk_start;
}
else
{
attempts++;
botresult = 3;
botState = (int)srbotstates.trigger;
}

}
else
{
attempts++;
botresult = 3;
botState = (int)srbotstates.trigger;

}


}
break;

case (int)srbotstates.filter:
if(walk)
{
steps = 0;
}
bool testsok = Program.gCmdWindow.CheckSoftResetFilters();
if (testsok)
{
Expand All @@ -538,7 +576,9 @@ public async Task<int> RunBot()
break;

case (int)srbotstates.softreset:
if(!wrong_enc)
resetNo++;
wrong_enc = false;
Report("Bot: Sof-reset #" + resetNo.ToString());
waitTaskbool = Program.helper.waitSoftReset();
if (await waitTaskbool)
Expand All @@ -553,7 +593,7 @@ public async Task<int> RunBot()
break;

case (int)srbotstates.skipintro:
await Task.Delay(36 * commanddelay);
await Task.Delay(44 * commanddelay);
Report("Bot: Skip intro cutscene");
Program.helper.quickbuton(LookupTable.keyA, commandtime);
await Task.Delay(commandtime + commanddelay);
Expand All @@ -568,15 +608,15 @@ public async Task<int> RunBot()
break;

case (int)srbotstates.skiptitle:
await Task.Delay(16 * commanddelay);
await Task.Delay(20 * commanddelay);
Report("Bot: Skip title screen");
Program.helper.quickbuton(LookupTable.keyA, commandtime);
await Task.Delay(commandtime + commanddelay);
botState = (int)srbotstates.startgame;
break;

case (int)srbotstates.startgame:
await Task.Delay(20 * commanddelay);
await Task.Delay(24 * commanddelay);
Report("Bot: Start game");
Program.helper.quickbuton(LookupTable.keyA, commandtime);
await Task.Delay(commandtime + commanddelay);
Expand Down Expand Up @@ -740,9 +780,9 @@ public async Task<int> RunBot()
}
else
{
Report("Bot: Dialog failed, imposible to check position to continue");
botresult = -1;
botState = (int)srbotstates.botexit;
Report("Bot: Dialog failed, imposible to check position to continue, probably different encounter");
wrong_enc = true;
botState = (int)srbotstates.softreset;
}
break;

Expand Down

0 comments on commit b570241

Please # to comment.