Fix enemy death threshold logic - #161
Conversation
Modified the enemy death condition from `currentHealth < 1.0f` to `currentHealth <= 0f` to ensure precise health tracking and prevent premature deaths when using floating-point health values. Updated `UndeadEnemyTest.kt` to verify this behavior and recorded the fix as FIX-011 in `fixes.md`. 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. |
📝 WalkthroughWalkthroughThis PR corrects enemy death detection in projectile handling. The threshold check changes from ChangesEnemy Death Threshold Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 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 docstrings
🧪 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.
🧹 Nitpick comments (1)
fixes.md (1)
42-42: 💤 Low valueConsider clarifying the comparison operator change in the description.
The description states the threshold changed "from
1.0fto0f", but the actual code change is from< 1.0fto<= 0f. Both the threshold value and the comparison operator changed. Consider updating to "from< 1.0fto<= 0f" for precision.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e5d9ceb1-34f5-4ac3-a458-d28dd80797e5
📒 Files selected for processing (3)
app/src/main/java/com/messark/hawker/MainViewModel.ktapp/src/test/java/com/messark/hawker/UndeadEnemyTest.ktfixes.md
Corrected a bug in the game engine where enemies were being removed from play when their health dropped below 1.0f. This was likely a leftover from an earlier implementation using integer health. Since health is now tracked as a Float, enemies should only be considered dead when their health reaches zero or below. This ensures that stalls dealing small amounts of damage or fractional damage due to buffs (like the Tiger Mom's armor) correctly deplete the enemy's entire health pool before they are removed.
Key changes:
handleProjectilesinMainViewModel.ktto usecurrentHealth <= 0f.UndeadEnemyTest.ktto use a starting health of0.5fto confirm that fractional health no longer triggers immediate death.fixes.md.PR created automatically by Jules for task 12605285028550738522 started by @candour
Summary by CodeRabbit
Release Notes