Skip to content

Correct base stats in Registry to match documentation - #187

Closed
candour wants to merge 1 commit into
mainfrom
fix/registry-base-stats-12173012964599937512
Closed

Correct base stats in Registry to match documentation#187
candour wants to merge 1 commit into
mainfrom
fix/registry-base-stats-12173012964599937512

Conversation

@candour

@candour candour commented Jun 11, 2026

Copy link
Copy Markdown
Owner

I identified an inconsistency between the game engine's registry and the provided documentation (STALL_STATS.md and CUSTOMER_STATS.md). I have corrected the base stats for Chicken Rice, Durian, and Tiger Mom in Registry.kt. I also added a unit test RegistryStatsTest.kt to ensure these values remain correct according to the spec, and documented the fix in fixes.md as FIX-017.


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

Summary by CodeRabbit

  • Bug Fixes

    • Rebalanced character stats: Chicken Rice damage reduced to 10, Durian damage increased to 150, and Tiger Mom base HP increased to 80.
  • Tests

    • Added validation tests to verify character stat values are correctly configured.

- Updated Chicken Rice base damage to 10f (from 20f)
- Updated Durian base damage to 150f (from 100f)
- Updated Tiger Mom base HP to 80f (from 60f)
- Added RegistryStatsTest.kt to verify these values and prevent regressions
- Updated fixes.md with FIX-017

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 Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adjusts gameplay balance by updating three entity stats in the registry (Chicken Rice damage reduced, Durian damage increased, Tiger Mom HP increased), adds JUnit tests to verify the new values, and documents the changes in the changelog.

Changes

Gameplay balance adjustments

Layer / File(s) Summary
Stall and enemy stat adjustments
app/src/main/java/com/messark/hawker/registry/Registry.kt
Chicken Rice StallDefinition damage reduced from 20f to 10f, Durian StallDefinition damage increased from 100f to 150f, and Tiger Mom EnemyDefinition baseHp increased from 60f to 80f.
Registry stats verification tests
app/src/test/java/com/messark/hawker/RegistryStatsTest.kt
New RegistryStatsTest class with three JUnit test methods (testChickenRiceBaseDamage, testDurianBaseDamage, testTigerMomBaseHp) that fetch definitions from registries and assert exact stat values match the updated constants.
Changelog documentation
fixes.md
New FIX-017 entry documenting the base stat corrections for Chicken Rice, Durian, and Tiger Mom, noting alignment with STALL_STATS.md and CUSTOMER_STATS.md.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • candour/towerpower#181: Modifies the same three registry constants (Chicken Rice damage, Durian damage, Tiger Mom baseHp) but in opposite directions.
  • candour/towerpower#94: Introduces the same Chicken Rice and Durian registry stat changes alongside related test assertions.
  • candour/towerpower#141: Directly updates the same stall and enemy registry stat definitions in Registry.kt for Chicken Rice damage, Durian damage, and Tiger Mom baseHp.
🚥 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 accurately summarizes the main change: correcting base stats in Registry to match documentation, which aligns with the primary objective of the PR.
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 fix/registry-base-stats-12173012964599937512

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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4f29ead9-a195-42db-b3f7-f705b9b56b4c

📥 Commits

Reviewing files that changed from the base of the PR and between 574937e and ec9308e.

📒 Files selected for processing (3)
  • app/src/main/java/com/messark/hawker/registry/Registry.kt
  • app/src/test/java/com/messark/hawker/RegistryStatsTest.kt
  • fixes.md

Comment on lines +13 to +17
fun testChickenRiceBaseDamage() {
val def = StallRegistry.get(StallType.CHICKEN_RICE)
// STALL_STATS.md says Chicken Rice base damage should be 10
assertEquals("Chicken Rice base damage should be 10", 10f, def.damage)
}

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.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if the test file compiles and verify JUnit assertEquals signature for floats

