Skip to content

Improve battle end detection and handling#634

Merged
martinmiglio merged 2 commits into
pyclashbot:masterfrom
tengfone:fix/premature-end-game
Jan 31, 2026
Merged

Improve battle end detection and handling#634
martinmiglio merged 2 commits into
pyclashbot:masterfrom
tengfone:fix/premature-end-game

Conversation

@tengfone
Copy link
Copy Markdown
Contributor

@tengfone tengfone commented Jan 27, 2026

Enhances detection of battle end states by adding new checks and logic to handle lost battle detection more robustly. Introduces check_if_battle_has_ended and check_for_post_battle_button to confirm battle completion, and updates fight loops to avoid infinite waiting when detection is lost repeatedly.

Testing:

  • Bluestacs (macos)
  • Bluestacks (windows)
  • Google Play
  • Memu

Enhances detection of battle end states by adding new checks and logic to handle lost battle detection more robustly. Introduces check_if_battle_has_ended and check_for_post_battle_button to confirm battle completion, and updates fight loops to avoid infinite waiting when detection is lost repeatedly.
@martinmiglio martinmiglio self-requested a review January 27, 2026 16:06
Comment thread pyclashbot/bot/nav.py Outdated
Refactor the is_bright function and extracted gold/yellow crown detection into a separate is_filled_crown function. Updated the battle detection logic to use both functions, improving clarity and maintainability.
@martinmiglio martinmiglio enabled auto-merge (squash) January 31, 2026 06:02
Copy link
Copy Markdown
Member

@martinmiglio martinmiglio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix! Thanks a lot 🪂

@martinmiglio martinmiglio merged commit 78dd693 into pyclashbot:master Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants