Skip to content

Bak Kut Teh Revamp and UI Improvements#150

Merged
candour merged 3 commits into
mainfrom
bkt-revamp-and-ui-improvements-6163497663483847708
May 12, 2026
Merged

Bak Kut Teh Revamp and UI Improvements#150
candour merged 3 commits into
mainfrom
bkt-revamp-and-ui-improvements-6163497663483847708

Conversation

@candour

@candour candour commented May 12, 2026

Copy link
Copy Markdown
Owner

This change introduces a more dynamic Bak Kut Teh stall mechanic, where it randomly buffs either Damage or Fire Rate/Duration at the start of each wave. The buff scaling has been tuned down to 10% per level.

On the UI side, a new "Undo!" button appears after selling a stall, allowing players to reverse accidental sales. The stall console now correctly displays the final effective stats (including active buffs) to the player. Additionally, stalls that cannot be upgraded (like the ATM) no longer show a redundant upgrade count icon on the board.


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

Summary by CodeRabbit

  • New Features

    • Two Bak Kut Teh buff variants: MEATY (damage) and HERBAL (rate/duration)
    • UNDO button to reverse recent stall sales
    • Centered toast messages on the game board for special events
  • Balance Changes

    • Bak Kut Teh base boost reduced from 20% to 10%
  • Improvements

    • Stall consoles display active damage/rate multipliers
    • Upgrade markers only shown when upgrades are available
  • Tests

    • Updated expectations to reflect reduced boost effect

Review Change Stack

… displays

- Implement randomized Bak Kut Teh buffs (Meaty/Herbal) at wave start.
- Reduce Bak Kut Teh boost scaling to 10% base and increment.
- Add "Undo!" button for recently sold stalls in the control panel.
- Hide upgrade count icons for stalls with no available upgrades.
- Ensure stall console displays total boosted stats (damage/rate/durations).
- Update unit tests to reflect new Bak Kut Teh scaling.

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 12, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1f247c53-885e-4dc2-816f-34476d80c6eb

📥 Commits

Reviewing files that changed from the base of the PR and between 5765b0a and d6cf9d1.

📒 Files selected for processing (1)
  • app/src/main/java/com/messark/hawker/MainActivity.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/main/java/com/messark/hawker/MainActivity.kt

📝 Walkthrough

Walkthrough

This PR adds MEATY and HERBAL BKT buff variants, threads buff selection and toast through waves, refactors boost results into damage/rate multipliers, adds an undo-sell flow and UI wiring (toast, UNDO button, multipliers), and reduces base BKT boost from 20% to 10%.

Changes

BKT Dual-Buff System with Undo Mechanic

Layer / File(s) Summary
Game State and Buff Type Definitions
app/src/main/java/com/messark/hawker/model/GameModels.kt
BktBuffType enum with MEATY and HERBAL variants is introduced. GameState gains lastSoldStall (sold stall tracking), bktBuffType (defaults to MEATY), and bktToastMessage (optional notification).
Wave Lifecycle, Boost Calculation, and Sell/Undo
app/src/main/java/com/messark/hawker/MainViewModel.kt
At wave start, buff type is selected (MEATY or HERBAL), lastSoldStall and toast state are reset/managed (auto-clear). BoostResult now contains separate damageMultiplier and rateMultiplier, and calculateStatBoost accepts buffType. Firing logic, passive/ATM income, sell/undo, selection/place, overlays, and targeting consume/clear lastSoldStall appropriately.
GameBoard Toast and Upgrade Display
app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
GameBoard renders optional bktToastMessage centered on canvas. Stall upgrade indicator rendering is conditional, only drawing when upgrade stats are available via StallUpgradeManager.
GameControlPanel and StallConsole Integration
app/src/main/java/com/messark/hawker/ui/components/GameControlPanel.kt, app/src/main/java/com/messark/hawker/ui/components/StallConsole.kt
GameControlPanel accepts new buff/undo parameters (onUndoSell, damageMultiplier, rateMultiplier, bktBuffType, lastSoldStall) and threads them to StallConsole. An "UNDO!" button appears when lastSoldStall is non-null. StallConsole recalculates stat display values using the multipliers and varies buff-related labels per bktBuffType.
MainActivity Screen Integration
app/src/main/java/com/messark/hawker/MainActivity.kt
GameScreen computes boostResult from selected stall and bktBuffType, extracts damage/rate multipliers, and wires them along with bktToastMessage through the UI composition tree.
Registry and Upgrade Manager Tuning
app/src/main/java/com/messark/hawker/registry/Registry.kt, app/src/main/java/com/messark/hawker/utils/StallUpgradeManager.kt
Bak Kut Teh base boost is reduced from 20f to 10f. Boost stat per-upgrade increment is reduced from +20.0 to +10.0.
Test Expectations Update
app/src/test/java/com/messark/hawker/BakKutTehSameTickTest.kt
Test expectation for ATM income boost is updated from 620 to 610 gold, reflecting the new 10% boost value.

