AA2 - Minimal RPG


Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due


AA2 - Minimal RPG
Program a minimal RPG game that runs in the windows console using C

Main Objective

Create a minimal RPG that places the player in a dungeon filled with enemies and riches

Evaluation

The assignment consists of 6 parts. Each part has a set of items that must be implemented to reach the maximum grade.
Player and enemies (1 point)
Player
The Player must have the following information and stats
Position

The position of the player must be stored as an X and Y coordinates.

It is recommended to create a struct called MapPosition to store this kind of information since it is also used with enemies and chests.

Gold
Used for the final score, gold represents the wealth of the character. Whenever a chest is opened or a weapon is looted we earn gold.
Health

Main resource of the character, if it reaches 0 the player loses the game. It does not regenerate between fights.

When creating the character, the health value must be initialized randomly between 90 and 110.

Stamina
Used in fights. It does not regenerate between fights.
Stamina is initialized randomly between 90 and 110.
Agility
Determines how many moves a player can do before all the enemies move.
All players start with 3 points of agility, translating into 3 moves before the enemies move.
Potions

The player can hold a maximum of 3 potions. Using a potion will restore 40% of the maximum health of the player.

Example: If I use a potion and I have 20 health out of 100, I will restore 40 health, setting my current health to 60.

Enemy
The Enemy must have the following information and stats
Position
The position of the enemy must be stored as X and Y coordinates.
It is recommended to create a struct called MapPosition to store this kind of information since it is also used with enemies and chests.
IsDead
Flag to store if the enemy is dead or alive. An enemy will always be spawned alive.
Health
Main resource of the character, if it reaches 0 the enemy dies.
When creating an enemy, the health value must be initialized between 60 and 90.
Stamina
Stamina is used in fights.
Stamina is initialized between 60 and 90.
Dungeon (2 points)
The dungeon is a 5 x 5 maze where the player can:
● See where the player, enemies and chests are located.
● Move around
● Use potions
Render
The dungeon must render in the console something resembling this layout:
As we can see the layout has the following elements:
1. Scene name
2. Legend of the map
3. Player stats
4. Map
5. Player actions
Movement
The player must be able to move when entering any of the WASD keys. Moving consumes 1 move. Remember that the max moves are determined by the player's agility.
● If a player wants to move left and already is on the left-most tiles of the map, the command will be invalid. The same goes for top, left and right commands.
● If a player moves into an enemy, the player will start fighting that enemy.
● If a player moves into a chest, the player will loot the chest.
● Looting a chest or fighting does not reset the player’s moves.
Potions
The player can use one move to consume a potion, healing the character for 40% of the max health value.

● If the player tries to use a potion without potions, it will count as an invalid move.

Any command entered other than W, A, S, D and P will be considered an invalid command and will ask the player to enter a new command without consuming agility.

Enemy Movement
When the player's agility reach 0, the enemies will move randomly.
● Enemies cannot move on top of non-looted chests.
● Enemies cannot move on top of the player.
● Enemies cannot move on top of each other if both are alive.

Main Manager (2 points)

The Main Manager is the element that coordinates the game behavior. It tracks the current game state (Fighting, in the dungeon, looting a chest…).

Extended flowchart: https://drive.google.com/file/d/15zO1wCf7bnpao8uNmVuHC1V6OcCQMlvT/view?usp=sharing

As we can see, there are 4 main scenes that are connected. The Main Manager must track the current scene and store any variables needed between the scenes themselves.

Spawning
The Main Manager is also responsible for the spawn of the player, enemies and chests.
Player
● The player will also spawn in the lower center of the dungeon.
● Only 1 player spawns
Enemies
● Between 5 and 7 enemies spawn
Chests
● Only 2 chests spawn
The player, enemies and chests cannot spawn on top of each other

Combat (3 points)

The combat is based on 3 actions:

● Attack (Consumes stamina for a set amount of damage)

● Defend (Regenerates 25% stamina and mitigates 75% of the incoming damage)

● Rest (Regenerates 100% stamina but leaves you vulnerable to attacks)

● Potion (Same conditions as previous descriptions)

If both characters attack, the one with the highest value will strike the other one and stamina is consumed.

