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

Using C++: You will create a simple class hierarchy as the basis for a fantasy c

ID: 3760573 • Letter: U

Question

Using C++: You will create a simple class hierarchy as the basis for a fantasy combat game. Your ‘universe’ contains Goblins and Barbarians. Each will have characteristics for attack, defense, armor, and strength points.

Goblin (attack = 2d6, defense = 1d6, armor = 3, strength = 6)

barbarian (attack = 2d6, defense = 2d6, armor = 0, strength = 12)

example: 3d6 is rolling three 6-sided dice. 2d10 is rolling two 10-sided dice

To resolve an attack you will need to generate 2 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.

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. 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. For our purposes right now each subclass will vary only in the values in the table. Since each starts with the same data elements you will only need one constructor.


Explanation / Answer

combat.cpp:


main.cpp:

view sourceprint?

01 #include "Combat.h"
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