2026-04-29 22:44:56 +03:30
2026-04-29 17:47:45 +00:00
2026-04-29 22:44:56 +03:30

Fourth Assignment - Java Knight 🎮

A turn-based RPG inspired by Souls-like games which can be run in the terminal.

Prologue: 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!

Introduction

Welcome to Java knight, a turn-based RPG inspired by Souls-like games! In this assignment, you will develop a text-based role-playing game (RPG). This project is designed to rigorously test your understanding of Object-Oriented Programming (OOP) principles.

⚠️ MANDATORY REQUIREMENT: You must utilize all the OOP concepts you have learned so far—including Inheritance, Interfaces, Abstract Classes, Encapsulation, and Polymorphism. Your design and architecture will be heavily graded based on how well you apply these principles to avoid code duplication and maintain a clean structure.

What is a Turn-Based Game?

In this combat system, two sides - which are usually the player's side and the enemy's side - attack each other in turns. The side which is not attacking can perform actions to avoid or deflect the enemy's attack

Core Mechanics:

  • Turn-based combat Players and monsters take turns attacking each other.
  • Character classes Players can choose from archetypes like Knight, Assassin, or Wizard, each with unique stats.
  • Unified Mana/Stamina System All player classes use a unified resource (Mana/Stamina) to perform any action.
  • Standardized Action Set Every player character has exactly 5 specific actions available during their turn.
  • Dynamic Economy & Upgrades Earn coins based on enemy strength to buy weapons, abilities, or stat upgrades.
  • Progression System You cannot fight the Dragon immediately. You must farm enemies for a chance to drop their specific key, collect all three, and grow stronger first.

Tasks 📝

1️⃣ Step 1: Fork & Setup 🍴

  1. Fork this repository and clone it to your local machine.
  2. Create a new branch named develop and switch to it.

2️⃣ Step 2: Implement the Class Hierarchy 🌲

  • Entities & Locations: You have Entity, Object, and Location.
  • Players: Player is an abstract class implementing Entity. Subclasses: Wizard, Knight, Assassin.
  • Enemies: Enemy is an abstract class implementing Entity. Subclasses: Skeleton, Goblin, Vampire.
  • The Boss: Dragon extends Enemy (or is a distinct Boss interface/class), acting solely as the final boss.
  • Objects: Consumable, Armor, Weapon are abstract classes implementing Object. Subclasses: Flask, KnightArmor, Sword, etc.

3️⃣ Step 3: Implement Player & Monster Methods 🏹

Player Actions (The Rule of Five): Every player class must implement exactly the following 5 actions. Every action consumes a specific amount of Mana/Stamina. The Special Ability must consume the highest amount of Mana compared to the others.

  1. Light Attack: Deals moderate damage, low Mana cost.
  2. Heavy Attack: Deals high damage, medium Mana cost.
  3. Defend: Completely blocks or significantly reduces the damage of the enemy's next strike. Medium Mana cost.
  4. Heal: Restores a portion of the player's HP. Medium-high Mana cost.
  5. Special Ability: A unique class-based ultimate move (Highest Mana cost):
    • Wizard 🧙‍♂️: Casts a devastating spell that damages the enemy while simultaneously replenishing some HP.
    • Assassin 🗡️: Turns invisible, dodging the next incoming attack completely and guaranteeing a Critical Hit on their next turn.
    • Knight ⚔️: Performs a shield bash that stuns the enemy, forcing them to skip their next turn while dealing heavy damage.

Monster Abilities:

  • Goblin 👹: High critical hit chance but low health.
  • Skeleton ☠️: Can resurrect once per battle with 50% HP.
  • Vampire 🦇: Lifesteal ability a portion of the damage it deals to the player is added back to its own health.
  • Dragon (Final Boss) 🐉: Immune to normal defense. Its fiery breath bypasses shields and deals massive damage.

🔹 Narrative Console: Use ANSI escape codes to print colorful narrative logs (e.g., Red for damage, Blue for Mana usage, Green for healing).

4️⃣ Step 4: Implement the Game Loop, Progression & Economy 🎮

  1. The Core Loop: The game starts with the player entering a location. Immediately, a random standard enemy (Goblin, Skeleton, or Vampire) spawns.
  2. Player Choices: Before engaging, the player is presented with the following options:
    • 1. Fight the enemy: Enter the turn-based combat sequence.
    • 2. Move to another location: Skip the current enemy and spawn a new random one.
    • 3. Visit the Merchant: Go to the shop to spend coins on items or upgrades.
    • 4. Go to the Castle to fight the Dragon: (Note: This option must remain hidden or locked until the player has successfully collected all 3 keys).
  3. The Key Drop Logic (RNG Gatekeeping):
    • When the player defeats an enemy, there is a specific percentage chance (e.g., 20%) that it will drop the unique key associated with its species (Goblin Key, Skeleton Key, Vampire Key).
    • One Key Per Species: Once a player obtains a specific key (e.g., Goblin Key), subsequent enemies of that same type (other Goblins) will never drop a key again.
    • The player must collect all 3 distinct keys to unlock Option 4 and enter the Castle.
  4. Dynamic Economy & Upgrades:
    • When an enemy is defeated, the player receives Coins. The number of coins must scale with the enemy's power level/stats (stronger enemies drop more coins).
    • At the Merchant, players can buy:
      • Weapons/Armor: Increases base damage and defense.
      • Consumables: Health and Mana flasks.
      • Stat Upgrades: Permanently increases the Max HP Bar or Max Mana Bar (Crucial for surviving the Dragon).
  5. Final Boss Fight: Once the 3 Keys are obtained and the player chooses Option 4, they enter the Castle. Defeating the Dragon breaks the curse, resulting in Victory. Dying at any point results in Game Over.

5️⃣ Step 5: Extra Features & Bonus Tasks

(Optional for extra credit) Multiple Weapons & Inventory: Players can buy, store, and swap between multiple weapons mid-combat.
Leveling System (XP): Alongside coins, players gain XP. Leveling up automatically restores HP/Mana and slightly buffs base stats.
Multiplayer/Party Mode: Allow multiple players to team up. The Dragon's breath attack will damage the entire party simultaneously.


Evaluation Criteria ⚖

Criteria Points
Strict application of all OOP principles (Mandatory) 40
Correct class hierarchy & standard 5-action system 20
Working combat mechanics, Mana system & Enemy abilities 20
Game Loop (Merchant Shop, Scaling Coins, 4 Choices & RNG Keys) 20
Meaningful, interactive, & colored console outputs 10
Total Score 110

Submission

  • Deadline: Submit your assignment before May 9th, 2026.
  • Submission Format: Push your code to your forked repository, create a PR, and include a clear README.md.

Born of God and Void. You shall seal the blinding light that plagues their dreams. You are the Vessel. You are the Java Knight.
S
Description
A turn-based RPG with Roguelike elements which can be run in the terminal.
Readme MIT
7.1 MiB
Languages
Java 100%