# mine-diamond/petfightgame architecture

> Architecture diagram of the GitHub repository mine-diamond/petfightgame, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mine-diamond/petfightgame
- Repository: https://github.com/mine-diamond/petfightgame

## Overview

##### Main Components
- Entry Point & Application Core: Use src/Main.java as the starting point. This “main” component initializes the game.
- Game Logic Layer: Represent the BattleSystem (in src/com/main/game/BattleSystem.java) that encapsulates the turn-based fight mechanics and controls the battle flow.
- Domain Models:
- Pet and its Variants: Display the classes under src/com/main/pets (Pet, BlackTaurus, FireFox, Attributes, and the legacy version Pet_old). They model various pet types and their core properties.
- Player & Wallet: In src/com/main/classes (Player and Wallet) to represent the game’s actors and in-game currency or resource management.
- Attribute and Value Handling: Show components such as PetStat, ResourceValue, ObservableDouble, and ValueModifier (in src/com/main/classes) that deal with attribute management and dynamic numerical modifications.
- Skill System: Include the Skill and SkillLibrary classes (in src/com/main/skills) that manage the move sets available for pets during battles.

##### Grouping & Architectural Patterns
- That the system follows object-oriented design principles. You might annotate that the architecture employs composition and inheritance – for example, Pets might share common properties via a superclass or interfaces.
- Although it’s a small, self-contained project, the separation between different responsibilities (battle logic, pet management, attribute handling, skill operations) is clear and should be depicted.

##### Relationships and Interactions
- Directional data flow:
- The Main entry point triggers the BattleSystem.
- The BattleSystem interacts with Pet objects (the fighters) and utilizes Skills (fetched from SkillLibrary) during the game.
- The Pet objects internally use Attributes, and their dynamic properties are managed by ValueModifier, ObservableDouble, etc.
- The Player entity (from the classes package) interacts with these components (e.g., choosing skills and managing Wallet resources).
- Clearly denote dependencies where, for example, the BattleSystem “has-a” or “uses” relationship with Pet, Skill, and ValueModifier objects.

##### Specific Technologies & Design Elements
- Java is the main technology; note that the project is developed in IntelliJ IDEA, and it’s built to run on JDK 17.

##### Final Checklist
- Clear labels for each main component (Main, BattleSystem, Pet modules, Skill modules, Attribute management).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Core
    MainEntry("Main Entry Point (src/Main.java)"):::core

    %% Game Logic Layer
    BattleSystem("BattleSystem (src/com/main/game/BattleSystem.java)"):::logic

    %% Domain Models
    subgraph "Pets Package"
        Pet("Pet (src/com/main/pets/Pet.java)"):::domain
        BlackTaurus("BlackTaurus (src/com/main/pets/BlackTaurus.java)"):::domain
        FireFox("FireFox (src/com/main/pets/FireFox.java)"):::domain
        PetOld("Pet_old (src/com/main/pets/Pet_old.java)"):::domain
        Attributes("Attributes (src/com/main/pets/Attributes.java)"):::domain
    end

    subgraph "Classes Package"
        Player("Player (src/com/main/classes/Player.java)"):::domain
        Wallet("Wallet (src/com/main/classes/Wallet.java)"):::domain
        PetStat("PetStat (src/com/main/classes/PetStat.java)"):::utility
        ResourceValue("ResourceValue (src/com/main/classes/ResourceValue.java)"):::utility
        ObservableDouble("ObservableDouble (src/com/main/classes/ObservableDouble.java)"):::utility
        ValueModifier("ValueModifier (src/com/main/classes/ValueModifier.java)"):::utility
    end

    subgraph "Skills Package"
        Skill("Skill (src/com/main/skills/Skill.java)"):::domain
        SkillLibrary("SkillLibrary (src/com/main/skills/SkillLibrary.java)"):::domain
    end

    %% Relationships and Data Flow
    MainEntry -->|"starts"| BattleSystem
    BattleSystem -->|"controlsFight"| Pet
    BattleSystem -->|"usesSkillLib"| SkillLibrary
    BattleSystem -->|"interactsWith"| Player
    
    Pet -->|"hasVariant"| BlackTaurus
    Pet -->|"hasVariant"| FireFox
    Pet -->|"hasLegacyVariant"| PetOld
    Pet -->|"usesAttributes"| Attributes
    Pet -->|"managesStatsVia"| PetStat
    PetStat -->|"modifies|via"| ValueModifier
    PetStat -->|"tracks"| ObservableDouble

    Player -->|"managesResources"| Wallet

    SkillLibrary -->|"contains"| Skill

    %% Click Events
    click MainEntry "https://github.com/mine-diamond/petfightgame/blob/main/src/Main.java"
    click BattleSystem "https://github.com/mine-diamond/petfightgame/blob/main/src/com/main/game/BattleSystem.java"
    click Pet "https://github.com/mine-diamond/petfightgame/blob/main/src/com/main/pets/Pet.java"
    click BlackTaurus "https://github.com/mine-diamond/petfightgame/blob/main/src/com/main/pets/BlackTaurus.java"
    click FireFox "https://github.com/mine-diamond/petfightgame/blob/main/src/com/main/pets/FireFox.java"
    click PetOld "https://github.com/mine-diamond/petfightgame/blob/main/src/com/main/pets/Pet_old.java"
    click Attributes "https://github.com/mine-diamond/petfightgame/blob/main/src/com/main/pets/Attributes.java"
    click Player "https://github.com/mine-diamond/petfightgame/blob/main/src/com/main/classes/Player.java"
    click Wallet "https://github.com/mine-diamond/petfightgame/blob/main/src/com/main/classes/Wallet.java"
    click PetStat "https://github.com/mine-diamond/petfightgame/blob/main/src/com/main/classes/PetStat.java"
    click ResourceValue "https://github.com/mine-diamond/petfightgame/blob/main/src/com/main/classes/ResourceValue.java"
    click ObservableDouble "https://github.com/mine-diamond/petfightgame/blob/main/src/com/main/classes/ObservableDouble.java"
    click ValueModifier "https://github.com/mine-diamond/petfightgame/blob/main/src/com/main/classes/ValueModifier.java"
    click Skill "https://github.com/mine-diamond/petfightgame/blob/main/src/com/main/skills/Skill.java"
    click SkillLibrary "https://github.com/mine-diamond/petfightgame/blob/main/src/com/main/skills/SkillLibrary.java"

    %% Styles
    classDef core fill:#f9c,stroke:#333,stroke-width:2px;
    classDef logic fill:#ccf,stroke:#333,stroke-width:2px;
    classDef domain fill:#cfc,stroke:#333,stroke-width:2px;
    classDef utility fill:#fc9,stroke:#333,stroke-width:2px;
```
