Fix red koopa shell homing without an owner - #124
Merged
Conversation
RedKoopaShell.findTarget() searched for and locked onto a target even when the shell had no owner, contradicting the intended behaviour (a shell nobody threw has nothing to chase for) and failing KoopaShellGameTest.anownerlessRedShellGoesStraight on dev. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018CgrnTJ5h1s22YS1BTCi8r
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
RedKoopaShell.findTarget()looked for and locked onto a target even when the shell had no owner. That contradicts the documented intent right above the test it breaks (KoopaShellGameTest: "It only looks for a target on behalf of whoever threw it, so a shell without an owner never homes at all") and failsanownerlessRedShellGoesStraightondev— the same failure several other open PRs (#123, #121, #120) call out as pre-existing and unrelated to their changes.The fix
findTarget()now returnsnullimmediately when the shell's owner isn't aLivingEntity(i.e. no owner), instead of still searching for and homing in on the nearest valid target. The stale comment claiming owner-less shells "still home in" is removed along with the now-unnecessary null-owner handling further down.Tests
./gradlew runDatagen(no changes) and./gradlew runGameTest— all 134 game tests pass, includinganownerlessRedShellGoesStraight.Generated by Claude Code