Starting from:
$35

$29

Project #3 Fantasy Combat Game Solution

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-sidedonedie,12 and “2d6” means-sided dice,rolling 2 6 etc.













Type
Attack
Defense
Armor








Vampire1
1d12
1d6* Charm
1








Barbarian2
2d6
2d6
0








Blue Men3
2d10
3d6
3








Medusa4
2d6* Glare
1d6
3








Harry Potter5
2d6
2d6
0












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










Type Characterstics Special Abilities




Vampire
Suave, debonair, but vicious and surprisingly
Charm: Vampires can charm an o


resilient.
For a given attack there is a 50%




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.
Mob: Blue Men are actually a swa


They are hard to hit so they can take some
For every 4 points of damage, the


damage. They can also do a LOT of damage
For example, if they have a streng


when they crawl inside enemi 2d6 for defense.


clothing.








Medusa
Scrawny lady with snakes for hair which helps
Glare: If a Medusa rolls a 12 whe


her during combat. Just don’ instantly gets turned into stone an




uses Glare on Harry Potter on his




comes back to life.






Harry Potter
Harry Potter is a wizard.
Hogwarts: If Harry Potter's streng




immediately recovers and his tota




he were to die again












Note:




If Medusa uses “glare” on Harry Potter on his first life, to life after using “hogwarts”.



If the Vampire’s “charm” ability activates when Medusa use charm trumps Medusa’s glare.



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










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 = attacker’sroll–defender’s–defender’sroll armor




Then the value of that damage is subtracted from the defende










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 shouldattack callfunctionA’s,which should return the damage attacked. ThendefenseO2’sfunction will take the damage attacked, and calculate the




actual damage inflicted, and apply that damage to the defender’




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 defender’s defend dice roll.
The total inflicted damage calculation.
The defender’s updated strength point amount after subtrac



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 add any 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.

More products