# Try to compile the test file
./gradlew :app:compileDebugUnitTestKotlin 2>&1 | grep -A5 -B5 "RegistryStatsTest"

# Search for JUnit version in gradle files
rg -n "junit" --glob "*build.gradle*" -C2

Repository: candour/towerpower

Length of output: 866


🏁 Script executed:

#!/bin/bash
set -e

# 1) Show the exact test code around the assertion and capture any imports (for JUnit vs kotlin.test)
FILE="app/src/test/java/com/messark/hawker/RegistryStatsTest.kt"
echo "---- $FILE (lines 1-80) ----"
nl -ba "$FILE" | sed -n '1,120p'

# 2) Confirm where assertEquals comes from (imports)
echo
echo "---- assertEquals references (file-local) ----"
rg -n "assertEquals\(" "$FILE" || true
rg -n "^import .*assertEquals" "$FILE" || true

# 3) Compile unit tests (should fail if the overload is invalid)
echo
echo "---- Running compileDebugUnitTestKotlin ----"
./gradlew :app:compileDebugUnitTestKotlin --no-daemon 2>&1 | tail -n 60

# 4) Determine JUnit version/type from gradle version catalog or build files
echo
echo "---- JUnit dependency resolution hints ----"
rg -n "libs\.junit|junit[:]" gradle* settings.gradle* build.gradle* gradle/libs.versions.toml app/build.gradle* 2>/dev/null || true
ls -la gradle || true
if [ -f gradle/libs.versions.toml ]; then
  echo
  echo "---- gradle/libs.versions.toml (junit entries) ----"
  rg -n "junit" gradle/libs.versions.toml -n || true
fi

Repository: candour/towerpower

Length of output: 6150


🏁 Script executed:

#!/bin/bash
set -e

# Locate RegistryStatsTest
FILE="app/src/test/java/com/messark/hawker/RegistryStatsTest.kt"
test -f "$FILE" && echo "Found $FILE" || (echo "Missing $FILE" && exit 1)

echo "---- RegistryStatsTest.kt around assertions ----"
sed -n '1,120p' "$FILE" | nl -ba | sed -n '1,120p' || sed -n '1,120p' "$FILE"

echo
echo "---- Determine type of def and def.damage ----"
# Find StallRegistry.get signature usage in codebase
rg -n "object StallRegistry|class StallRegistry|fun get\\(" app/src/main -S || true

# Find StallType.CHICKEN_RICE usages
rg -n "StallType\\.CHICKEN_RICE" app/src -S || true

# Find the definition of damage field on the registry entry type
rg -n "data class .*damage|val damage|var damage" app/src/main -S || true

# Specifically look for StallRegistry return type or registry entry model
rg -n "StallRegistry\\.get\\(" app/src/main app/src/test -S || true

# Print StallRegistry file(s)
fd -a "StallRegistry" app/src/main -t f || true
fd -a "StallRegistry" app/src/test -t f || true

Repository: candour/towerpower

Length of output: 9288


🏁 Script executed:

#!/bin/bash
set -e

FILE="app/src/test/java/com/messark/hawker/RegistryStatsTest.kt"
test -f "$FILE" || { echo "Missing $FILE"; exit 1; }

echo "---- RegistryStatsTest.kt (first 120 lines) ----"
sed -n '1,120p' "$FILE" | cat -n

echo
echo "---- Find StallRegistry definition and get() signature ----"
rg -n "class StallRegistry|object StallRegistry|fun get\\(.*StallType" app/src/main -S || true

echo
echo "---- Locate StallType.CHICKEN_RICE ----"
rg -n "StallType\\.CHICKEN_RICE" app/src -S || true

echo
echo "---- Find model/entry fields containing 'damage' near StallRegistry ----"
rg -n "val damage|var damage|damage:" app/src/main -S || true

echo
echo "---- Find StallRegistry.get call sites ----"
rg -n "StallRegistry\\.get\\(" app/src/main app/src/test -S || true

