Skip to content

Spend Kitchelin Star to Remove Pillar - #137

Merged
candour merged 3 commits into
mainfrom
feature/remove-pillar-action-9886608132369605701
May 9, 2026
Merged

Spend Kitchelin Star to Remove Pillar#137
candour merged 3 commits into
mainfrom
feature/remove-pillar-action-9886608132369605701

Conversation

@candour

@candour candour commented May 9, 2026

Copy link
Copy Markdown
Owner

This change allows users to spend one Kitchelin Star to permanently remove a pillar from the board.

Key features:

  1. Star Action: A new "Remove Pillar" button in the Kitchelin Star overlay.
  2. Interactive Selection: After choosing the action, pillars on the board pulse with a yellow highlight, and the user can tap one to destroy it.
  3. Visual Feedback: Destruction triggers a punchy screen shake and haptic feedback.
  4. Game Logic Integration: Removing a pillar replaces it with a floor tile and immediately recalculates enemy paths.
  5. Safety: Includes a "Cancel Destruction" button and disables the star action if no pillars exist.

PR created automatically by Jules for task 9886608132369605701 started by @candour

Summary by CodeRabbit

New Features

  • Pillar Removal Mechanic – Remove pillars from the board using Kitchelin Stars (1 star per pillar)
  • Visual Feedback – Screen shake effect when performing board actions
  • Removal Mode UI – Instructions panel and cancel button appear during pillar removal with highlighted tiles for easy selection
  • Action Button – "Remove Pillar" option added to the action menu when pillars are present on the board

Review Change Stack

- Add `isRemovePillarModeActive` and `lastShakeTimeMs` to `GameState`.
- Implement "Remove Pillar" action in `StarActionOverlay`.
- Add pillar removal logic and mode management in `MainViewModel`.
- Update `onCellClick` to support pillar destruction.
- Add pulsing pillar highlights in `GameBoard` during destruction mode.
- Implement screen shake effect and cancel button in `MainActivity`.
- Add unit test `RemovePillarTest.kt`.

Co-authored-by: candour <4670475+candour@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@candour has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 37 minutes and 49 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 84930ca0-ab1d-4d61-972a-7f3651e1275d

📥 Commits

Reviewing files that changed from the base of the PR and between d1d28c3 and 0102067.

📒 Files selected for processing (1)
  • app/src/main/java/com/messark/hawker/MainViewModel.kt
📝 Walkthrough

Walkthrough

This PR introduces a pillar removal mode to the game, allowing players to spend Kitchelin stars to convert pillar tiles into floor tiles. The feature includes game state properties, view model logic for mode control and pillar removal, UI integration with shake animations and button overlays, and comprehensive unit test coverage.

Changes

Pillar Removal Mode Feature

Layer / File(s) Summary
Game State Shape
app/src/main/java/com/messark/hawker/model/GameModels.kt
GameState adds isRemovePillarModeActive: Boolean and lastShakeTimeMs: Long properties to track mode state and screen shake timing.
UI Component Contracts
app/src/main/java/com/messark/hawker/ui/components/StarActionOverlay.kt, app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
StarActionOverlay accepts hasPillars: Boolean and onRemovePillar() callback; GameBoard accepts isRemovePillarModeActive: Boolean parameter for conditional overlay rendering.
ViewModel Logic
app/src/main/java/com/messark/hawker/MainViewModel.kt
Adds enterRemovePillarMode(), exitRemovePillarMode(), and removePillar(coord) methods; extends onCellClick to intercept taps when mode is active, validate pillar tiles, decrement stars, convert tiles to floor, and recalculate enemy paths.
UI Integration & Animation
app/src/main/java/com/messark/hawker/MainActivity.kt
Imports Offset and TileType; implements shake animation via Animatable<Offset> driven by lastShakeTimeMs; renders remove-pillar mode UI with instruction panel and cancel button; computes board pillar presence and wires StarActionOverlay with new hasPillars flag and onRemovePillar callback; renders pillar overlays in GameBoard.
Test Coverage
app/src/test/java/com/messark/hawker/RemovePillarTest.kt
Adds test suite with setup/teardown for coroutine dispatcher management; tests pillar removal logic with star consumption and tile conversion, edge case handling when stars unavailable, and mode exit behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • candour/towerpower#129: Modifies StarActionOverlay API and related UI wiring in MainActivity/MainViewModel through parameter/callback additions.
  • candour/towerpower#135: Modifies pillar-related behavior and touches MainViewModel, GameBoard, and TileType handling.
  • candour/towerpower#102: Modifies MainViewModel's Kitchelin star consumption and adds star-based game mechanics.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main feature: allowing users to spend a Kitchelin Star to remove a pillar from the board.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/remove-pillar-action-9886608132369605701

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown

