# Java Knight ⚔️
A turn-based RPG with Roguelike elements which can be run in the terminal.

### The Legend of Javanest :
For centuries, the land of Javanest lived in peace, until a magical Dragon attacked, plunging the realm into absolute darkness. With a wicked curse, the Dragon transformed the innocent people into horrific monsters: Goblins, Skeletons, and Vampires. Retreating to its impenetrable Castle, the Dragon divided the three keys to its lair and hid them among these cursed creatures. Now, it is your duty to step up and save the land. You must battle these monsters, recover the unique key from each monster type, and finally slay the Dragon to break the curse and restore peace to Javanest!

### Your Mission :
1️⃣ Explore dangerous lands inhabited by Goblins, Skeletons, and Vampires.</br>
2️⃣ Defeat these enemies to gain experience points (XP) and collect special Keys.</br>
3️⃣ Collect all three keys (Goblin Key, Skeleton Key, Vampire Key).</br>
4️⃣ Once all keys are collected, the path to the Dragon’s Lair will open.</br>
5️⃣ Face the Dragon in a final, epic battle. Victory means saving the world; failure means eternal darkness.</br>

---
## How to play ?
#### 1. Character Selection 👤</br>
At the start of the game, choose one of the following classes:</br>
**💂‍♀️Knight :** Balanced stats with high defense. Good for players who prefer a tank-like playstyle.</br>
**🥷Assassin :** High damage output but lower HP. Requires careful management of MP for critical hits.</br>
**🧙‍♂️ Wizard :** Powerful magic abilities capable of dealing massive area damage, but fragile in close combat.</br>
#### 2. Combat System🎮
Turn-Based Battles:</br>
Engage in turn-based combat against various enemies.

**Actions:**</br>
- Attack: Basic free attack.</br>
- Heavy Attack: Costs MP but deals double damage.</br>
- Defend: Blocks incoming damage completely (Costs MP).</br>
- Special Ability: Each class has a unique powerful move (e.g., Wizard’s fireball, Assassin’s backstab).</br>
- Heal: Restore HP using MP.</br>
- Restore Mana/HP: Use accumulated XP to refill resources.</br>
- Enemy AI: Enemies can attack, defend, use special abilities, or heal themselves.</br>
#### 3. Progression & Keys🔑
Killing specific types of enemies drops a corresponding key:</br>
Kill Goblins → Get Goblin Key.</br>
Kill Skeletons → Get Skeleton Key.</br>
Kill Vampires → Get Vampire Key.</br>
You must collect all 3 Keys to unlock the final stage.</br>
XP gained from battles allows you to restore health and mana during fights.
---

## 💻 Object-Oriented Programming Concepts Used
This project is built using the main concepts of Object-Oriented Programming (OOP) in Java. Let’s explain each one in a simple way.

### 1️⃣ Abstraction
Abstraction means defining the important structure first, and leaving the details for later.

**In this project :**</br>
The Entity interface defines what every living being in the game must be able to do (like attack, defend, and take damage).</br>
The Player and Enemy classes are abstract.</br>
They contain shared logic.</br>
But they leave some methods (like specialAbility) for subclasses to implement.

### 2️⃣ Inheritance
Inheritance allows one class to reuse properties and behaviors from another class.

In this project:</br>
Knight, Assassin, and Wizard inherit from Player.</br>
Goblin, Skeleton, Vampire, and Dragon inherit from Enemy.</br>
This means:</br>
All players can attack and defend (because they inherit from Player).</br>
But each one has its own unique special ability.

### 3️⃣ Polymorphism
Polymorphism means we can treat different objects as the same general type, but they behave differently.

**Example :**</br>
```bash
player.specialAbility(target);
```
Java decides at runtime which version to execute :</br>
- Knight’s ability</br>
- Wizard’s spell</br>
- Assassin’s strike


### 4️⃣ Encapsulation
Encapsulation means protecting the internal data of a class.

In this project:
-  Private Fields: Attributes like hp, mp, and xp in Player and Enemy classes are marked as private.
- Getters/Setters: Access to these variables is controlled via public methods like getHp(), setHp(), etc.


### 5️⃣ Interface
An interface works like a contract.

The Entity interface says that every entity in the game must implement:
```bash
attack()
takeDamage()
isAlive()
```
It doesn’t matter if it’s a Player or an Enemy — they must follow these rules.

---
## How to Run 🚀
- Clone the repository.</br>
- Open the project in your preferred Java IDE.</br>
- Ensure all packages (org.project.entity, org.project.location, etc.) are correctly structured.</br>
- Run the Main class.</br>

**Follow the on-screen instructions to begin your adventure and enjoy the game :)**