Repository: candour/towerpower

Length of output: 11177


🏁 Script executed:

#!/bin/bash
set -e

FILE="app/src/test/java/com/messark/hawker/RegistryStatsTest.kt"
test -f "$FILE" || { echo "Missing $FILE"; exit 1; }

echo "---- RegistryStatsTest.kt (first 120 lines) ----"
sed -n '1,120p' "$FILE" | cat -n

echo
echo "---- Find StallRegistry definition and get() signature ----"
rg -n "class StallRegistry|object StallRegistry|fun get\\(.*StallType" app/src/main -S || true

echo
echo "---- Locate StallType.CHICKEN_RICE ----"
rg -n "StallType\\.CHICKEN_RICE" app/src -S || true

echo
echo "---- Find model/entry fields containing 'damage' ----"
rg -n "val damage|var damage|damage:" app/src/main -S || true

echo
echo "---- Find StallRegistry.get call sites ----"
rg -n "StallRegistry\\.get\\(" app/src/main app/src/test -S || true

Repository: candour/towerpower

Length of output: 11158


🏁 Script executed:

#!/bin/bash
set -e

# Find other JUnit float assertEquals usages (with/without delta)
rg -n "assertEquals\\(.*\\b\\d+f\\b.*\\bdef\\.|assertEquals\\(.*\\b\\d+f\\b.*\\b.*\\b" app/src/test/java -S || true
rg -n "assertEquals\\(.*\\bFloat\\b|assertEquals\\(.*\\bfloat\\b" app/src/test/java -S || true
rg -n "assertEquals\\(.*\\,.*\\,.*\\,.*\\)" app/src/test/java -S | head -n 80 || true

# Specifically check for assertEquals(String, float, float, delta) style
rg -n "assertEquals\\([^\\)]*\\,\\s*[^\\,\\)]*f\\s*,\\s*[^\\,\\)]*\\s*,\\s*[^\\)]*f\\s*\\)" app/src/test/java -S || true
rg -n "assertEquals\\([^\\)]*\\,\\s*[^\\,\\)]*f\\s*,\\s*[^\\,\\)]*\\s*\\)" app/src/test/java -S || true

Repository: candour/towerpower

Length of output: 1120


🏁 Script executed:

#!/bin/bash
set -e

# Inspect surrounding code + imports for the other float assertEquals hits
for f in \
  app/src/test/java/com/messark/hawker/StallStatsTest.kt \
  app/src/test/java/com/messark/hawker/MilestoneBoostTest.kt \
  app/src/test/java/com/messark/hawker/RegistryStatsTest.kt
do
  echo "==================== $f (imports + around assertEquals hits) ===================="
  sed -n '1,80p' "$f" | cat -n
  echo "--- assertEquals lines ---"
  rg -n "assertEquals\\(" "$f"
  echo "--- context ---"
  rg -n "assertEquals\\(" -n -C 3 "$f" || true
done

# Count how many float assertEquals calls include a delta parameter in this test tree
echo "==================== float assertEquals with delta (heuristic) ===================="
# Match: assertEquals( ... <float_literal>f, ... <float_expr>, <float_literal>f )
rg -n "assertEquals\\([^\\n\\)]*f\\s*,[^\\n\\)]*f\\s*,[^\\n\\)]*f" app/src/test/java -S || true

# List all assertEquals lines in RegistryStatsTest for completeness
echo "==================== RegistryStatsTest assertEquals ==="
rg -n "assertEquals\\(" app/src/test/java/com/messark/hawker/RegistryStatsTest.kt -S || true

Repository: candour/towerpower

Length of output: 13226


🏁 Script executed:

#!/bin/bash
set -e

FILE="app/src/main/java/com/messark/hawker/registry/Registry.kt"
test -f "$FILE" || { echo "Missing $FILE"; exit 1; }

