Iron golem stub and iron hook ability#141
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughIntroduces a new IronHookAbility, integrates it into kit assembly, extends BrawlProjectile with initial velocity and trail sound hooks, and adds corresponding data entries in abilities, kits, and localization files. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant P as Player
participant A as IronHookAbility
participant PR as BrawlProjectile
participant E as Target Entity
participant D as BrawlDamageEvent
P->>A: activate()
A->>PR: build Tripwire Hook projectile<br/>set size, setInitialVelocity, trail effects
PR-->>P: play throw sound
loop each tick
PR-->>PR: move, play trail sound
end
alt hit entity
PR->>A: onHitEntity(entity, velocity)
A->>D: fire damage event (Projectile, dmg = cfg * |v|)
A->>E: apply pull knockback toward player
else no hit
PR-->>A: no entity hit
end
A->>PR: teardown() (on ability end)
PR-->>A: destroy
sequenceDiagram
autonumber
participant PR as BrawlProjectile
participant VF as customSetInitialVelocity
participant DEF as DefaultVelocity
PR->>PR: launch()
alt custom velocity provided
PR->>VF: invoke (projectile)
VF-->>PR: velocity set
else no custom function
PR->>DEF: compute default launch velocity
DEF-->>PR: velocity set
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/projectiles/PotionProjectile.kt (1)
24-26: Drop the empty placeholder method
customMethodis public, carries no behavior, and its name doesn’t describe any intent. Let’s remove it (or implement the real logic) so we aren’t publishing dead API surface. SincePotionProjectilealready works without it, simply deleting the method is cleanest.- fun customMethod() { - - }plugin/src/main/resources/data/abilities.yml (1)
314-320: Match the numeric style used elsewhereEvery other cooldown is written with a decimal (e.g.,
3.0,8.0). Using8.0here keeps the schema consistent and avoids any future parsing surprises if a strict double is expected.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/abilities/IronHookAbility.kt(1 hunks)plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/kits/BrawlKit.kt(1 hunks)plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/projectiles/BrawlProjectile.kt(3 hunks)plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/projectiles/PotionProjectile.kt(1 hunks)plugin/src/main/resources/data/abilities.yml(1 hunks)plugin/src/main/resources/data/kits.yml(1 hunks)plugin/src/main/resources/data/lang/en.yml(2 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.kt
📄 CodeRabbit inference engine (.cursor/rules/kotlin-best-practices.mdc)
**/*.kt: Use data classes for immutable data structures like PlayerDocument
Leverage extension functions to enhance existing classes without modifying them
Implement sealed classes for representing different states or types (e.g., game states or player statuses)
Use coroutines for asynchronous operations to avoid blocking the main thread
Use Koin for dependency injection
Use LiteCommands for commands
Use Twilight for events
Use Ktor for HTTP requests
Use Kaml for configuration
Use Okio for file operations
Use Kotlinx Coroutines for asynchronous operations
Use Kotlinx Serialization for serialization
Use English for all code and documentation in source (identifiers, comments, KDoc)
Always declare the type of each variable and function (parameters and return value)
Avoid using any
Create necessary types instead of using overly generic structures
Use PascalCase for classes
Avoid magic numbers and define constants
Start each function with a verb
Use verbs for boolean variables (isLoading, hasError, canDelete, etc.)
Use complete words instead of abbreviations and correct spelling (allow standard ones like API, URL)
Allow well-known abbreviations: i, j for loops; err for errors; ctx for contexts; req, res, next for middleware-like parameters
Write short functions with a single purpose (less than 20 instructions)
Name functions with a verb plus a descriptor
If a function returns boolean, use prefixes like isX, hasX, canX
If a function returns Unit, use prefixes like executeX or saveX
Avoid nesting blocks via early returns, extracting utilities, and using higher-order functions (map, filter, reduce)
Use expression-bodied (arrow-style) functions for simple functions (fewer than 3 instructions)
Use named (block-bodied) functions for non-simple functions
Use default parameter values instead of checking for null
Reduce function parameters using RO-RO (pass/return objects)
Declare necessary types for input arguments and output
Use a single level of abstraction within functions
...
Files:
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/projectiles/PotionProjectile.ktplugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/kits/BrawlKit.ktplugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/projectiles/BrawlProjectile.ktplugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/abilities/IronHookAbility.kt
plugin/src/main/kotlin/**/*.kt
📄 CodeRabbit inference engine (.cursor/rules/plugin-overview.mdc)
plugin/src/main/kotlin/**/*.kt: Handle events using the Twilight library’s event DSL
Use Manageable class/IManageable interface to store and manage event listeners
Files:
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/projectiles/PotionProjectile.ktplugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/kits/BrawlKit.ktplugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/projectiles/BrawlProjectile.ktplugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/abilities/IronHookAbility.kt
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/projectiles/**/*.kt
📄 CodeRabbit inference engine (.cursor/rules/plugin-overview.mdc)
Implement projectiles by extending BrawlProjectile and ensure correct lifecycle/metadata for smooth gameplay
Files:
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/projectiles/PotionProjectile.ktplugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/projectiles/BrawlProjectile.kt
plugin/src/main/resources/data/lang/en.yml
📄 CodeRabbit inference engine (.cursor/rules/plugin-overview.mdc)
Store the English locale at plugin/src/main/resources/data/lang/en.yml
Files:
plugin/src/main/resources/data/lang/en.yml
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/kits/**/*.kt
📄 CodeRabbit inference engine (.cursor/rules/plugin-overview.mdc)
Implement kits by extending the Kit base class
Files:
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/kits/BrawlKit.kt
plugin/src/main/resources/data/{abilities,disguises,maps,kits,minigames,passives,projectiles,theme}.yml
📄 CodeRabbit inference engine (.cursor/rules/plugin-overview.mdc)
Keep core Brawl configuration in YAML files under plugin/src/main/resources/data with fixed filenames
Files:
plugin/src/main/resources/data/kits.ymlplugin/src/main/resources/data/abilities.yml
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/abilities/**/*.kt
📄 CodeRabbit inference engine (.cursor/rules/plugin-overview.mdc)
Implement abilities by extending BrawlAbility and manage cooldown/usage via the base class
Files:
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/abilities/IronHookAbility.kt
🧠 Learnings (5)
📚 Learning: 2025-09-22T00:09:59.281Z
Learnt from: CR
PR: BetrixDev/ssm-brawl#0
File: .cursor/rules/plugin-overview.mdc:0-0
Timestamp: 2025-09-22T00:09:59.281Z
Learning: Applies to plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/projectiles/**/*.kt : Implement projectiles by extending BrawlProjectile and ensure correct lifecycle/metadata for smooth gameplay
Applied to files:
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/projectiles/PotionProjectile.ktplugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/projectiles/BrawlProjectile.ktplugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/abilities/IronHookAbility.kt
📚 Learning: 2025-09-22T00:09:59.281Z
Learnt from: CR
PR: BetrixDev/ssm-brawl#0
File: .cursor/rules/plugin-overview.mdc:0-0
Timestamp: 2025-09-22T00:09:59.281Z
Learning: Applies to plugin/src/main/resources/data/{abilities,disguises,maps,kits,minigames,passives,projectiles,theme}.yml : Keep core Brawl configuration in YAML files under plugin/src/main/resources/data with fixed filenames
Applied to files:
plugin/src/main/resources/data/lang/en.yml
📚 Learning: 2025-09-22T00:09:59.281Z
Learnt from: CR
PR: BetrixDev/ssm-brawl#0
File: .cursor/rules/plugin-overview.mdc:0-0
Timestamp: 2025-09-22T00:09:59.281Z
Learning: Applies to plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/abilities/**/*.kt : Implement abilities by extending BrawlAbility and manage cooldown/usage via the base class
Applied to files:
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/kits/BrawlKit.ktplugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/abilities/IronHookAbility.kt
📚 Learning: 2025-09-22T00:09:59.281Z
Learnt from: CR
PR: BetrixDev/ssm-brawl#0
File: .cursor/rules/plugin-overview.mdc:0-0
Timestamp: 2025-09-22T00:09:59.281Z
Learning: Applies to plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/kits/**/*.kt : Implement kits by extending the Kit base class
Applied to files:
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/kits/BrawlKit.kt
📚 Learning: 2025-09-22T00:09:59.281Z
Learnt from: CR
PR: BetrixDev/ssm-brawl#0
File: .cursor/rules/plugin-overview.mdc:0-0
Timestamp: 2025-09-22T00:09:59.281Z
Learning: Applies to plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/passives/**/*.kt : Implement passives by extending BrawlPassive and define metadata in the base construct
Applied to files:
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/abilities/IronHookAbility.kt
🪛 detekt (1.23.8)
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/projectiles/PotionProjectile.kt
[warning] 24-26: This empty block of code can be removed.
(detekt.empty-blocks.EmptyFunctionBlock)
🔇 Additional comments (1)
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/kits/BrawlKit.kt (1)
83-83: New ability wiring looks good
iron_hooknow resolves toIronHookAbility, so kits referencing it will load without falling into the fallback error path. Nicely slotted into the existing mapping.
| private val projectileKnockbackModifier = metadata.double("projectileKnockbackModifier") ?: 0.0 | ||
| private val projectileDamage = metadata.double("projectileDamage") ?: 4.0 | ||
| private val projectileSize = (metadata.double("projectileSize") ?: 0.6).coerceAtLeast(0.1) |
There was a problem hiding this comment.
Wire projectileKnockbackModifier into the pull logic
We read projectileKnockbackModifier from metadata, but we never use it. That makes the config knob inert and prevents balancing kits through data. Feed the modifier into the velocity application (e.g., adjust the base force or scale vector) so data changes take effect.
One way to honour the metadata is:
- val pull = player.location.toVector().subtract(entity.location.toVector()).normalize()
- entity.setVelocity(pull, 2.0, false, 0.0, 0.8, 1.5, true)
+ val pull = player.location.toVector().subtract(entity.location.toVector()).normalize()
+ val knockbackForce = 2.0 + projectileKnockbackModifier
+ entity.setVelocity(pull, knockbackForce, false, 0.0, 0.8, 1.5, true)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private val projectileKnockbackModifier = metadata.double("projectileKnockbackModifier") ?: 0.0 | |
| private val projectileDamage = metadata.double("projectileDamage") ?: 4.0 | |
| private val projectileSize = (metadata.double("projectileSize") ?: 0.6).coerceAtLeast(0.1) | |
| val pull = player.location.toVector().subtract(entity.location.toVector()).normalize() | |
| val knockbackForce = 2.0 + projectileKnockbackModifier | |
| entity.setVelocity(pull, knockbackForce, false, 0.0, 0.8, 1.5, true) |
🤖 Prompt for AI Agents
In
plugin/src/main/kotlin/dev/betrix/superSmashMobsBrawl/abilities/IronHookAbility.kt
around lines 24–26, projectileKnockbackModifier is read from metadata but never
applied; update the pull/knockback logic where you set the target's or
projectile's velocity so that the computed force is multiplied (or the velocity
vector scaled) by projectileKnockbackModifier (fall back to 1.0 if
zero/invalid), e.g., incorporate it into the base force calculation or multiply
the final velocity before calling setVelocity/launch so changes in metadata
affect actual knockback.
Summary by CodeRabbit
New Features
Documentation