# JAVA KNIGHT - Turn-Based RPG
A turn-based role-playing game with Roguelike elements that runs in the terminal.

---
## Story
The land of Javanese lived in peace until a magical Dragon attacked and transformed the people into monsters: Goblins, Skeletons, and Vampires. The Dragon hid three keys to its castle among these creatures. You must collect all three keys and defeat the Dragon to break the curse.

---
## How to play
### Run the Game

```bash
javac org/project/Main.java
java org.project.Main
```

### Classes(Starting States)
---

| Player   | HP | Damage | Weapon         | Armor               |
|----------|----|--------|----------------|---------------------|
| Knight   | 80 | 40     | Sword(15 dmg)  | KnightArmor(8 def)  |
| Wizard   | 70 | 60     | Wood(12 dmg)   | ClothArmor(3 def)   |
| Assassin | 60 | 50     | Dagger(14 dmg) | LeatherArmor(5 def) |

---
### Leveling System 

Gain XP from defeating enemies
100 XP needed to level up

level up : +10 Max HP, +5 Max MP , full heal
---
## Enemy Special Abilities
### Enemy Ability Effect

| Enemy    | HP  | Damage | Special Ability          |
|----------|-----|--------|--------------------------|
| Goblin   | 40  | 15     | 30% critical hit chance  |
| Skeleton | 50  | 15     | Revives once whit 50% HP |
| Vampire  | 55  | 15     | Lifesteal 50% of  damage |
| Dragon   | 150 | 35     | Fire breath(35 damage)   |

---
### Key System 

Each monster type has 20% chance to drop its key
Collect all 3 keys to fight the Dragon
---
### Controls
1.Light Attack | 2.Heavy Attack | 3.Defend
4.Heal         |5.Special       |6.Use Flask
---

* org/project/
* ├── Main.java
* ├── entity/
* │   ├── Entity.java (interface)
* │   ├── ICombatActions.java (interface)
* │   ├── players/
* │   │   ├── Player.java (abstract)
* │   │   ├── Knight.java
* │   │   ├── Wizard.java
* │   │   └── Assassin.java
* │   └── enemies/
* │       ├── Enemy.java (abstract)
* │       ├── Goblin.java
* │       ├── Skeleton.java
* │       ├── Vampire.java
* │       └── Dragon.java
* ├── item/
* │   ├── Item.java (interface)
* │   ├── weapons/
* │   │   ├── Weapon.java (abstract)
* │   │   ├── Sword.java
* │   │   ├── Staff.java
* │   │   ├── Dagger.java
* │   │   └── Claw.java
* │   ├── armors/
* │   │   ├── Armor.java (abstract)
* │   │   ├── KnightArmor.java
* │   │   ├── ClothArmor.java
* │   │   └── LeatherArmor.java
* │   └── consumables/
* │       ├── Consumable.java (abstract)
* │       └── Flask.java
* └── location/
*     └── Location.java
---
### Controls

| Key | Action          |
|-----|-----------------|
| 1   | Light Attack    |
| 2   | Heavy Attack    |
| 3   | Defend          |
| 4   | Heal            |
| 5   | Special Ability |
| 6   | Use Flask       |

---
## Console Colors (ANSI Codes)
### Color Code Usage

| Red    | \u001B[31m | Damage, enemies          |
|--------|------------|--------------------------|
| Green  | \u001B[32m | Healing, victory         |
| Yellow | \u001B[33m | Keys, level up, warnings |
| Blue   | \u001B[34m | Mana, defending          |
| Purple | \u001B[35m | Special abilities        |
| Cyan   | \u001B[36m | Player info, locations   |
| Reset  | \u001B[0m  | Reset to default         |

---
### Random Generation

| Element                  | Range                    |  
|--------------------------|--------------------------|
| Enemy count per location | 2-3                      |
| Enemy type               | Goblin/Skeleton /Vampire | 
| Key drop chance          | 20%                      |
| Critical hit (Goblin)    | 30%                      |
---
### Step Action

| 1 | Choose your class(Knight / Wizard/ Assassin)   |
|---|------------------------------------------------|
| 2 | Travel between locations                       | 
| 3 | Fight enemies to gain XP                       |
| 4 | Collect keys from Goblin,Skeleton, and Vampire |
| 5 | Unlock the Castle after collecting all 3 keys  |
| 6 | Fight and defeat the Dragon                    |
| 7 | Save Javanest and win!                         |
---
### Defense Calculation

| Scenario        | Formula                                 |
|-----------------|-----------------------------------------|
| Normal hit      | Final Damage = Damage-Armor Defense     |
| While defending | Final Damage =(Damage/2)- Armor Defense |
| Broken armor    | Final Damage = Damage(defense = 0)      |
---
### Armor Stats

| Armor        | Defense | Durability | Class    |
|--------------|---------|------------|----------|
| KnightArmor  | 8       | 20         | Knight   |
| LeatherArmor | 5       | 15         | Assassin |
| ClothArmor   | 3       | 10         | Wizard   |

---
### XP Rewards from Enemies

| Enemy    | XP Reward |
|----------|-----------|
| Goblin   | 50        |
| Skeleton | 60        |
| Vampire  | 70        |
| Dragon   | 200       |
---