echo "---- StallDefinition damage type ----"
# Show StallDefinition data class/interface block around the 'damage: Float' field
rg -n "val damage: Float|data class StallDefinition|class StallDefinition" "$FILE"
# Print around the 'damage: Float' line
ln=$(rg -n "val damage: Float" "$FILE" | head -n1 | cut -d: -f1)
start=$((ln-30)); end=$((ln+30))
sed -n "${start},${end}p" "$FILE" | nl -ba | head -n 120

echo
echo "---- StallRegistry CHICKEN_RICE definition ----"
# Print around the CHICKEN_RICE entry in the registry map
rg -n "StallType\\.CHICKEN_RICE to StallDefinition\\(" "$FILE" || true
ln2=$(rg -n "StallType\\.CHICKEN_RICE to StallDefinition\\(" "$FILE" | head -n1 | cut -d: -f1)
start2=$((ln2-10)); end2=$((ln2+60))
sed -n "${start2},${end2}p" "$FILE" | nl -ba | head -n 120

echo
echo "---- Enemy baseHp type and TIGER_MOM definition ----"
# show EnemyDefinition baseHp type
rg -n "val baseHp: Float|baseHp: Float|EnemyDefinition" "$FILE"
ln3=$(rg -n "val baseHp: Float" "$FILE" | head -n1 | cut -d: -f1 || true)
if [ -n "${ln3:-}" ]; then
  start3=$((ln3-20)); end3=$((ln3+30))
  sed -n "${start3},${end3}p" "$FILE" | nl -ba | head -n 120
fi
# search for TIGER_MOM in registry file
rg -n "EnemyType\\.TIGER_MOM" "$FILE" || true
ln4=$(rg -n "EnemyType\\.TIGER_MOM" "$FILE" | head -n1 | cut -d: -f1 || true)
if [ -n "${ln4:-}" ]; then
  start4=$((ln4-10)); end4=$((ln4+40))
  sed -n "${start4},${end4}p" "$FILE" | nl -ba | head -n 120
fi

Repository: candour/towerpower

Length of output: 990


🏁 Script executed:

#!/bin/bash
set -e

# 1) Show the exact registry literals
FILE="app/src/main/java/com/messark/hawker/registry/Registry.kt"

echo "---- StallType.CHICKEN_RICE entry ----"
sed -n '410,460p' "$FILE" | cat -n

echo
echo "---- EnemyType.TIGER_MOM entry ----"
sed -n '540,600p' "$FILE" | cat -n

# 2) Compile unit tests without daemon to avoid daemon connectivity issues
echo
echo "---- Running compileDebugUnitTestKotlin with --no-daemon ----"
./gradlew :app:compileDebugUnitTestKotlin --no-daemon --stacktrace 2>&1 | tail -n 80

Repository: candour/towerpower

Length of output: 15512


🌐 Web query:

JUnit 4.13.2 org.junit.Assert assertEquals(String,float,float) overload

💡 Result:

In JUnit 4.13.2, the org.junit.Assert class does not provide a direct overload for assertEquals(String, float, float) [1][2][3]. For floating-point comparisons, JUnit requires an explicit delta to account for precision issues [2][4]. The available methods for comparing two floats are: 1. assertEquals(String message, float expected, float actual, float delta) [2][3] 2. assertEquals(float expected, float actual, float delta) [2][3] In both cases, the delta parameter represents the maximum allowed difference between the expected and actual values for the assertion to be considered a pass [2][3]. If you attempt to use a method signature without a delta, you will typically find it does not exist for float types in the API, unlike the deprecated double-precision methods that previously omitted the delta (e.g., assertEquals(String, double, double)) [2][5]. If you are currently trying to compare floats without a delta, you must update your code to include one, such as: Assert.assertEquals("Optional error message", 1.0f, 1.0001f, 0.001f);

Citations:


🌐 Web query:

JUnit 4.13.2 org.junit.Assert assertEquals(String, Object, Object) and assertEquals(String, double, double) overloads

💡 Result:

