Skip to content

docs: align class diagram with source types#42

Merged
liang799 merged 5 commits into
mainfrom
tianpok/verify-class-diagram-claims
Apr 15, 2026
Merged

docs: align class diagram with source types#42
liang799 merged 5 commits into
mainfrom
tianpok/verify-class-diagram-claims

Conversation

@liang799

@liang799 liang799 commented Apr 15, 2026

Copy link
Copy Markdown
Owner

Super clean class diagram!!!!

@coderabbitai

coderabbitai Bot commented Apr 15, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d5f99116-3b9b-4ecd-909d-70b8d8b15016

📥 Commits

Reviewing files that changed from the base of the PR and between a69ed74 and 8f7b061.

⛔ Files ignored due to path filters (2)
  • docs/uml-diagrams/imgs/plantuml_class_diagram.png is excluded by !**/*.png
  • docs/uml-diagrams/imgs/plantuml_class_diagram.svg is excluded by !**/*.svg
📒 Files selected for processing (1)
  • docs/uml-diagrams/plantuml_class_diagram.puml
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/uml-diagrams/plantuml_class_diagram.puml

📝 Walkthrough

Walkthrough

Adds/updates the PlantUML class diagram to introduce a CombatStats builder, extended status-effect APIs, a BattleEventPublisher rewiring of engine event flow, scenario/setup factories and a CLI demo, and a Swing-based arena rendering stack with UI state/config and controller extensions.

Changes

Cohort / File(s) Summary
PlantUML & Diagram
docs/uml-diagrams/plantuml_class_diagram.puml
Reworked legend, linetype, and many relationship lines to reflect new factories, publisher, renderer/model boundaries, and updated notes.
CombatStats Builder
.../domain/entities/CombatStats, .../domain/entities/CombatStats.Builder
Added static builder() and exported builder factory with overloaded attack/defense/speed setters and build().
Status Effects & Registry
.../domain/status/StatusEffect, .../domain/status/StatusEffectRegistry, .../domain/status/StunStatusEffect
Added getTurnBlockReason(owner: Combatant): Optional<String> and consumeOutcomes(): List<StatusEffectOutcome>; updated Stun signature.
Engine Eventing & State
.../engine/orchestration/BattleEventPublisher, .../engine/BattleEngine, .../engine/BattleState
New BattleEventPublisher (emit, snapshot); BattleEngine now uses publisher; added BattleState accessors and spawn/reserve helpers.
Scenarios & Setup Factories
.../engine/setup/EasyLevelSetup, .../MediumLevelSetup, .../HardLevelSetup, .../AppendixAScenarios, .../ScenarioScript, .../BattleSetup
Added exported scenario factories, ScenarioScript getters, and BattleSetup accessors (getPlayer, getInitialEnemies, getBackupEnemies).
Player Decision & Targeting
.../engine/PlayerDecision, .../engine/TargetReference, .../engine/TargetReference.TargetType
Added static factories targeted(...)/untargeted(...), none()/enemy(...), and nested TargetType enum.
Reporting / CLI Demo
.../engine/report/StatusEffectReportMapper, .../ui/cli/EasyRoundsDemo
Added StatusEffectReportMapper.toNotes(...) and CLI EasyRoundsDemo.main(...).
Arena Scene & Rendering Stack
.../ui/swing/ArenaSceneModel, .../ArenaSceneRenderer, .../ArenaSceneLoop, .../ArenaScenePanel
New ArenaScene model APIs (start/show/apply/tick, sprites/floating texts), renderer and loop controls; model/renderer interactions defined.
Sprite Renderers & DTOs
.../ui/swing/FighterSpriteDto, .../FighterSpriteRenderer, .../FighterBodyRenderer, .../FighterSpriteHudRenderer, .../FighterSpriteEffectRenderer, .../FighterType, .../ArenaSceneModel.FloatingText
Added DTO conversion/update methods, renderer interfaces, HUD helpers, FighterType helper and FloatingText record.
UI Controls, Session & Post-Game
.../ui/swing/BattleCommandPanel, .../ui/swing/BattleSessionModel, .../ui/swing/BattleLaunchRequest, .../ui/swing/PostGameConfig, .../PostGameConfig.Preset, .../PostGameConfig.Custom, .../SwingThread, .../BattleMenuState
Extended controller/panel APIs, session post-game queueing, PostGameConfig variants and SwingThread.runAndWait(...); added BattleMenuState enum.

