Skip to content

Commit 249fe4c

Browse files
committed
Added Spiritomb bot and some improvements
1 parent 4ad5950 commit 249fe4c

File tree

2 files changed

+7
-62
lines changed

2 files changed

+7
-62
lines changed

SysBot.Pokemon/BotEncounter/EncounterBot.cs

Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ protected override async Task MainLoop(CancellationToken token)
4545
EncounterMode.Regigigas => DoRegigigasEncounter(token),
4646
EncounterMode.Regis => DoRegiEncounter(token),
4747
EncounterMode.LegendaryDogs => DoDogEncounter(token),
48-
EncounterMode.SwordsJustice => DoJusticeEncounter(token),
49-
EncounterMode.GalarianArticuno => DoGArticunoEncounter(token),
50-
//EncounterMode.LGPE => DoLGPEEncounter(token),
48+
//SoJ and Spirittomb uses the same routine
49+
EncounterMode.SwordsJustice => DoJusticeEncounter(token,"Sword of Justice"),
50+
EncounterMode.Spiritomb => DoJusticeEncounter(token,"Spiritomb"),
5151
_ => WalkInLine(token),
5252
};
5353
await task.ConfigureAwait(false);
@@ -155,8 +155,6 @@ private async Task DoRegiEncounter(CancellationToken token)
155155
var pk = await ReadUntilPresent(WildPokemonOffset, 2_000, 0_200, token).ConfigureAwait(false);
156156
if (pk == null)
157157
{
158-
Log("Not Wild Offset. Restarting loop.");
159-
160158
// Flee and continue looping.
161159
while (await IsInBattle(token).ConfigureAwait(false))
162160
await FleeToOverworld(token).ConfigureAwait(false);
@@ -220,7 +218,7 @@ private async Task DoDogEncounter(CancellationToken token)
220218
}
221219
}
222220

223-
private async Task DoJusticeEncounter(CancellationToken token)
221+
private async Task DoJusticeEncounter(CancellationToken token, String name)
224222
{
225223
Log("Reminder: LDN-MITM SYSMODULE IS REQUIRED IN ORDER FOR THIS BOT TO WORK!");
226224
while (!token.IsCancellationRequested)
@@ -229,7 +227,7 @@ private async Task DoJusticeEncounter(CancellationToken token)
229227
await CloseGame(Hub.Config, token).ConfigureAwait(false);
230228
await StartGame(Hub.Config, token).ConfigureAwait(false);
231229

232-
Log("Looking for a Legendary...");
230+
Log("Looking for a " + name);
233231
// Click through all the menus untill the encounter.
234232
while (!await IsInBattle(token).ConfigureAwait(false))
235233
await Click(A, 1_000, token).ConfigureAwait(false);
@@ -238,8 +236,6 @@ private async Task DoJusticeEncounter(CancellationToken token)
238236
var pk = await ReadUntilPresent(WildPokemonOffset, 2_000, 0_200, token).ConfigureAwait(false);
239237
if (pk == null)
240238
{
241-
Log("Not Wild Offset. Restarting loop.");
242-
243239
// Flee and continue looping.
244240
while (await IsInBattle(token).ConfigureAwait(false))
245241
await FleeToOverworld(token).ConfigureAwait(false);
@@ -255,55 +251,6 @@ private async Task DoJusticeEncounter(CancellationToken token)
255251
}
256252
}
257253

258-
private async Task DoGArticunoEncounter(CancellationToken token)
259-
{
260-
Log("PLEASE NOTE THAT THIS BOT IS NOT FULLY FUNCTIONAL. ONLY AVAILABLE FOR TESTING PURPOSES.");
261-
while (!token.IsCancellationRequested)
262-
{
263-
//Waiting for Articuno Battle
264-
int i = 0;
265-
while (await ReadUntilPresent(WildPokemonOffset, 2_000, 0_200, token).ConfigureAwait(false) == null)
266-
{
267-
await Task.Delay(0_500, token).ConfigureAwait(false);
268-
if (i == 5) Log("The Pokémon is flew away. Sorry.");
269-
i++;
270-
}
271-
272-
//Read Pokémon Information
273-
Log("Articuno Encounter started! Checking details...");
274-
var pk = await ReadUntilPresent(WildPokemonOffset, 2_000, 0_200, token).ConfigureAwait(false);
275-
if (pk == null)
276-
Log("Not right Offset.");
277-
278-
// Offsets are flickery so make sure we see it 3 times.
279-
for (i = 0; i < 3; i++)
280-
await ReadUntilChanged(BattleMenuOffset, BattleMenuReady, 5_000, 0_100, true, token).ConfigureAwait(false);
281-
282-
if (await HandleEncounter(pk, true, token).ConfigureAwait(false))
283-
return;
284-
285-
// Run away if not the wanted encounter
286-
await FleeToOverworld(token).ConfigureAwait(false);
287-
288-
// Waiting to be in the overworld
289-
while (!await IsOnOverworld(Hub.Config, token).ConfigureAwait(false))
290-
await Click(A, 1_000, token).ConfigureAwait(false);
291-
292-
// Enter and exit Pokecamp in order to respawn the Pokemon
293-
await PokeCamp(Hub.Config, token);
294-
}
295-
}
296-
297-
private async Task DoLGPEEncounter(CancellationToken token)
298-
{
299-
Log("Inside the LGPE bot");
300-
while (!token.IsCancellationRequested)
301-
{
302-
Log("");
303-
}
304-
}
305-
306-
307254
private async Task<int> StepUntilEncounter(CancellationToken token)
308255
{
309256
Log("Walking around until an encounter...");

SysBot.Pokemon/BotEncounter/EncounterModes.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ public enum EncounterMode
3838
SwordsJustice,
3939

4040
/// <summary>
41-
/// Bot will soft reset the Swords of Justice Trio
41+
/// Bot will soft reset Spiritomb
4242
/// </summary>
43-
GalarianArticuno,
44-
45-
//LGPE,
43+
Spiritomb,
4644
}
4745
}

0 commit comments

Comments
 (0)