# Java Knight Game

## Project Overview
Java Knight is a text-based RPG game developed using Object-Oriented Programming (OOP) principles in Java. The player selects a character class, explores different locations, fights enemies, collects items, and tries to unlock the Castle by gathering keys.

The goal of the project is to demonstrate important OOP concepts such as inheritance, abstraction, polymorphism, and encapsulation while building a simple turn-based RPG system.

---

## Game Flow

### 1. Starting the Game
When the program starts, the player enters their name and selects a character class. The available classes are:

- Knight
- Assassin
- Wizard

Each class has different attributes such as health, mana, and combat abilities.

---

### 2. Main Game Menu
After character selection, the game enters a continuous game loop where the player can choose between several actions.

The menu options are:

1. Move
2. Fight
3. Show Inventory
4. Exit

These options allow the player to explore the world, battle enemies, manage items, or quit the game.

---

## Locations

The game world contains several locations that the player can visit:

- Village
- Forest
- Cave
- Castle

Different locations may contain different enemies and items. The Castle acts as a special location that can only be accessed after collecting the required keys.

---

## Combat System

Combat in the game is turn-based. When the player encounters an enemy and chooses to fight, they are presented with five possible actions:

1. Light Attack
2. Heavy Attack
3. Defend
4. Heal
5. Special Ability

The player performs an action, and then the enemy responds with its own attack. The battle continues until either the player or the enemy reaches zero HP.

---

## Enemy Types

The game includes several enemy types with different behaviors.

### Goblin
A fast enemy that focuses on critical strikes.

### Skeleton
Can resurrect once during battle with half of its maximum health.

### Vampire
Has a lifesteal ability that restores health when it attacks.

### Dragon
A powerful enemy capable of bypassing normal defense.

---

## Inventory System

Players can collect and manage items using an inventory system. The inventory stores different types of items such as:

- Weapons
- Armors
- Consumables
- Keys

Examples of items include swords, daggers, staffs, armor sets, healing flasks, and keys required to unlock the Castle.

---

## Object-Oriented Design

### Inheritance
The project uses inheritance to organize game entities.

Examples:
- Player → Knight, Assassin, Wizard
- Enemy → Goblin, Skeleton, Vampire, Dragon
- Item → Weapon, Armor, Consumable

---

### Abstraction
Several base classes are abstract to define shared behavior without implementing full functionality.

Examples:
- Player
- Enemy
- Item

Subclasses provide specific implementations.

---

### Polymorphism
Different characters and enemies override methods such as attacks or special abilities, allowing each class to behave differently during combat.

---

### Encapsulation
Attributes such as health, mana, defense, and damage are protected within classes and accessed through getters and setters.

---

## Random Enemy Spawning

Enemies appear randomly depending on the location the player moves to. Each location has its own pool of possible enemies, and one may spawn when the player enters that location.

---

## Winning Condition

To win the game, the player must:

1. Explore locations and defeat enemies
2. Collect the required keys
3. Unlock the Castle

The game ends either when the player defeats the final challenge or when the player's HP reaches zero.

---