JUnit 4.13.2 org.junit.Assert has these overloads: 1) assertEquals(String, Object, Object) - Signature: public static void assertEquals(String message, Object expected, Object actual) - Meaning: Asserts two objects are equal; if they are not, throws AssertionError with the given message. If expected and actual are both null, they are considered equal.[1] 2) assertEquals(String, double, double) - Signature: public static void assertEquals(String message, double expected, double actual) - Status: Deprecated. - Meaning/alternative: Javadoc marks it as “Deprecated. Use assertEquals(String message, double expected, double actual, double delta) instead”.[2] Practical guidance: For doubles (especially when comparing non-integers), prefer assertEquals(String, double, double, double delta), which asserts equality within a positive delta.[3]

Citations:


Add delta to float assertEquals in RegistryStatsTest

org.junit.Assert.assertEquals (JUnit 4.13.2) doesn’t provide assertEquals(String, float, float); this assertion will fall back to a less-ideal overload (deprecated/boxed) rather than using an explicit float tolerance. Add a delta to prevent precision-related flakiness and avoid deprecation (apply the same change to the Durian and Tiger Mom assertions in the file too).

🔧 Proposed fix
-        assertEquals("Chicken Rice base damage should be 10", 10f, def.damage)
+        assertEquals("Chicken Rice base damage should be 10", 10f, def.damage, 0.01f)
📝 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.

Suggested change
fun testChickenRiceBaseDamage() {
val def = StallRegistry.get(StallType.CHICKEN_RICE)
// STALL_STATS.md says Chicken Rice base damage should be 10
assertEquals("Chicken Rice base damage should be 10", 10f, def.damage)
}
fun testChickenRiceBaseDamage() {
val def = StallRegistry.get(StallType.CHICKEN_RICE)
// STALL_STATS.md says Chicken Rice base damage should be 10
assertEquals("Chicken Rice base damage should be 10", 10f, def.damage, 0.01f)
}

Comment on lines +20 to +24
fun testDurianBaseDamage() {
val def = StallRegistry.get(StallType.DURIAN)
// STALL_STATS.md says Durian base damage should be 150
assertEquals("Durian base damage should be 150", 150f, def.damage)
}

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.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Add delta parameter to float assertEquals.

Same issue as testChickenRiceBaseDamage: the delta parameter is required for float comparisons in JUnit.

🔧 Proposed fix
-        assertEquals("Durian base damage should be 150", 150f, def.damage)
+        assertEquals("Durian base damage should be 150", 150f, def.damage, 0.01f)

Comment on lines +27 to +31
fun testTigerMomBaseHp() {
val def = EnemyRegistry.get(EnemyType.TIGER_MOM)
// CUSTOMER_STATS.md says Tiger Mom base HP should be 80
assertEquals("Tiger Mom base HP should be 80", 80f, def.baseHp)
}

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.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Add delta parameter to float assertEquals.

Same issue: JUnit requires a delta parameter for float assertions.

🔧 Proposed fix
-        assertEquals("Tiger Mom base HP should be 80", 80f, def.baseHp)
+        assertEquals("Tiger Mom base HP should be 80", 80f, def.baseHp, 0.01f)
📝 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.

Suggested change
fun testTigerMomBaseHp() {
val def = EnemyRegistry.get(EnemyType.TIGER_MOM)
// CUSTOMER_STATS.md says Tiger Mom base HP should be 80
assertEquals("Tiger Mom base HP should be 80", 80f, def.baseHp)
}
fun testTigerMomBaseHp() {
val def = EnemyRegistry.get(EnemyType.TIGER_MOM)
// CUSTOMER_STATS.md says Tiger Mom base HP should be 80
assertEquals("Tiger Mom base HP should be 80", 80f, def.baseHp, 0.01f)
}

@candour candour closed this Jun 16, 2026
@candour
candour deleted the fix/registry-base-stats-12173012964599937512 branch June 16, 2026 05:16
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