68 lines
2.0 KiB
Markdown
68 lines
2.0 KiB
Markdown
# ⚔️ Java Knight A Turn-Based PRG
|
|
___
|
|
## 📜 A Little About the Game
|
|
Java Knight is a text-based role-playing game where you battle creatures to collect keys so you can unlock final game and save the old castle!
|
|
|
|
## 🎮 How to Play
|
|
**select your hero** - choose from 4 players : Joan of Arc (the Knight), Galahad (the knight), Harry Potter (the Wizard), Creed from Office (the Assassin)
|
|
|
|
**fight enemies** - choose any location and then their specific enemies will appear to fight !
|
|
|
|
**defeat the final boss** - once you collect all 3 keys you can face the Dragon
|
|
|
|
## 🌲 Class Hierarchy
|
|
Entity (Interface)
|
|
|
|
|
|
├── Player (Abstract Class)
|
|
|
|
│ ├── Knight
|
|
|
|
│ ├── Wizard
|
|
|
|
│ └── Assassin
|
|
|
|
│
|
|
|
|
└── Enemy (Abstract Class)
|
|
|
|
├── Goblin
|
|
|
|
├── Skeleton
|
|
|
|
├── Vampire
|
|
|
|
└── Dragon
|
|
|
|
## ✔ Where & How OOP Concepts Are Used
|
|
|
|
### 1. Encapsulation
|
|
|
|
Where | How
|
|
----- |-----
|
|
***Player Class*** | `hp`, `mp`, `isDefending` are `protected` - accessed via getters/setters
|
|
***Enemy Class*** | `damage`, `stunned`, `isDefending` are `protected` - accessed via methods
|
|
|
|
|
|
### 2. Inheritance
|
|
|
|
Parent Class | Child Classes | What Children Inherit
|
|
------------------ |-------------------------------------------| ----------
|
|
***Player*** | `Knight`, `Wizard`, `Assassin` | `hp`, `mp`, `defend`, etc.
|
|
***Enemy*** | `Goblin`, `Skeleton`, `Vampire`, `Dragon` | `hp`, `mp`, `stunned`, `defend`, etc.
|
|
|
|
|
|
### 3. Polymorphism
|
|
|
|
***Method Overriding***
|
|
|
|
Method | Parent Behavior | Child Behavior
|
|
------ | --------------- | --------------
|
|
`attack()` | Deals 5 Damage | Knight: 12 d, Wizard: 10 d, Assassin: 8 d
|
|
`specialAbility()` | Abstract | Knight: Sheild Bash + Stun, Wizard: Life Drain + Heal, Assassin: Invisibility
|
|
`heavyAttack()` | Abstract | Knight: 22 d, Wizard: 18 d, Assassin: 15 d
|
|
|
|
### 4. Abstraction & Interface
|
|
Player and Enemy Classes are Abstract Which Implement Entity as Interface.
|
|
|
|
Methods like `specialAbility()` (In Player and Enemy Classes) and `heavyAttack()` (Just Player Class) are abstract. |