Sequence Diagram(s)

sequenceDiagram
  actor Player
  participant BattleEngine
  participant BattleEventPublisher
  participant ArenaSceneModel
  participant SwingThread
  participant ArenaSceneRenderer

  Player->>BattleEngine: performAction(command)
  BattleEngine->>BattleEventPublisher: emit(battleEvent, optionalListener)
  BattleEventPublisher->>BattleEventPublisher: store(event)
  BattleEventPublisher->>ArenaSceneModel: deliver(event)
  ArenaSceneModel->>ArenaSceneModel: update state / sprites
  SwingThread->>ArenaSceneRenderer: run render(model, now)
  ArenaSceneRenderer->>ArenaSceneModel: spritesByDrawOrder()/floatingTexts()
  ArenaSceneRenderer->>SwingThread: paint to panel
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰
I nibbled lines and stitched a scene,
Builders bloom where stats convene.
Events hop out, sprites bound and play—
Scenarios leap, then dusk to day.
Carrots, code, and canvas sway! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'docs: align class diagram with source types' accurately reflects the main change—updating PlantUML class diagram to align with actual source code entities, methods, and architectural relationships.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 tianpok/verify-class-diagram-claims

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/uml-diagrams/plantuml_class_diagram.puml`:
- Around line 877-880: The PostGameConfig interface in the PlantUML diagram is
missing the common accessor; add the method declaration "GameConfiguration
getGameConfiguration()" to the PostGameConfig interface block so the diagram
matches the Java interface (PostGameConfig) and shows the shared contract
implemented by the preset(...) and custom(...) record variants.
- Around line 120-127: Update the PlantUML class diagram so the
CombatStats.Builder setter signatures use Stat instead of int: change the method
declarations in class CombatStatsBuilder (the attack(...), defense(...), and
speed(...) methods) to take a Stat parameter (e.g., attack(attack: Stat):
CombatStats.Builder, defense(defense: Stat): CombatStats.Builder, speed(speed:
Stat): CombatStats.Builder) to match the actual method signatures in CombatStats
(and leave build(): CombatStats as-is).
- Around line 704-710: Update the UML for ArenaSceneModel to match the actual
Java class: replace the outdated fields and methods (remove sprites, enemyOrder,
battleActive, startBattle(...), showPlayerTurn(...)) and instead document the
real members used in src: fields fighters, battleHistory, selectedEnemyId,
gameOver and the method onBattleSetup(BattleSetup setup); ensure visibility and
types match the Java class declarations (e.g., fighters: Map<CombatantId,
FighterSpriteDto>, battleHistory: List<...> etc.) so the PlantUML class block
for ArenaSceneModel reflects those exact symbols.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3fa8acbc-855d-45b9-a0db-3725c80d0748

📥 Commits

Reviewing files that changed from the base of the PR and between 1f231f9 and a278899.

⛔ Files ignored due to path filters (2)
  • docs/uml-diagrams/imgs/plantuml_class_diagram.png is excluded by !**/*.png
  • docs/uml-diagrams/imgs/plantuml_class_diagram.svg is excluded by !**/*.svg
📒 Files selected for processing (1)
  • docs/uml-diagrams/plantuml_class_diagram.puml

Comment thread docs/uml-diagrams/plantuml_class_diagram.puml
Comment thread docs/uml-diagrams/plantuml_class_diagram.puml
Comment thread docs/uml-diagrams/plantuml_class_diagram.puml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
docs/uml-diagrams/plantuml_class_diagram.puml (1)

124-126: ⚠️ Potential issue | 🟠 Major

Use Stat in the builder setters.

These signatures still take int, but the builder state is Stat-typed and CombatStats is composed of Stat values in src/main/java/sc2002/turnbased/domain/CombatStats.java:1-36. That leaves the diagram out of sync with the documented API.

Suggested doc fix
   class CombatStatsBuilder as "CombatStats.Builder" <<factory>> {
     - attack: Stat
     - defense: Stat
     - speed: Stat
-    + attack(attack: int): CombatStats.Builder
-    + defense(defense: int): CombatStats.Builder
-    + speed(speed: int): CombatStats.Builder
+    + attack(attack: Stat): CombatStats.Builder
+    + defense(defense: Stat): CombatStats.Builder
+    + speed(speed: Stat): CombatStats.Builder
     + build(): CombatStats
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/uml-diagrams/plantuml_class_diagram.puml` around lines 124 - 126, The
PlantUML diagram's builder method signatures are incorrect: update the three
builder setters attack(...), defense(...), and speed(...) on CombatStats.Builder
to accept Stat (not int) to match the domain model; ensure the diagram shows
CombatStats composed of Stat and that CombatStats.Builder::attack,
CombatStats.Builder::defense, and CombatStats.Builder::speed use Stat-typed
parameters consistent with
src/main/java/sc2002/turnbased/domain/CombatStats.java and its Stat fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/uml-diagrams/plantuml_class_diagram.puml`:
- Around line 989-994: The PlantUML arrows are reversed: instead of
EasyLevelSetup, MediumLevelSetup, and HardLevelSetup depending on
BattleSetupFactory and GameConfiguration, the diagram should show
BattleSetupFactory and GameConfiguration depending on those setup helpers (they
are leaf factories). Update the relationships so BattleSetupFactory ..>
EasyLevelSetup, BattleSetupFactory ..> MediumLevelSetup, BattleSetupFactory ..>
HardLevelSetup and likewise GameConfiguration ..> EasyLevelSetup,
GameConfiguration ..> MediumLevelSetup, GameConfiguration ..> HardLevelSetup to
reflect the actual APIs (referencing EasyLevelSetup, MediumLevelSetup,
HardLevelSetup, BattleSetupFactory, and GameConfiguration).

---

Duplicate comments:
In `@docs/uml-diagrams/plantuml_class_diagram.puml`:
- Around line 124-126: The PlantUML diagram's builder method signatures are
incorrect: update the three builder setters attack(...), defense(...), and
speed(...) on CombatStats.Builder to accept Stat (not int) to match the domain
model; ensure the diagram shows CombatStats composed of Stat and that
CombatStats.Builder::attack, CombatStats.Builder::defense, and
CombatStats.Builder::speed use Stat-typed parameters consistent with
src/main/java/sc2002/turnbased/domain/CombatStats.java and its Stat fields.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 05cc5c68-4813-42b8-a9bc-ee5692fe4e64

📥 Commits

Reviewing files that changed from the base of the PR and between a278899 and 3719850.

⛔ Files ignored due to path filters (2)
  • docs/uml-diagrams/imgs/plantuml_class_diagram.png is excluded by !**/*.png
  • docs/uml-diagrams/imgs/plantuml_class_diagram.svg is excluded by !**/*.svg
📒 Files selected for processing (1)
  • docs/uml-diagrams/plantuml_class_diagram.puml

Comment thread docs/uml-diagrams/plantuml_class_diagram.puml Outdated
@liang799
liang799 merged commit 6f8ccf6 into main Apr 15, 2026
3 checks passed
@liang799
liang799 deleted the tianpok/verify-class-diagram-claims branch April 15, 2026 15:27
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