Feat: Spirit Bear Kill Counter#199
Conversation
Signed-off-by: FlyModeZ <[email protected]>
There was a problem hiding this comment.
Summary of Changes
Hello @FlyModeZ, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request significantly enhances the existing 'Spirit Bear' feature by introducing a kill counter and making its HUD display more informative and dynamic. It also refines the event detection mechanism to be more robust across different dungeon difficulties, providing a better user experience for tracking this specific in-game element.
Highlights
- Feature Enhancement: I've implemented a Spirit Bear kill counter that is now displayed directly in the HUD, providing players with real-time tracking of defeated bears.
- Dynamic Configuration: The maximum number of kills and the specific block locations tracked for Spirit Bear events now dynamically adjust based on the current dungeon difficulty (F4 or M4), ensuring accuracy across different floor variations.
- HUD Refinement: The Spirit Bear HUD display has been refined to replace the 'Not Spawned' state with the new kill counter when the bear is not actively spawning or alive, providing more relevant information.
- Improved Event Detection: The underlying logic for detecting Spirit Bear events has been improved to monitor multiple relevant block locations, enhancing the reliability of the kill counter and spawn timer.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces a kill counter for the Spirit Bear feature, which is a nice enhancement. The implementation correctly tracks kills on Floor 4 and Master Mode Floor 4 by monitoring block changes. The code is functional, but I've provided a couple of suggestions to improve readability and maintainability by reformatting very long lines and replacing magic numbers with named constants. Overall, a good addition.
| private val f4BlockLocations = hashSetOf(BlockPos(-3, 77, 33), BlockPos(-9, 77, 31), BlockPos(-16, 77, 26), BlockPos(-20, 77, 20), BlockPos(-23, 77, 13), BlockPos(-24, 77, 6), BlockPos(-24, 77, 0), BlockPos(-22, 77, -7), BlockPos(-18, 77, -13), BlockPos(-12, 77, -19), BlockPos(-5, 77, -22), BlockPos(1, 77, -24), BlockPos(8, 77, -24), BlockPos(14, 77, -23), BlockPos(21, 77, -19), BlockPos(27, 77, -14), BlockPos(31, 77, -8), BlockPos(33, 77, -1), BlockPos(34, 77, 5), BlockPos(33, 77, 12), BlockPos(31, 77, 19), BlockPos(27, 77, 25), BlockPos(20, 77, 30), BlockPos(14, 77, 33), BlockPos(7, 77, 34)) | ||
| private val m4BlockLocations = hashSetOf(BlockPos(-2, 77, 33), BlockPos(-7, 77, 32), BlockPos(-13, 77, 28), BlockPos(-17, 77, 24), BlockPos(-21, 77, 18), BlockPos(-23, 77, 13), BlockPos(-24, 77, 7), BlockPos(-24, 77, 2), BlockPos(-23, 77, -4), BlockPos(-21, 77, -9), BlockPos(-17, 77, -14), BlockPos(-12, 77, -19), BlockPos(-6, 77, -22), BlockPos(-1, 77, -23), BlockPos(5, 77, -24), BlockPos(10, 77, -24), BlockPos(16, 77, -22), BlockPos(21, 77, -19), BlockPos(27, 77, -15), BlockPos(30, 77, -10), BlockPos(32, 77, -5), BlockPos(34, 77, 1), BlockPos(34, 77, 7), BlockPos(33, 77, 12), BlockPos(31, 77, 18), BlockPos(28, 77, 23), BlockPos(23, 77, 28), BlockPos(18, 77, 31), BlockPos(12, 77, 33), BlockPos(7, 77, 34)) |
There was a problem hiding this comment.
These lines are very long, which harms readability and makes the code harder to maintain. Please consider reformatting them to span multiple lines.
For example:
private val f4BlockLocations = hashSetOf(
BlockPos(-3, 77, 33), BlockPos(-9, 77, 31), BlockPos(-16, 77, 26),
BlockPos(-20, 77, 20), BlockPos(-23, 77, 13), BlockPos(-24, 77, 6),
// ... and so on
)| private inline val maxKills: Int get() = if (DungeonUtils.floor?.isMM == true) 30 else 25 | ||
|
|
||
| private var kills = 0 | ||
| private var timer = -1 // state: -1=NotSpawned, 0=Alive, 1+=Spawning |
There was a problem hiding this comment.
The timer variable uses magic numbers (-1, 0, and values > 0) to represent different states. While the comment is helpful, using named constants would make the code more self-documenting and maintainable.
Consider defining constants for the states and values at the object level:
private const val TIMER_NOT_SPAWNED = -1
private const val TIMER_ALIVE = 0
private const val SPAWN_TICKS = 68These can then be used in onWorldLoad, onBlockChange, and the hud logic to improve clarity. For instance, using timer = TIMER_NOT_SPAWNED instead of timer = -1, and updating the condition in the hud to timer == TIMER_NOT_SPAWNED.
|
nvm |
|
Is this ready? |
|
yes |
src/main/kotlin/me/odinmain/features/impl/dungeon/SpiritBear.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/me/odinmain/features/impl/dungeon/SpiritBear.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/me/odinmain/features/impl/dungeon/SpiritBear.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/me/odinmain/features/impl/dungeon/SpiritBear.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/me/odinmain/features/impl/dungeon/SpiritBear.kt
Outdated
Show resolved
Hide resolved
Signed-off-by: FlyModeZ <[email protected]>
src/main/kotlin/me/odinmain/features/impl/dungeon/SpiritBear.kt
Outdated
Show resolved
Hide resolved
Signed-off-by: FlyModeZ <[email protected]>
Replacing "Not Spawned"