Skip to content

Commit f242004

Browse files
committed
Fix RotationCount being invalidated when Mystery Raids are inserted
When a Mystery Raid was created and inserted into the ActiveRaids list, it would shift all raids at or after the insertion position. If RotationCount pointed to a raid at or after this position, it would end up pointing to the wrong raid (typically the newly inserted Mystery Raid instead of the intended configured raid). Changes: - Adjust RotationCount after inserting a Mystery Raid if insertion happens at or before current position - Add logging to track when RotationCount is adjusted This ensures the "Next Raid Up" embed matches what actually gets played.
1 parent b2c7dc2 commit f242004

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

SysBot.Pokemon/SV/BotRaid/RotatingRaidBotSV.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,13 @@ private void CreateMysteryRaid()
17191719
// Insert the new raid at the determined position
17201720
_settings.ActiveRaids.Insert(insertPosition, newRandomShinyRaid);
17211721

1722+
// Adjust RotationCount if the insertion shifted the current raid
1723+
if (insertPosition <= RotationCount)
1724+
{
1725+
RotationCount++;
1726+
Log($"Adjusted RotationCount to {RotationCount} after Mystery Raid insertion at position {insertPosition}.");
1727+
}
1728+
17221729
Log($"Added Mystery Raid - Species: {(Species)pk.Species}, Seed: {seedValue}.");
17231730
}
17241731

0 commit comments

Comments
 (0)