Build Successful! 🚀

Download APK

Note: This link will be removed when the PR is closed.

@candour

candour commented May 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

- Implemented "Remove Pillar" star action in `StarActionOverlay`.
- Added logic in `MainViewModel` to handle pillar removal and star deduction.
- Included pulsing highlight for pillars in `GameBoard` when in removal mode.
- Added screen shake and cancel button in `MainActivity`.
- Added unit test `RemovePillarTest.kt` for verification.

Co-authored-by: candour <4670475+candour@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
app/src/test/java/com/messark/hawker/RemovePillarTest.kt (1)

90-96: ⚡ Quick win

Complete the no-star test with an explicit mode assertion and remove exploratory comments.

The test currently leaves Line 93-96 as draft notes. Add a concrete assertion for the intended mode behavior so this path is fully locked down.

✅ Suggested test cleanup
         val state = viewModel.gameState.value
         assertEquals(0, state.kitchelinStars)
         assertEquals(TileType.PILLAR, state.hexes[pillarCoord]?.type)
-        // It stays in mode because nothing happened (though currently removePillar returns early)
-        // Actually my implementation of removePillar sets isRemovePillarModeActive = false ONLY if it succeeds.
-        // Let's check my code again.
+        assertTrue(state.isRemovePillarModeActive)
app/src/main/java/com/messark/hawker/ui/components/StarActionOverlay.kt (1)

107-115: 🏗️ Heavy lift

Use SpriteButton for the new “Remove Pillar” action.

This new action is currently rendered with StarActionButton; project guidance requires SpriteButton for action buttons.

As per coding guidelines, "Use SpriteButton for all action buttons and reference buttons.png for visual consistency".


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4a2da6a5-97a7-47e1-92b2-18b2e2e1f10d

📥 Commits

Reviewing files that changed from the base of the PR and between ceef600 and d1d28c3.

📒 Files selected for processing (6)
  • app/src/main/java/com/messark/hawker/MainActivity.kt
  • app/src/main/java/com/messark/hawker/MainViewModel.kt
  • app/src/main/java/com/messark/hawker/model/GameModels.kt
  • app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
  • app/src/main/java/com/messark/hawker/ui/components/StarActionOverlay.kt
  • app/src/test/java/com/messark/hawker/RemovePillarTest.kt

Comment thread app/src/main/java/com/messark/hawker/MainViewModel.kt
Comment thread app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown

Build Successful! 🚀

Download APK

Note: This link will be removed when the PR is closed.

@candour
candour enabled auto-merge (squash) May 9, 2026 15:37
- Implemented "Remove Pillar" star action in `StarActionOverlay`.
- Added logic in `MainViewModel` to handle pillar removal and star deduction.
- Included pulsing highlight for pillars in `GameBoard` when in removal mode.
- Added screen shake and cancel button in `MainActivity`.
- Refactored `MainViewModel` to move `triggerHaptic()` and `handleGameOver()` calls outside of `_gameState.update` blocks for better concurrency safety.
- Captured timestamps before state updates for consistency.
- Added unit test `RemovePillarTest.kt`.

Co-authored-by: candour <4670475+candour@users.noreply.github.com>
@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown

Build Successful! 🚀

Download APK

Note: This link will be removed when the PR is closed.

@candour

candour commented May 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resolve

@candour
candour merged commit 1c28a29 into main May 9, 2026
3 checks passed
@coderabbitai

coderabbitai Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Comments resolved and changes approved.

@candour
candour deleted the feature/remove-pillar-action-9886608132369605701 branch May 9, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant