# Fourth Assignment - Java Knight โš”๏ธ # Java Knight โš”๏ธ A turn-based RPG game written in Java using Object-Oriented Programming (OOP) principles. --- # ๐Ÿ“– Story For centuries, the land of **Javanest** lived peacefully until a powerful Dragon attacked the kingdom and cursed its people. The curse transformed innocent humans into terrifying monsters such as: - Skeletons โ˜ ๏ธ - Goblins ๐Ÿ‘น - Vampires ๐Ÿง› The Dragon hid inside its Castle and divided the three magical keys among the monsters. Your mission is to: - Defeat enemies - Collect all three keys - Become stronger through battles - Enter the Castle - Defeat the Dragon and save Javanest --- # ๐ŸŽฎ Game Features - Turn-based combat system - Different player classes - Enemy special abilities - Mana/Stamina system - Weapons and armors - Healing system - RPG progression mechanics - Object-Oriented design --- # ๐Ÿงฑ Project Structure ```text src/ โ””โ”€โ”€ org.project โ”œโ”€โ”€ entity โ”‚ โ”œโ”€โ”€ Entity.java โ”‚ โ”œโ”€โ”€ enemies โ”‚ โ”‚ โ”œโ”€โ”€ Enemy.java โ”‚ โ”‚ โ””โ”€โ”€ Skeleton.java โ”‚ โ””โ”€โ”€ players โ”‚ โ”œโ”€โ”€ Player.java โ”‚ โ””โ”€โ”€ Knight.java โ”‚ โ”œโ”€โ”€ item โ”‚ โ”œโ”€โ”€ Item.java โ”‚ โ”œโ”€โ”€ armors โ”‚ โ”‚ โ”œโ”€โ”€ Armor.java โ”‚ โ”‚ โ””โ”€โ”€ KnightArmor.java โ”‚ โ”œโ”€โ”€ weapons โ”‚ โ”‚ โ”œโ”€โ”€ Weapon.java โ”‚ โ”‚ โ””โ”€โ”€ Sword.java โ”‚ โ””โ”€โ”€ consumables โ”‚ โ”œโ”€โ”€ Consumable.java โ”‚ โ””โ”€โ”€ Flask.java โ”‚ โ”œโ”€โ”€ location โ”‚ โ””โ”€โ”€ Location.java โ”‚ โ””โ”€โ”€ Main.java ``` --- # ๐Ÿง  OOP Concepts Used This project was designed using multiple OOP principles. --- ## โœ… Inheritance - `Knight extends Player` - `Skeleton extends Enemy` - `Sword extends Weapon` - `KnightArmor extends Armor` --- ## โœ… Abstract Classes Used to avoid duplicated code: - `Entity` - `Player` - `Enemy` - `Weapon` - `Armor` - `Consumable` --- ## โœ… Interfaces The `Item` interface is implemented by: - `Weapon` - `Armor` - `Consumable` --- ## โœ… Encapsulation Important fields such as: - HP - Mana - Defense - Durability are protected/private and accessed using getters. --- ## โœ… Polymorphism Methods like: - `attack()` - `use()` - `takeDamage()` behave differently depending on the object type. --- ## โœ… Method Overriding Examples: - `attack()` - `takeDamage()` - `uniqueAbility()` are overridden in subclasses. --- # โš”๏ธ Player Class ## Knight The Knight is a powerful melee fighter with: - High damage - Strong defense - Heavy attacks - Shield abilities ### Knight Abilities - Light Attack - Heavy Attack - Defend - Heal - Special Ability (Shield Bash) --- # ๐Ÿ‘น Enemies ## Skeleton โ˜ ๏ธ ### Special Ability Can revive once with 50% HP after dying. --- # ๐Ÿ›ก๏ธ Items ## Weapons ### Sword โš”๏ธ - Deals damage to enemies - Has a special ability attacking multiple targets --- ## Armors ### KnightArmor ๐Ÿ›ก๏ธ - Reduces incoming damage - Has durability system --- ## Consumables ### Flask ๐Ÿงช - Restores player health --- # โค๏ธ Combat System The game uses a turn-based combat system. Example combat loop: ```java while (player.isAlive() && enemy.isAlive()) { player.attack(enemy); if (enemy.isAlive()) { enemy.attack(player); } } ``` --- # โ–ถ๏ธ How to Run ## Compile ```bash javac src/org/project/Main.java ``` ## Run ```bash java org.project.Main ``` --- # โ˜• Requirements - Java JDK 21 or newer - IntelliJ IDEA or any Java IDE --- # ๐ŸŽจ Console Output The game uses terminal messages to display: - Attacks - Damage - Healing - Mana usage - Enemy actions Example: ```text โš”๏ธ Knight used Heavy Attack! ๐Ÿ’€ Skeleton revived with 50% HP! ๐Ÿงช Flask healed the player! ``` --- # ๐Ÿš€ Future Improvements Possible future features: - Goblin enemy - Vampire enemy - Dragon boss - XP and Level system - Inventory system - Merchant/shop system - Multiplayer mode - PvP mode - ANSI colored terminal output --- # ๐Ÿ‘จโ€๐Ÿ’ป Developer Notes This project was developed as the Fourth Assignment for Advanced Programming. The main goal of the project is practicing: - Clean architecture - OOP design - Java inheritance hierarchy - Combat system implementation --- # ๐Ÿ† Final Goal Collect all three keys, enter the Castle, defeat the Dragon, and save the land of Javanest. ###### - Born of God and Void. You shall seal the blinding light that plagues their dreams. You are the Vessel. You are the Java Knight.