Implement Sequential Levels and Graduation system - #174
Conversation
- Added `currentLevel` and `showGraduationOverlay` to `GameState`.
- Defined level configurations for board dimensions (6x8, 6x10, 6x12, 6x14, 6x16, 8x16).
- Implemented level graduation logic in `MainViewModel` triggered after completing Wave 50.
- Added `GraduationOverlay` to `MainActivity` with Singlish flavor text ("Shiok!", "Steady pom pi pi", "Huat ah!").
- Updated `GameStateRepository` to persist the current level.
- Ensured progress (gold, health, stars, wave, score) resets upon graduation or game over.
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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe PR adds a level progression system: GameState now tracks ChangesLevel Progression with Graduation Overlay
Sequence DiagramsequenceDiagram
participant GameScreen
participant GraduationOverlay
participant MainViewModel
participant GameStateRepository
GameScreen->>GraduationOverlay: render when showGraduationOverlay == true (level)
GraduationOverlay->>MainViewModel: onTriggerHaptic() then onGraduate()
MainViewModel->>MainViewModel: graduateToNextLevel() (increment currentLevel, regen map, reset transient state, hide overlay)
MainViewModel->>GameStateRepository: saveGameState(updated GameState)
GameStateRepository-->>MainViewModel: persist confirmation
MainViewModel-->>GameScreen: new GameState emitted (updated map, score=0, showGraduationOverlay=false)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 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.
Actionable comments posted: 3
🧹 Nitpick comments (1)
app/src/main/java/com/messark/hawker/MainViewModel.kt (1)
1020-1040: ⚡ Quick winSimplify the chained
.copy()calls.The code sets
score = state.scoreat line 1036, then immediately chains another.copy(score = 0)at line 1040, which overwrites the first assignment. This is inefficient and confusing.♻️ Simplify to a single copy
state.copy( currentLevel = nextLevel, currentWave = 0, gold = 500, health = 10, kitchelinStars = 0, hexes = hexes, startPosition = startPos, endPosition = endPos, enemies = emptyList(), projectiles = emptyList(), puddles = emptyList(), visualEffects = emptyList(), showGraduationOverlay = false, waveActive = false, goldEarnedThisWave = 0, - score = state.score // Keep total score? Or reset? User said "Fresh everything", usually includes score? - // But usually in levels you want to see your total score. - // "Reset too" for difficulty scaling. - // Let's reset score too if it's "Fresh everything". - ).copy(score = 0) + score = 0 + )
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2907965d-646c-4d0f-9b9c-bbcf621155f5
📒 Files selected for processing (4)
app/src/main/java/com/messark/hawker/MainActivity.ktapp/src/main/java/com/messark/hawker/MainViewModel.ktapp/src/main/java/com/messark/hawker/model/GameModels.ktapp/src/main/java/com/messark/hawker/utils/GameStateRepository.kt
- Added `currentLevel` and `showGraduationOverlay` to `GameState` and persistence. - Defined level configurations for board dimensions (6x8, 6x10, 6x12, 6x14, 6x16, 8x16). - Implemented level graduation logic in `MainViewModel` triggered after completing Wave 50. - Added `GraduationOverlay` to `MainActivity` with Singlish flavor text. - Refined `graduateToNextLevel` and `resetGame` for comprehensive state resets. - Ensured level graduation state and dimensions are correctly saved and restored. Co-authored-by: candour <4670475+candour@users.noreply.github.com>
Build Successful! 🚀Note: This link will be removed when the PR is closed. |
|
The code sets score = state.score at line 1036, then immediately chains another .copy(score = 0) at line 1040, which overwrites the first assignment. This is inefficient and confusing. |
…gement - Added `currentLevel` and `showGraduationOverlay` to `GameState` and persistence. - Defined level configurations for board dimensions (6x8, 6x10, 6x12, 6x14, 6x16, 8x16). - Implemented level graduation logic in `MainViewModel` triggered after completing Wave 50. - Added `GraduationOverlay` to `MainActivity` with Singlish flavor text. - Refined `graduateToNextLevel` to perform a comprehensive reset of all session and transient state (gold, health, stars, wave, score, stalls, UI overlays, etc.) and save the state immediately. - Updated `resetGame` to ensure a full revert to starting values (Health 10, Wave 0, Level 1). - Ensured level graduation state and dimensions are correctly saved and restored across app restarts. Co-authored-by: candour <4670475+candour@users.noreply.github.com>
Build Successful! 🚀Note: This link will be removed when the PR is closed. |
I have implemented a sequential level system for Hawker Rush.
Key changes:
PR created automatically by Jules for task 8315806439057926885 started by @candour
Summary by CodeRabbit
New Features
Behavior Changes