Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++, please include Vampire.h, Functions.cpp, BlueMen.h, Creature.cpp, Barbarian.h and exclude others Goals Identify requirements for a program using polymorphism Create a program to demonstrate

In C++, please include Vampire.h, Functions.cpp, BlueMen.h, Creature.cpp, Barbarian.h and exclude others

Goals

Identify requirements for a program using polymorphism

Create a program to demonstrate your class hierarchy

Requirements

In this project, you will create a simple class hierarchy as the basis for a fantasy combat game. Your universe contains Vampires, Barbarians, Blue Men, Medusa and Harry Potter. Each has characteristics for attack, defense, armor, and strength points as follows. Type

Attack

Defense

Armor

Strength Points

Vampire1

1d12

1d6* Charm

1

18

Barbarian2

2d6

2d6

0

12

Blue Men3

2d10

3d6

3

12 *Mob

Medusa4

2d6* Glare

1d6

3

8

Harry Potter5

2d6

2d6

0

10/20*Hogwarts

1. Suave, debonair, but vicious and surprisingly resilient!

2. Think Conan or Hercules from the movies. Big sword, big muscles, bare torso.

3. They are small (6 tall), fast and tough. So they are hard to hit and can take some damage. As for the attack value, you can do a LOT of damage when you can crawl inside the armor or clothing of your opponent.

4. Scrawny lady with snakes for hair. They help with fighting. Just dont look at her!

5. Why are you reading this? How can you not know who Harry Potter is?

3d6 is rolling three 6-sided dice, 2d10 is rolling two 10-sided dice, etc.

*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.

*Glare: If a Medusa rolls a 12 in attack, then the target has looked her in the eyes and is turned to stone. The Medusa wins! If Medusa uses Glare on Harry Potter on his first life, then Harry Potter get back to life.

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

*Hogwarts: If Harry dies (i.e. strength <=0), he immediately recovers and his total strength becomes 20. If he were to die again, then hes dead.

NOTE: The sample creatures are unbalanced intentionally. This will help you in debugging your program! Some will win a lot, and others will lose a lot.

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 will subtract the Defense roll from the Attack roll. That is the damage to the defender.

Each class only has its own information or data. When O1 is fighting O2, your program should call O1s attack function. It will return the damage inflicted. Then O2s defense function will take the damage inflicted, roll the specified dice and subtract the damage points from 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. For example, if one object receives 9 points of damage and rolls 3 for its defense, and has an armor of 4 and strength point of 8, it would take 9 subtract 3, and then 4 for the armor, to receive 2 points of damage, and its new strength point will be 8-2=6.

You need to create a Creature base class. Then you will have a subclass for each of these characters. Note that the Creature class will be an abstract class. For our purposes right now, each subclass will vary only in the values in the table. It is part of your design task to determine what functions you will need.

To play the game, write a menu. Display five fighters by their names and prompt the user to select two fighters to fight one another. Students must account for two fighters of the same type. Randomly select one fighter to attack first. The fighters will take turns fighting each other until one's Strength point is zero or negative. (You do not have to display results of each round of fighting, but you can do that for the purpose of debugging.) Then display the winning fighter to the screen. Ask users to play again or exit the game. This is the first stage of a larger project. Please do not add any creatures of your own.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

How does clustering in unsupervised learning help in data analysis?

Answered: 1 week ago