Fix exploration and battle system state management bugs

- Fixed exploration bug: prevent multiple \!explore when encounter is active
- Fixed battle bug: prevent starting multiple battles from exploration encounters
- Enforced exploration encounter workflow: must choose fight/capture/flee before exploring again
- Fixed \!gym challenge to use player's current location instead of requiring location parameter
- Added proper state management to prevent race conditions
- Improved user experience with clear error messages for active encounters

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
megaproxy 2025-07-15 16:58:18 +01:00
parent 3c628c7f51
commit d05b2ead53
3 changed files with 92 additions and 19 deletions

View file

@ -52,6 +52,12 @@ class BattleSystem(BaseModule):
self.send_message(channel, f"{nickname}: You're already in battle! Use !attack <move> or !flee.")
return
# Check if already in gym battle
gym_battle = await self.database.get_active_gym_battle(player["id"])
if gym_battle:
self.send_message(channel, f"{nickname}: You're already in a gym battle! Finish your gym battle first.")
return
# Get player's active pet
pets = await self.database.get_player_pets(player["id"], active_only=True)
if not pets: