Java RPG
A turn-based RPG built in Java where you choose your hero, battle monsters across treacherous locations, collect keys from fallen enemies, and ultimately face the Dragon boss.
Overview
Three heroes. Three locations. Three enemies standing between you and the Dragon.
Defeat a Goblin, a Skeleton, and a Vampire to collect their keys — only then can you challenge the Dragon and claim victory. Each hero plays completely differently, each enemy has unique mechanics, and every fight demands smart resource management.
Features
- 3 playable characters — Assassin, Knight, Wizard — each with unique abilities, weapons, and armor mechanics
- 4 enemies — Goblin, Skeleton, Vampire, and the Dragon boss
- ️ 3 locations — Jungle, China, Iran — each with different enemy pools
- Key collection system — defeat one of each enemy type to unlock the Dragon
- ️ Rich combat — light attacks, heavy attacks, defend, heal, special abilities, and flasks
- Leveling system — gain XP from victories, level up to increase max HP and MP
- Special enemy mechanics — Skeleton revives, Vampire lifesteals, Dragon charges fire breath
How to Run
Requirements
- Java 17 or higher
- Any Java IDE (IntelliJ IDEA, Eclipse, VS Code) or the command line
Run from an IDE
- Clone or download the repository
- Open the project in your IDE
- Run
Main.java
Gameplay Guide
Choosing your hero
At the start you'll pick one of three characters. Your choice determines your weapon, armor type, flask, and special ability.
The goal
Explore locations, fight enemies, and collect a key from each enemy type (Goblin, Skeleton, Vampire). Once all three keys are in hand, you'll be offered the chance to challenge the Dragon. Win that fight — and the game is yours.
Combat actions
Each turn you choose one of six actions:
| # | Action | Description |
|---|---|---|
| 1 | Light attack | Always free, no MP cost. May trigger a weapon bonus |
| 2 | Heavy attack | Costs MP. Deals boosted damage |
| 3 | Defend | Costs MP. Reduces incoming damage this turn |
| 4 | Heal | Costs MP. Restores 10 HP |
| 5 | Special ability | Costs MP. Unique per character |
| 6 | Flask | Free. Uses a consumable charge |
If an action fails due to insufficient MP, you'll be prompted to choose again — your turn is not wasted.
Locations
| Location | Enemies |
|---|---|
| Jungle | Goblin, Skeleton, Vampire |
| China | Goblin, Skeleton |
| Iran | Skeleton, Vampire |
The enemy you face is chosen randomly from the location's pool each visit.
Heroes
Assassin
Weapon: Dagger (8 dmg) — Flask: Health Flask (10 HP × 3)
A high-risk, high-reward fighter. Most actions cost MP, but the special ability unlocks a devastating free strike.
- Light attack — 30% chance to critical hit for 1.5x damage
- Heavy attack — 1.4x damage, costs MP. If shadow step is active: 1.8x and free
- Defend — costs 12 MP, blocks with 70% damage reduction
- Special ability — costs 25 MP, activates Shadow Step: enemy skips their next turn, and your next heavy attack becomes 1.8x and free
- Armor passive — when below 40% HP, all incoming damage is halved
Knight
Weapon: Sword (12 dmg) — Flask: Mana Flask (20 MP × 3)
A durable tank who punishes attackers. High defend rate and reliable damage output.
- Light attack — every 3rd swing triggers a Charged Strike for 1.4x damage
- Heavy attack — 1.5x damage, costs MP
- Defend — costs 16 MP, blocks with 90% damage reduction
- Special ability — costs 30 MP, delivers a 2x damage strike
- Armor passive — reflects 15% of received damage back at the attacker
Wizard
Weapon: Bow (15 dmg) — Flask: Mana Flask (30 MP × 3)
A glass cannon with the highest damage ceiling and a unique mana-shield defense.
- Light attack — every 4th shot triggers a Charged Strike: fires twice at 1.4x
- Heavy attack — 1.3x damage, costs MP
- Defend — costs 15 MP, blocks with 60% damage reduction
- Special ability — costs 20 MP, fires an empowered 1.6x shot and restores 10 HP
- Armor passive — every 10 MP absorbs 1 incoming damage (as long as armor holds)
Enemies
| Enemy | HP | MP | Special |
|---|---|---|---|
| Goblin | 80 | 100 | Always attacks at 1.8x multiplier |
| Skeleton | 70 | 100 | Revives at 35 HP the first time it dies |
| Vampire | 90 | 90 | Lifesteals 30% of damage dealt each attack |
| Dragon | 200 | 150 | Every 3rd attack is an unavoidable Fire Breath at 2x damage |
Architecture
The project is structured around a clean inheritance hierarchy:
Entity (interface)
├── Player (abstract)
│ ├── Assassin
│ ├── Knight
│ └── Wizard
└── Enemy (abstract)
├── Goblin
├── Skeleton
├── Vampire
└── Dragon
Item (interface)
├── Weapon (abstract)
│ ├── Sword
│ ├── Bow
│ └── Dagger
├── Armor (abstract)
│ ├── KnightArmor
│ ├── WizardArmor
│ └── AssassinArmor
└── Consumable (abstract)
├── Flask
└── RepairKit
Location
Game (orchestrator)