Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adjust target reach assumption immediately after setting #1902

Merged
merged 2 commits into from
Nov 25, 2023

Conversation

luan
Copy link
Contributor

@luan luan commented Nov 24, 2023

This is a pretty subtle bug, but it prevents the challenge spell from working most of the time. This is what occurs:

  1. Monster attacks someone, it's their only option for a target when they do, so whether or not they can reach it, it sets it; it keeps trying to set it until it works
  2. Someone challenges it; it sets its target to the new person (which runs the code above)
  3. onThink runs, hasFollowPath is still false because we haven't had time to run the path finding algo yet; we think it's unreachable and switch away to the other target (with we already had a path for)

Solution: by "assuming" we have a path, we let the pathfinding algo run, in the meantime onThink assumes everything is OK.

@dudantas dudantas changed the title fix: don't assume we can't reach the target right as we've set it fix: adjust target reach assumption immediately after setting Nov 25, 2023
@dudantas dudantas merged commit cdc68ce into main Nov 25, 2023
34 checks passed
@dudantas dudantas deleted the luan/fix-targetting2 branch November 25, 2023 06:18
Copy link

sonarcloud bot commented Nov 25, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants