Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE READ CAREFULLY!! THIS IS C++!! PLEASE INCLUDE OUTPUT!! I RATE AND COMMENT!! Fantasy Combat Game Goals Develop classes from program requirements Implement characters using

PLEASE READ CAREFULLY!! THIS IS C++!! PLEASE INCLUDE OUTPUT!! I RATE AND COMMENT!!

Fantasy Combat Game

Goals

Develop classes from program requirements

Implement characters using polymorphism

Implement a menu to allow the user to test the characters

In this project, we will develop a fantasy combat game. This is going to be part 1 of the game development in which we develop the characters and a menu to test the characters.

Requirements

Characters

Our game universe contains Vampire, Barbarian, Blue Men, Medusa, and Harry Potter. Each character has attributes of attack, defense, armor, and strength points.

The table containing the attributes data is shown below.

Note: 1d12 means rolling one 12-sided die, and 2d6 means rolling 2 6-sided dice, etc.

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

The characters also have their own characteristics as well as special abilities:

Type

Characterstics

Special Abilities

Vampire

Suave, debonair, but vicious and surprisingly resilient.

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.

Barbarian

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

Blue Men

They are small, 6 inch tall, but fast and tough. They are hard to hit so they can take some damage. They can also do a LOT of damage when they crawl inside enemies armor or clothing.

Mob: Blue Men are actually a swarm of small individuals. For every 4 points of damage, they lose one defense die. For example, if they have a strength of 8, they would have 2d6 for defense.

Medusa

Scrawny lady with snakes for hair which helps her during combat. Just dont look at her!

Glare: If a Medusa rolls a 12 when attacking then the target instantly gets turned into stone and Medusa wins! If Medusa uses Glare on Harry Potter on his first life, then Harry Potter comes back to life.

Harry Potter

Harry Potter is a wizard.

Hogwarts: If Harry Potter's strength reaches 0 or below, he immediately recovers and his total strength becomes 20. If he were to die again, then hes dead.

Note:

If Medusa uses glare on Harry Potter on his first life, then Harry Potter comes back to life after using hogwarts.

If the Vampires charm ability activates when Medusa uses glare, the Vampires charm trumps Medusas glare.

The sample characters are unbalanced intentionally. This will help you in debugging your program! Some will win a lot, while others wont.

Gameplay

Each combat between 2 characters ends when one of the characters die.

Each round consists of two attacks, one for each character. For each attack, attacker and defender both generate dice rolls. The type and number of dice is listed above in the table.

The actual damage inflicted from the attacker onto the defender is calculated as follows:

Damage = attackers roll defenders roll defenders armor

Then the value of that damage is subtracted from the defenders strength points.

Example: character A attacks with dice roll of: 8 10, which means it has an attack of 18, and character B defends with dice roll of 5 6, which means it has defense of 11, character B also has an armor of 3. So the actual damage inflicted from A to B is 18 11 3 = 4.

If character B has strength point of 8 during that round, the new strength point would be 8 4 = 4, which means next round B will have strength point of 4.

If character B has strength point of 3 during that round, the new strength point would be 3 4 = -1, which means character B dies.

Note: Deciding who starts attacking is your own design decision.

Class

The program should contain a Character base class. The base class should be an abstract class. All the characters should have their own subclass that inherits from the Character class.

Each class should only have its own information or data. For example, when A attacks B, the program should call As attack function, which should return the damage attacked. Then O2s defense function will take the damage attacked, and calculate the actual damage inflicted, and apply that damage to the defenders strength points.

You can add whatever you want to the parent class but it must include an attack function and defense function. Also, the subclass should not have dependencies on which type of character the attacker is. For example, It is not an acceptable solution to have an external function check if the attacker is Medusa if a 12 is rolled; the special traits must happen within the character classes themselves.

Menu

To be able to test and play the game, write a menu. The menu should display five characters by their names, and prompt the user to select two characters to fight one another. You must account for two characters of the same type, so Vampire can fight Vampire, etc. For each round, display the results of each round on the screen so you and your grading TA can verify that calculations are correct and the game is functioning properly.

The following information must be displayed for each attack:

Attacker type.

Defender type, armor, strength point.

The attacker's attack dice roll.

The defenders defend dice roll.

The total inflicted damage calculation.

The defenders updated strength point amount after subtracting damage.

After the combat is over, ask users to:

Play again

Exit the game

Note: This is the first part of the larger project, please do not addany characters of your own.

Reflection Document

The requirements for the reflection document have been specified in the Project 1 document.

Make sure your document has design descriptions, test tables, and reflections. The reflections include: changes in design, problems encountered, and how you solve those problems. Additionally, the reflection document should include a class hierarchy diagram.

Suggestion

Create your design before coding anything! You should even be outlining your test plan. The grading is set up to encourage you to develop your program incrementally! Start with the base and Barbarian classes. Create the testing program that runs sample combats for you to test your code. How do you handle random die rolls when testing your code? At each step of the coding process, make notes about what worked, what has been changed from your design. Doing this will make writing the reflections easier.

Note: this project involves a lot of details and many are not specified as requirements here. In this case, they will be your design decisions. You can include these decisions in your reflection documents. If you are still not sure whether something is allowed or which is the proper way to go, post your question on Piazza and TAs will clarify it.

What you need to Submit

All the program files including header and source files (.cpp/.hpp)

makefile

Your reflection pdf file

Important: Put all the files in a single .zip file and submit it on Canvas.

Grading

Programming style and documentation (10%)

In each of these, the virtual attack and defense functions must work correctly:

Create the base class (10%)

Create the Barbarian class (10%)

Create the Vampire class, override defense function (10%)

Create the Blue Men class (10%)

Create the Medusa class, override attack function (10%)

Create the Harry Potter class (10%)

Create a test driver program to create character objects which make attack and defense rolls required to show your classes work correctly (20%)

Reflections document to include the design description, test plan, test results, and comments about how you resolved problems during the assignment (10%)

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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

=+3. What level of candor are decision makers willing to receive?

Answered: 1 week ago