Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You will create a simple class hierarchy as the basis for a fantasy combat game.

ID: 3666363 • Letter: Y

Question

You will create a simple class hierarchy as the basis for a fantasy combat game. You need to create a Creature class. Then you will have a subclass for each of these characters. Note that the Creature class will be an abstract class. You will never instantiate one. Your ‘universe’ contains vampires, blue men, and harry potter.

2d6 is rolling two 6-sided dice, for example.

Vampire

Attack = 1d12

Defense = 1d6*Charm

Armor =1

Strength points = 18

Charm- Vampires can charm an opponent into not attacking. For a given attack there is a 50% chance that their opponent does not actually attack them

Blue Men

Attack = 2d10

Defense = 3d10

Armor = 3

Strength points = 12 *Mob

Mob- The Blue Men are actually a swarm of small individuals. For every 4 points of damage (round down) they lose on defense die. For example, when they reach strength of 8 they only have 2d6 for defense.

Harry Potter

Attack = 2d6

Defense = 2d6

Armor = 0

Strength points = 10 or 20 depending on Hogwarts

Hogwarts- If Harry dies (i.e. strength =< 0) he immediately recovers. His total strength becomes 20. If he were to die again then he’s dead.

To resolve an attack you will need to generate 1, 2, or 3 dice rolls. The attacker rolls the appropriate number and type of dice under Attack. The defender rolls the appropriate number and type of dice under Defense. You subtract the Defense roll from the Attack roll. That is the damage.

Each class only has its own information or data. When O1 is fighting O2 your program should call O1’s attack function. It will return the damage inflicted. Then O2’s defense function will take the damage inflicted, then roll the specified dice and subtract the points for the defense. To apply the damage you subtract the Armor value. The result is then subtracted from the Strength Points. That value becomes the new Strength Points for the next round. If Strength Points goes to 0 or less then the character is out of the combat. If it receives 8 points of damage and rolls3 for it’s defense and has an armor of 3 it would take 8 subtract 3 and then 3 for the armor to receive 2 points of damage.

Explanation / Answer

#define ATTACKS 10 #include // cout endl #include // time #include "Creatures.h" using ncoop::Creature; using ncoop::Human; using ncoop::Demon; using ncoop::Cyberdemon; using ncoop::Balrog; using ncoop::Elf; using std::cout; using std::endl; void testCreature( Creature* ); int main( ) { cout setStrength(20); // mutator functions by reference testCreature(e); delete e; return 0; } // this function must take the Creature by reference to avoid the slicing problem void testCreature( Creature* c ) { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote