Question
The following C++ program is going to revolve around creating and using the Gladiator struct, which will contain statistics about their performance in combat. Gladiators
The following C++ 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 theyre 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 when defending
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
E.X. Min 30, range 50 would result in damage between 30-80
struct gladiator { };
Write a C++ program that performs the following:
1. Tell the user that they are going to be hosting a fight! But first, we need to
2. Prompt the user for a name, which is then sent to the createGladiator(string) function
a. 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, 10, or 15%
- Minimum Damage should be in the range 8-14, with Damage Range in the range 16-22
b. 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.
c. Include the option in createGladiator to load an existing gladiator from a file, as well as an option to save the victor of any given fight to a file. A hard-coded or user-input filename are both acceptable
3. Repeat step 2 once to obtain the second gladiator for your fight
4. 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 Bs current health by the amount of attack damage. (Why is B a reference variable?) Crits and misses should both be reported. (A and B provided only for illustration purposes)
5. Once one of the fighters have their health reduced to 0 or below, they have been defeated. Tell the user about who won the fight, along with any combat statistics you would like to track.
6. Ask the user if they would like a rematch with the same fighters. If so, go to step 4.
7. Ask the user if they would like to set up another fight with new fighters. 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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started