Problem
You will implement additional features to a simple “Rogue-like” computer game that was described in the CIS 2500: request 2 Specification (further referred to as A2 Spec). You are encouraged to reuse your code from request 2, but don’t be afraid to rewrite portions of it.
It is assumed that the program described by this specification also follows the A2 Spec. In the event a requirement described in this document directly conflicts with another described in the A2 Spec, the requirement in this document is to be followed.
Description
Your program must implement all features described in the A2 Spec, in addition to the following:
- Status bar and notifications
- Hallways
- Inventory, item stats, and item use
- Player and enemy stats
- Combat
Refer to the following sections for the definition of each feature. As previously stated: In the event a requirement described in this document directly conflicts with another described in the A2 Spec, the requirement in this document is to be followed.
Status bar and notifications
During level loading, your program should reserve a blank line at the top and bottom of the screen. The program will use the top line for notifications, and the bottom line as a status bar.
The notification bar will be responsible for printing messages for the user. A message should be printed in this bar after an event occurs. Messages should automatically be cleared every time the player presses a key. The following tables document events, when they occur, and what message should be displayed.
The status bar will be responsible for displaying the hero’s health, potion count, attack, and inventory count. This information should be displayed at all times, and get updated each time the player presses a key. It should be formatted as follows:1
Health: [A], Potions: [B], Attack: [C], Inv: [D]/5
Where:
[A] is the hero’s current health
[B] is the hero’s current potion count
[C] is the hero’s current attack rating
[D] is the number of items in the hero’s inventory, excluding potions. The value has a maximum of 5.
Hallways
Your program should no longer teleport the hero when they step on a door. Instead, the hero will open the door, triggering a Door event, and be able to use Hallways to traverse the level.
During game initialization, before, during, or after your program draws rooms to the screen it should also draw hallways. Hallways, denoted by the symbol #, can be walked on by the hero. They should be drawn extending from doors, and should be generated in a manner that ensures every room is accessible by the hero through at least one path. Every door must have a hallway.
Notes:
- You can wrap hallways around the screen (similar to pacman mazes), if you want.
- Hallways can connect to other hallways.
- Hallways can have deadends, as long as there is some path that leads to every room.
- It’s easiest to map each door to its closest adjacent room.
- You can assume every room will have at least one door. You cannot assume the location of that door.
- Don’t forget to leave room for hallways when you draw your rooms, including the top and bottom edges of the terminal.
Inventory, item stats, and item use
Your program should keep track of items that the hero picks up during the game, and print out the players inventory at the end of the game underneath their gold. This print out should include the items stat. The stat should be randomly generated when parsing the level file, and fall within the specified range. The following is a list of items that can be added to the hero’s inventory.
The hero can have a maximum of 5 items in their inventory. In a case where a hero has 5 items in their inventory, and steps on an item that can be added to their inventory, a BagFull event should occur, and the item should be removed from the screen without it being added to the hero’s inventory.
Potions and gold can always be picked up by the hero, and should be added to the potion count and gold count respectively, instead of the inventory. When the game starts, the hero should start with 1 potion, and 0 gold.
Your program should now allow the player to use potions. Figure 1 describes the activity that should occur when the p key is pressed.
1 | Aquator: No cycles. Monster does not move. |