Description
Using Structs
The following program is going to revolve around creating and using the “Gladiator” struct, which will contain statistics about their performance in combat. Gladiators have some information:
Name - How they’re referenced to the player, provided by the player
Max Health - The amount of HP a gladiator will start each fight with
Current Health - The amount of HP a gladiator has left before they have lost the fight
Evasion - The % chance (0-100) that the gladiator will completely avoid incoming damage
Critical - The % chance (0-100) that the gladiator will inflict twice the rolled damage when attacking the opponent (known as a crit)
Minimum Damage - The lowest amount of damage a gladiator can inflict with a successful attack
Damage Range - The most damage ABOVE Minimum Damage that the gladiator can inflict with a single, non-critical hit
Write a program that performs the following:
- Tell the user that they are going to be hosting a fight! But first, we need to…
- Prompt the user for a name, which is then sent to the createGladiator(string) function
- createGladiator should return a gladiator, after randomly generating them according to the following rules:
- Max Health should be 150, 200, or 250
- Evasion and Crit should be two independent values chosen from 5, 7.5, 10, 12.5, or 15%
- You may use numbers like 50 or 75 to represent the percentages for calculations, or alter your randomly generated values
- Minimum Damage should be in the range 8-14, with Damage Range in the range 16-22
- After stats have been assigned in createGladiator, show the user the stats that were created or loaded using a showStats(gladiator) function, then ask the user if they wish to accept or reject their fighter before the function ends. If they reject the fighter, generate a new set of stats, with the same rules listed under 2.a, under the same name.
- createGladiator should return a gladiator, after randomly generating them according to the following rules:
- Repeat step 2 once to obtain the second gladiator for your fight
- Once both fighters are obtained, they will take turns (starting with the first fighter) using the takeTurn(gladiator A, gladiator & B) function to attack each other. An attack by fighter A will reduce fighter B’s current health by the amount of attack damage. Crits and misses should both be reported. (A and B provided only for illustration purposes)
- Ask the user if they would like a rematch with the same fighters. If so, go to step 4.
- Ask the user if they would like to set up another fight. If so, go to step 2.
Menu input should accept either a single lowercase char or an integer, prompts should tell user what to enter.
Points:
2 - Documentation, readability, format
2 - Filename and Header
1 - Output testing
2 - Proper program flow (conditions, loops, functions, etc)
3 - Proper use of structs
Header
//Author: Eric May (your name)
//CPSC 121 Lab 8
//<MM/DD/YY> (Current Date)