C代写:CIS2500 Rogue-like Part3

Introduction

代写一个Rogue-like的游戏,是C代写:CIS2500 Rogue-like的Part 3部分,Rogue-like属于RPG游戏中的一类,游戏最大的特点就是每次生成迷宫的都是随机的。

Problem

You will implement additional features to a simple “Rogue-like” computer game that was described in the CIS 2500: Assignment 2 Specification (further referred to as A2 Spec). You are encouraged to reuse your code from Assignment 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:

  1. Status bar and notifications
  2. Hallways
  3. Inventory, item stats, and item use
  4. Player and enemy stats
  5. 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:

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.

Player and Enemy Stats

Your program will be responsible for storing the basic stats required for combat. These are the:

  • Health points and attack rating of the hero
  • Health points, attack rating, and speed of each enemy on screen

Each of these values should be dynamic: they can be changed during gameplay. Every instance of an enemy should have their own set of stats that are capable of changing, without affecting the other enemies. The stats should be initialized when drawing the level as follows.

Combat

Your program should implement a basic combat system, as well as enemy movement (patrols). Combat should happen when the player attempts to walk on a tile an enemy is currently occupying. This check should happen before enemy movement, and the enemy should not move until after the combat sequence has taken place. Below is the combat algorithm.
If both the enemy and hero survive, then their stats should be updated. The enemy should continue their patrol.
If the hero’s health points drop below 1, the game executes the normal ending procedure.
If the enemy’s health points drop below 1, then the enemy should be removed from the game, a Kill event should occur, and the hero should move to the enemy’s tile.
Every enemy type has a specific movement pattern, called their patrol. A cycle occurs after the player presses a key, and after any resulting combat sequences. After completing all the cycles in a patrol, the patrol repeats. No enemies can walk on walls, doors, or items. In the case a cycle would place them on one, move them back. How/if the monster is to continue their patrol a design decision you are free to make - just document and justify it in your README. Each patrol is described below:

Aquator: No cycles. Monster does not move.
Bat: 1 cycle. Move in a random direction.
Snake: 4 cycles. 1: Move right. 2: Move right. 3: Move left. 4: Move left.
Zombie: 2 cycles. 1: Move up. 2: Move down.
Troll: 4 cycles. 1: Move up. 2: Move right. 3: Move down. 4: Move left.

Summary

完成Part3的各种细节设定之后,就是完整的一个Rogue-like的游戏了。