:::writing

# Javanest Adventure

## Overview

**Javanest Adventure** is a turn‑based console RPG written in Java.  
The player explores different locations, fights monsters, collects keys, and eventually unlocks the castle to confront the final enemy.

The game is inspired by classic text‑based RPGs and demonstrates core **object‑oriented programming (OOP)** concepts such as inheritance, abstraction, interfaces, and polymorphism.

---

# Story

The peaceful land of **Javanest** has fallen under a terrible curse.

A powerful **Dragon** has taken control of the kingdom and unleashed monsters across the land. Villages are abandoned, forests are haunted, and caves are filled with undead creatures.

The dragon locked itself inside the **Castle**, and the only way to enter is by collecting **three hidden keys** scattered among the monsters.

Your mission is simple:

- Explore the world
- Defeat monsters
- Collect the keys
- Enter the castle
- Defeat the dragon and free Javanest

---

# Game Features

## Turn-Based Combat

Combat is **turn-based**.  
Each round consists of:

1. Player turn
2. Enemy turn

The battle continues until either the player or the enemy dies.

---

## Player Actions

During each turn the player can choose one of the following actions:

1. **Attack** – perform a normal attack with the equipped weapon
2. **Use Skill** – perform a stronger ability depending on the player class
3. **Use Item** – consume a healing or utility item
4. **Defend** – reduce incoming damage
5. **Run** – attempt to escape the battle

---

## Exploration

The world contains several locations:

- Village (starting area)
- Forest
- Cave
- Dungeon
- Castle (final area)

Players can move between connected locations and may encounter enemies in dangerous areas.

---

## Keys and Progression

The **Castle is locked**.

To unlock it the player must collect **3 keys**.

Keys are obtained by **defeating enemies**.

Once all keys are collected, the player can enter the **Castle** and fight the final boss.

---

# Enemies

Enemies are represented by the abstract class `Enemy`.

Possible enemy types include:

- Skeleton
- Goblin
- Vampire
- Dragon (final boss)

Each enemy has different stats such as:

- Health
- Attack power
- Defense

---

# Player Classes

The player is represented by the abstract class `Player`, which implements the `Entity` interface.

Possible subclasses include:

- **Knight** – high defense and balanced attack
- **Wizard** – strong magic attacks and mana usage
- **Assassin** – fast and high critical damage

Each class has different abilities and combat strategies.

---

# Items

Items help the player survive and improve combat performance.

Types of items include:

- **Weapon** – increases attack damage
- **Armor** – increases defense
- **Consumable** – restores health or provides temporary effects

---

# Project Structure

Example structure of the project:

```
src/
 ├── Main.java
 ├── Entity.java
 ├── Player.java
 ├── Enemy.java
 ├── Location.java
 │
 ├── players/
 │   ├── Knight.java
 │   ├── Wizard.java
 │   └── Assassin.java
 │
 ├── enemies/
 │   ├── Skeleton.java
 │   ├── Goblin.java
 │   ├── Vampire.java
 │   └── Dragon.java
 │
 ├── items/
 │   ├── Item.java
 │   ├── Weapon.java
 │   ├── Armor.java
 │   └── Consumable.java
 │
 └── utils/
     └── ConsoleColors.java
```

---

# Console Colors

The game uses ANSI colors to improve readability.

| Color  | Usage               |
| ------ | ------------------- |
| Red    | Damage messages     |
| Blue   | Mana or defense     |
| Green  | Healing and success |
| Yellow | Warnings and keys   |
| Cyan   | UI information      |

Example:

```
System.out.println(ConsoleColors.RED + "You took 10 damage!" + ConsoleColors.RESET);
```

---

# How to Run the Game

### Compile

```
javac *.java
```

### Run

```
java Main
```

The game will start in the **Village** and the player can begin exploring.

---

# Gameplay Loop

Typical gameplay flow:

1. Player starts in Village
2. Moves to a new location
3. Random enemy appears
4. Combat begins
5. Enemy defeated → possible key drop
6. Repeat exploration
7. Collect 3 keys
8. Enter Castle
9. Fight the Dragon
10. Win the game

---

# OOP Concepts Used

This project demonstrates several core Java concepts:

- **Abstraction**
- **Inheritance**
- **Interfaces**
- **Polymorphism**
- **Encapsulation**

---

# Future Improvements

Possible future features:

- Inventory system
- Equipment upgrades
- Experience and leveling
- More enemy types
- More locations
- Boss mechanics
- Save/load system

---

# Author

Developed as a Java OOP project for practicing game architecture and object‑oriented design.
:::
