Files
2026-07-17 23:57:58 +03:30

181 lines
3.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Java RPG Project
A small console-based Java RPG where the player selects a character class and fights a fixed sequence of enemies: Vampire, Goblin, Skeleton, and Dragon.
## Gameplay
The game flow is handled in `Main.java`:
1. The player enters a name.
2. The player chooses a class:
- Knight
- Wizard
- Assassin
3. The game creates four locations and enemies:
- Overworld -> Vampire
- Village -> Goblin
- Nether -> Skeleton
- End -> Dragon
4. The player fights each enemy in sequence.
5. If the player dies, the game ends.
6. If all enemies are defeated, the player wins.
## Combat System
Each battle is turn-based.
### Player actions
The player can choose from:
- light attack
- normal attack
- heavy attack
- heal
- skip
### Enemy actions
Enemies attack after the players turn. Some enemies have special behavior:
- Vampire can restore health while attacking
- Goblin can land critical hits
- Skeleton revives once after being defeated
- Dragon acts as a boss enemy with high HP
## Core Interfaces and Classes
### `Entity`
Common contract for all combatants.
It defines shared behavior such as:
- `attack(Entity target)`
- `heal(int health)`
- `fillMana(int mana)`
- `takeDamage(int damage)`
- `getMaxHP()`
- `getMaxMP()`
### `Player`
Abstract base class for all player characters.
It stores:
- name
- weapon
- armor
- current and maximum HP/MP
- base damage
- alive status
It also provides:
- normal attack
- heavy attack
- damage handling with armor defense
- healing
- mana restoration
### `Enemy`
Abstract base class for enemies.
It stores:
- weapon
- HP/MP
- base damage
- alive status
It handles damage directly and leaves defeat behavior to subclasses through `getKilled()`.
## Player Classes
### `Knight`
- HP: 100
- MP: 10
- Base damage: 10
A durable melee fighter with strong base damage.
### `Wizard`
- HP: 150
- MP: 10
- Base damage: 4
A high-HP character using the shared `Player` behavior.
### `Assassin`
- HP: 80
- MP: 20
- Base damage: 5
A lighter character with more mana than the Knight.
## Enemy Classes
### `Vampire`
- HP: 50
- MP: 50
Attacks and restores part of the damage dealt as health.
### `Goblin`
- HP: 30
- MP: 50
Randomly performs either a normal or critical attack.
### `Skeleton`
- HP: 50
- MP: 50
- Base damage: 10
Revives once after death, then dies permanently the second time.
### `Dragon`
- HP: 500
- Base damage: 2
A boss-style enemy with a fire-breath themed attack and custom death handling.
## Items
### `Weapon`
Abstract item type for damage-dealing equipment.
It includes:
- damage
- mana cost
### `Sword`
A weapon with low damage and a mana cost.
It also includes a unique ability that can damage multiple targets.
### `DragonBreath`
A stronger weapon used for dragon-related combat behavior.
## Armor
### `Armor`
Abstract armor type with:
- defense
- maximum defense
- durability
- maximum durability
- broken state
Armor can be repaired, and when durability reaches zero, its defense drops to zero.
### `KnightArmor`
A concrete armor type used by the player in the main game flow.
#### `Flask`
A healing item that restores a fraction of the targets maximum HP.
## Location
`Location` is a simple class that stores a location name and one enemy.