Fix enemy collision bug in undoSell#165
Conversation
Prevent stalls from being restored via undoSell on tiles occupied or targeted by enemies, ensuring consistency with the standard placement logic. Co-authored-by: candour <4670475+candour@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR fixes a bug in ChangesEnemy-on-hex undo prevention
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Build Successful! 🚀Note: This link will be removed when the PR is closed. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app/src/test/java/com/messark/hawker/UndoStallOnEnemyTest.kt (1)
88-135: 💤 Low valueConsider adding
lastSoldStallassertion for consistency.The first test verifies that
lastSoldStallis not cleared whenundoSellfails (line 85), but this test only checks that the stall is not restored (line 134). For consistency and completeness, consider adding an assertion after line 134:assertNotNull("lastSoldStall should NOT be cleared because undo failed", viewModel.gameState.value.lastSoldStall)This would align with the first test's validation pattern and confirm the function's early-return behavior preserves state correctly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 22fa1cd5-9cec-4abb-ba4e-1f8aba684156
📒 Files selected for processing (3)
app/src/main/java/com/messark/hawker/MainViewModel.ktapp/src/test/java/com/messark/hawker/UndoStallOnEnemyTest.ktfixes.md
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Build Successful! 🚀Note: This link will be removed when the PR is closed. |
I identified and fixed a bug in the
undoSellmechanic where players could restore a previously sold stall on top of an active enemy or on a tile that an enemy was about to enter. This bypassed the collision checks implemented for regular stall placement.Key changes:
isEnemyNearcheck toMainViewModel.undoSellto match the logic inonCellClick.UndoStallOnEnemyTest.ktto verify thatundoSellcorrectly rejects restoration when an enemy is present or approaching.fixes.mdto document this fix asFIX-013.PR created automatically by Jules for task 12364030995966921869 started by @candour
Summary by CodeRabbit
Bug Fixes
Tests
Documentation