In C#; Program a simple turn-based RPG game where a player will fight an enemy until one wins. The program should be split into 4 different stages. Fighter class will include variables: Current...


In C#;


Program a simple turn-based RPG game where a player will fight an enemy until one wins. The program should be split into 4 different stages.



Fighter classwill include variables: Current Health, Max Health, whether the fighter is dead, a reference to another fighter, an opponent.


Fighter class will also need methods to handle different things the fighters can do:


-a method for taking damage (decrease current health by a given amount, call death function if health reaches 0)
-a method for when the fighter dies (set its "dead" variable to true)
-a method for taking an action, which will be overridden by the Player and Enemy classes (the player will have a choice of options, while the enemy will simply attack the player)



Enemy classwill inherit from Fighter.


The Enemy class should override the TakeAction function mentioned previously so that it causes the Player (it's opponent) to take damage. Print to the console displaying what the enemy did, and how much damage was caused.



Player classwill also inherit from Fighter. Will include variables for stock of potions.


The Player's TakeAction version of the function should allow for a basic menu with choices such as:


1 - Attack Enemy
2 - Drink Potion (2 remaining)


And each of these should lead to its own functions: AttackEnemy should inflict damage on the opponent, and DrinkPotion should restore some of the player's health. Do NOT allow the player to use a potion if they are out of them!



Main


In your program's Main, create a list of Fighters (the turn order), and create and add the combatants to it.


Create a game loop that will continuously go through the list of fighters, and execute each one's turn by calling the fighter's TakeAction method.


The game loop should continue until one fighter remains, and a victory/loss message should be displayed.

Apr 06, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here