This project aim to apply Open-closed principle and Design patterns
Snow Storm Company develops an RPG game "Fantastic World (FW)" on the PC. The major characters in this game are known as HERO and they have various kinds of characteristic. For example, Warrior focus on defence and Warlock target on magic damage. Each player in this game can play more than one hero. Currently, this game only has Warrior and Warlock. In the coming future, this game will be extended to support more kinds of hero such as healer. The following is the simplified class diagram of existing data maintained by FW.
As a system analyst of the Company, you are required to design and develop FW. You can get the source codes of above classes from Moodle. FW should provide the following functions:
- Create a Player.
- Add a hero (Warrior or Warlock) to the current player.
- Remove a hero from the current player.
- Select a player by using a player ID.
- Call a hero's skill by a hero ID.
- Show the detail information of current player.
- Change the player's name of the current player.
- Show all players.
- Set current player.
- Undo last command.
- Redo the last undone command.
- Show undo/redo list.
- Exit System.
Your system design should conform to the Open Closed Principle so that your design should easily be extended to support new heroes (for examples, healers, rangers etc..).
You MUST apply the following design patterns for your new system:
- Command pattern to provide the “create player”, “set current player”, “add hero”, “call hero skill”, “delete hero”, “show current player”, “display all players”, “change player’s name”. “undo”, “redo” and “show undo/redo list” functions
- Factory pattern or Abstract Factory Pattern to create different kinds of Command objects and different kinds of Player/Hero objects (e.g., Warrior object, Warlock object, Player object, etc.)
- Memento pattern to provide “Undo” and “Redo” functions on the “call hero skill” and “change player’s name” functions.