Sequence Diagram:

sequenceDiagram
  participant Player
  participant GameScreen
  participant MainViewModel
  participant GameBoard
  participant GameControlPanel
  participant StallConsole

  Player->>GameScreen: open/play screen / select stall
  GameScreen->>MainViewModel: startWave() / selectStall()
  MainViewModel->>MainViewModel: choose bktBuffType, set bktToastMessage, clear lastSoldStall
  GameScreen->>MainViewModel: calculateStatBoost(coord, hexes, bktBuffType)
  MainViewModel-->>GameScreen: BoostResult(damageMultiplier, rateMultiplier)
  GameScreen->>GameBoard: render(bktToastMessage)
  GameScreen->>GameControlPanel: render(onUndoSell, damageMultiplier, rateMultiplier, bktBuffType, lastSoldStall)
  GameControlPanel->>StallConsole: forward multipliers / buff type
  StallConsole-->>GameControlPanel: display adjusted stats
Loading

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly Related PRs

  • candour/towerpower#126: Both PRs modify the Bak Kut Teh stat-boost logic in MainViewModel, changing BoostResult and calculateStatBoost structure.
  • candour/towerpower#111: Both PRs implement and modify Bak Kut Teh adjacency boost behavior across GameModels, MainViewModel firing logic, Registry stall definitions, and StallConsole UI.
  • candour/towerpower#116: Both PRs modify StallUpgradeManager's upgrade scaling logic (this PR reduces per-upgrade base increment; #116 refactors upgrade calculation).
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.52% 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 PR title accurately reflects the two main changes: introducing a Bak Kut Teh revamp with dynamic buff mechanics and adding UI improvements including the Undo button and conditional upgrade markers.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bkt-revamp-and-ui-improvements-6163497663483847708

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

Copy link
Copy Markdown

Build Successful! 🚀

Download APK

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

@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: 3

🧹 Nitpick comments (1)
app/src/main/java/com/messark/hawker/MainActivity.kt (1)

793-793: ⚡ Quick win

Memoize the boost calculation to avoid unnecessary recomputations.

The boostResult calculation runs on every recomposition of GameScreen, even when its dependencies (selectedBoardStall, hexes, bktBuffType) haven't changed. Since gameState is a composite object, changes to unrelated properties (like gold, health, or score) will trigger unnecessary recalculations. For smooth game performance, memoization is recommended.

⚡ Proposed fix to memoize the calculation
-val boostResult = gameState.selectedBoardStall?.let { viewModel.calculateStatBoost(it, gameState.hexes, gameState.bktBuffType) }
+val boostResult = remember(gameState.selectedBoardStall, gameState.hexes, gameState.bktBuffType) {
+    gameState.selectedBoardStall?.let { viewModel.calculateStatBoost(it, gameState.hexes, gameState.bktBuffType) }
+}

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a969cbbe-8b60-42a5-a388-5991269b784f

📥 Commits

Reviewing files that changed from the base of the PR and between 787fb64 and 20afae1.

📒 Files selected for processing (9)
  • 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/registry/Registry.kt
  • app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
  • app/src/main/java/com/messark/hawker/ui/components/GameControlPanel.kt
  • app/src/main/java/com/messark/hawker/ui/components/StallConsole.kt
  • app/src/main/java/com/messark/hawker/utils/StallUpgradeManager.kt
  • app/src/test/java/com/messark/hawker/BakKutTehSameTickTest.kt

Comment thread app/src/main/java/com/messark/hawker/MainViewModel.kt
Comment thread app/src/main/java/com/messark/hawker/ui/components/StallConsole.kt
@candour

candour commented May 12, 2026

Copy link
Copy Markdown
Owner Author

Guard undo-sell against insufficient gold to prevent negative balance.

Line 1158 subtracts refund without checking available gold. If the refunded gold was spent before undo, this can push gold below zero.

@google-labs-jules

Copy link
Copy Markdown
Contributor

Guard undo-sell against insufficient gold to prevent negative balance.

Line 1158 subtracts refund without checking available gold. If the refunded gold was spent before undo, this can push gold below zero.

Good catch! I've added a gold balance check to undoSell to ensure the undo only proceeds if the player has enough gold to cover the refund reversal, preventing a negative balance.

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

Copy link
Copy Markdown

Build Successful! 🚀

Download APK

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

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

Copy link
Copy Markdown

Build Successful! 🚀

Download APK

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

@candour
candour merged commit 68da2f2 into main May 12, 2026
3 checks passed
@candour
candour deleted the bkt-revamp-and-ui-improvements-6163497663483847708 branch May 12, 2026 04:20
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