Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

A game designer is requesting you to develop a turn-based combat system between a player and an enemy. They have given you the following UML

A game designer is requesting you to develop a turn-based combat system between a player and an enemy. They have given you the following UML diagrams as an outline. Character +PlayerHP: int (default value = 30) +EnemyHP: int (default value = 30) +Speed: int (default value = 6) +Attack: int (default value = 2) -Damage: int +Name: string +Potions: int (default value = 3) +Character() +Character(int HP, int Speed, int Attack, string Name, int Potions) +Assign +Move1(double) (return type: int) +Move2(double) (return type: int) +Move3(double) (return type: int) +Healing(int) (return type: int) +SpeedCheck(int player, int enemy) (return type: int) +GetDamage() (return type: int) +GetCurrentHP() (return type: int) +OutputStats(return type: void) +SetEnemyHP(int) (return type: int) +SetPlayerHP(int) (return type: int) From this information, perform the following requirements. Instantiate an Character Object named Player using the default constructor. o Have the user input a name to set the Player name inside of the constructor. Instantiate an Character Object named Enemy using the overloaded constructor o Set the HP of the enemy to 20. o Set Speed equal to 2. o Set Attack equal to 1. o Set Name equal to "Goblin". o Set Amount of enemy Potions equal to 0. After Instantiating both objects, create a while loop inside that will perform the follow actions until the game ends. o Show the stats of both the Player and Enemy. If the Player is faster than the Enemy perform the following actions Output the names of the 3 move, then have the user select one by using a switch command to select between Move1, Move2, or Move3. Move1 will deal 3 * Attack

Move2 will have you attempt to attack 5 times, with a 50% chance of missing each time. Output the amount of time you were successful, then multiply the amount of hits by your attack. Move3 will do 10 * Attack, but have a 25% chance of hitting, and a 75% chance of doing 2 damage to yourself. After Selecting a Move, perform a damage calculation by using GetDamage(), then Update the HP of the defending Enemy using SetEnemyHP(). o If the Enemy is faster than the Player, have them use the same moveset, but set it to a random number generator where each move has a 33% chance of being used. Check to see if EnemyHP and PlayerHP is equal to or Greater than 0, if both are greater than 0, continue the loop. o If EnemyHP 0 & PlayerHP > 0, output a statement saying that the Player has won. o If PlayerHP 0 & EnemyHP > 0, output a statement saying that the Player has lost. o If PlayerHP 0 & PlayerHP 0, output a statement saying that the match was a draw.

In C# please make sure game ends due to conditions for like

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions

Question

Explain the process of MBO

Answered: 1 week ago