forked from AdvancedProgramming1404/HW-04-JAVA-KNIGHT
main
Benazam! It was a tough assignment and you handled it well. The console output had some issues, but you completed two of the bonus tasks. Overall, your work is excellent.(105/110 + 25/40)
⚔️ Java Knight: The Legend of Javanest
Java Knight is a turn-based, console-based RPG built in Java. Players take on the role of a hero tasked with saving the land of Javanest by defeating monsters, collecting mystical keys, and ultimately slaying the Dragon.
🚀 Quick Start
Prerequisites: Java JDK 8 or higher.
- Navigate to the source root:
cd your-project-folder/src - Compile the project:
javac org/project/Main.java - Run the game:
java org.project.Main
⚙️ Game Mechanics
- Progression & XP: After each victory, your HP and Mana are fully recovered. Defeating enemies grants Experience Points (XP).
- The Shop: Between fights, you can visit the inventory to convert XP into permanent stat upgrades. 1 XP can be exchanged for either 1 Max HP or 1 Max MP.
- The Hunt for Keys: To reach the end-game, you must collect three unique keys (Goblin, Skeleton, and Vampire). These have a chance to drop after defeating the respective enemy type.
- The Castle: The path to the final boss is locked until all three keys are in your possession. Only then can you enter the castle to face the Dragon.
🎮 How to Play
Hero Classes
- Knight: Balanced stats with high-damage melee capabilities.
- Assassin: High stamina/mana efficiency with lower costs for defending.
- Wizard: High mana pool and powerful magical abilities.
Combat Actions
On your turn, choose one of the following:
- Light Attack: Moderate damage; costs 0 Mana.
- Heavy Attack: High damage; costs Mana.
- Special Ability: Unique class-based move; highest Mana cost.
- Defend: Reduces or blocks the next enemy attack; costs Mana.
- Heal: Restores HP during combat; costs Mana.
🛠 Technical Architecture & OOP Principles
This project demonstrates core Object-Oriented Programming principles:
- Inheritance: Uses hierarchies for
Player(Knight/Wizard/Assassin) andEnemy(Goblin/Skeleton/Vampire/Dragon) to share common logic while allowing unique overrides. - Polymorphism: The combat engine handles any
Entityimplementation. TheWeaponsystem allows different damage behaviors to be executed through a single interface. - Encapsulation: Core stats like HP, Mana, and XP are protected. Data integrity is maintained through getters, setters, and specialized methods like
takeDamage()andreduceMana(). - Abstraction: The
Weapon,Enemy, andPlayerclasses are abstract, ensuring that specific game entities must follow a strict template while hiding the complexity of underlying calculations. - Interfaces: The
Entity,Item, andKeyinterfaces decouple behaviors from the class hierarchy, allowing for flexible interaction between different game objects.
- Born of God and Void. You shall seal the blinding light that plagues their dreams. You are the Vessel. You are the Java Knight.
Languages
Java
100%
