Name: Adam Curley
BUID: U63497650
Name: Lei Huang
BUID: U67278956
Name: Sahana Subramanya Kowshik
BUID: U43929102
Classes
- Main: The main class that calls startGame of LegendsGame class.
- RPGGame: An abstract class that stores common attributes to all role-playing games.
- ValorGame: Implements main logic for the "Legends of Valor" game. Contains methods to start the game, create monsters, and fight.
- Player: An abstract class stores attributes and functions common to all players.
- ValorPlayer: Class to create players.
- Heroes: An abstract class that stores common attributes and functions to all heroes.
- Warrior: Class to create an instance of a warrior.
- Sorcerer: Class to create an instance of a sorcerer.
- Paladin: Class to create an instance of a paladin.
- Monsters: An abstract class that stores common attributes and functions to all monsters.
- Dragon: Class to create an instance of a dragon.
- Exoskeleton: Class to create an instance of an exoskeleton.
- Spirit: Class to create an instance of a spirit.
- Cell: An abstract class that holds attributes to create a cell.
- CellFactory: Used to implement the factory pattern to create a map using cells.
- PlainCell: Class to create a plain cell.
- NexusCell: Class to create a nexus cell.
- InaccessibleCell: Class to create an inaccessible cell.
- CaveCell: Class to create a cave cell.
- BushCell: Class to create a bush cell.
- KoulouCell: Class to create a koulou cell.
- Board: An abstract class that holds attributes and functions common to all RPG games.
- ValorBoard: Class to create a map/board. Contains methods to create boards, add players and move them.
- Market: Class to create a market. Has methods to create and display all market items, and buy/sell items.
- MarketItems: An abstract class that holds common attributes to all items.
- Armory: Class to create armories.
- Weaponry: Class to create weapons.
- Potions: Class to create potions.
- Spell: An abstract class that holds common attributes to all spells.
- FireSpell: Class to create a fire spell.
- IceSpell: Class to create an ice spell.
- LightningSpell: Class to create a lightning spell.
Interfaces
- Game: Stores common attributes to all games.
- isAccessible: To check if a cell is accessible.
- isBuyableSellable: To check if an item can be bought or sold.
- isCastable: To check if an item is castable. Implements default method use to cast a spell.
- isDrinkable: To check if an item is drinkable. Implements default method use to drink the potion.
- isUsable: To check if an item can be used.
- MarketInterface: Used with Market class to implement Facade Design Pattern to create a market.
Helper classes
- GameFunctions: Contains the functions that are used to drive the game. This includes getting input and getting a boolean (of an event occurring) based on the given probability.
- GameConstants: Contains the constants used in the card games. This includes a constant to set board size.
- Music: Used to play music.
- ASCIIArtGenerator: To create ASCII art. Taken reference from "https://www.quickprogrammingtips.com/java/ascii-art-generator-library-in-java.html".
- Parser: Used to parse the input for config files and music files.
- Display: Used to display map/board, heroes, monsters, legend, and list of armories, weapons, potions, and spells.
Assumptions
- If a hero dies, he gets respawned at the nexus with half his health.
- A hero is assumed to be able to hold one weapon and one armor at a time.
- A hero can hold any number of potions or spells of the same level.
- After the fight, the hero gets coins equal to monster's level * 100.
Design Patterns
- Factory Pattern: Factory pattern is implemented in the ValorBoard class to create cells of type nexus, plain, cave, bush, koulou and inaccessible using CellFactory class.
- Facade Pattern: Facade pattern is implemented to create the market. The main intention to use the facade pattern here is to allow the creation of market items only using the market object. This is achieved using MarketInterface.
Bonus Features
- Implemented 2 design patterns
- Added ASCII text art
- Added color to the text
- Added sound to the game
- Implemented a parser class to parse the config files
- Implemented level up
- A different game board is generated in every game. Apart from nexus and inaccessible cells, other cells (bush, cave and koulou cell) are added with 0.2 probability.
Compile and run
Extract the zip file into a folder.
All the below commands are run in the extracted directory
- cd src
- javac Main.java
- java Main
How to Play
- Compile and run using the instructions mentioned above.
- Enter player name.
- Build the team by selecting the hero classes and the Id of the heroes.
- Use the map and the location to move around.
- Move (W/A/S/D)
- BackToNexus (B)
- Teleport (T)
- Check player Info (I)
- Check weapons Inventory (E)
- Show map (M)
- Quit (Q)
- Items can be bought and sold in a Nexus cell.
- Monsters can be fought using a weapon or casting a spell.
Note:
- The code only works with compile and run steps specified due to the path given to parse the config and music files. Does not run with Intellij or Eclipse.
- Config files are present in the Legends_Monsters_and_Heroes folder.
- There are 13 music files for sound at different stages.