Example: I attack with 50 stamina and the enemy attacks with 67 stamina.
● I receive 67 damage
● I lose 50 stamina used for the attack
● The enemy loses 67 stamina used for the attack.
Render
The combat should display
● Enemy stats (visual bars are required for maximum score)
● Player Stats (visual bars are required for maximum score)
● Player Actions
When the player enters an action, a combat log will appear at the bottom.
Once the fight has been simulated, the player should be asked for an input to refresh the screen.
Combat logic

Extended flowchart: https://drive.google.com/file/d/1q2y-RpqoCdRGLj0Dlr-G5sBXlfqhPJew/view?usp=sharing

If the player loses all the HP, the game will end. If an enemy loses all of its HP, the following things happen:

● If there are no more enemies or chests left, the game ends
● If there are still enemies alive or non-looted chests, the player goes back to the dungeon.
Enemy logic

The enemy will decide its combat action following this flowchart.

When attacking, the enemy will use between 20% of the max stamina and the current stamina level.

For example, an enemy with 100 stamina should never attack with less than 20 stamina.
Chests & Gear (1.5 points)
Gear

Gear are unique items that the player can find inside chests. Gear will modify the health, stamina and agility attributes of the player as well as having a gold value. This value counts towards the final score. Notice that gear can also reduce the player attributes!

Gear example:

Richard’s Hatred
| 200g value  
| +20 HP +40 Stamina +1 Agility
Swift boots 
| 10g value
| -10 HP -5 Stamina +1 Agility
White Powder
| 150g value
| -20 HP +20 Stamina +1 Agility
Radev’s Mug
| -300g value
| -20 HP -40 Stamina -1 Agility
Raven feather
| 50g value 
| -10 HP +2 Agility
Red Mushroom
| 170g value
| +30 HP
Ugly Facemask
| 10g value
| +5 HP
Broken Shield
| 25g value
| +10 HP
Green mushroom
| -50g value 
| -10 Stamina
Naughty book
| 69g value
|+7 Stamina

Chests
Chests contain gold, gear and sometimes a potion. They have the following attributes.
Position
Position of the chest in the dungeon.
It is recommended to create a struct called MapPosition to store this kind of information since it is also used with enemies and chests.
Gold
Amount of gold that the chest contains. Randomized between 50 and 200 gold.
IsLooted
Flag that indicates if a chest has been looted by the player. All chests are not looted when spawned.
Gear
Attributes of the gear that the chest contains.
ContainsPotion

Flag that indicates if the chest contains a potion. 25% of the chests contain a potion.

If a chest contains a potion the player will take it if there is enough room for it. If not, the player cannot take or use the potion inside the chest.

Render

Render of a chest that does not contain a potion
Render of a chest that contains a potion
The render parts are
1. Amount of gold
2. Gear data
3. Potion data

Victory / Defeat (0.5 points)

This last part is an end screen that is displayed when the character dies or clears the dungeon successfully.
Example of a defeat screen:
Example of a victory screen:

Remember that the score displayed is equal to the gold that the player has collected plus the value of the gear.

Requirements, delivery and sancions

● Delivery is due on January 17 at 23:55
● The work is done in pairs. These must be announced on 11/15/2024 in class. If a student does not have a partner, one will be randomly assigned to him/her.
● The name of the project must be:
- AA3_“Name1Surename1”_“Name2Surename2”_PROJECT.
● The name of the solution:
- AA3_”Name1Surename1“_”Name2Surename2”_SOL.
● The delivery must be done through Moodle by both members. Delivering the project with the solution and, optionally, a .txt with the nomenclature “README” if the student wants to clarify any detail of his work.
● Both the project and the .txt file must be compressed in a .zip file with the following nomenclature: AA3_”Name1Surename1”_”Name2Surename2”.zip
● The use of ChatGPT or similar is allowed for consultations on the subject, as long as the content is reviewed and never copied textually. If the teacher interprets that the code could have been generated with AI, he/she will interview the student to validate that the content is his/her own. Otherwise it will be counted as a copy and therefore a 0.
● The project must compile, otherwise it is automatically a 4.
● If the project has a fatal error during execution, -2 for each of them.

发表评论

电子邮件地址不会被公开。 必填项已用*标注