This is the challenge document for the challenge called ChallengeHeroMonsterClasses Part 1. In this challenge, you will be creating a game of sorts, in which a hero and monster perform a battle against each other. To successfully complete this challenge you will need to create a class and supply it with properties and methods. Included in the challenge code folder is a more specific set of instructions for this challenge.
To begin, you will need to create a project called ChallengeHeroMonsterClassesPart 1. Then, create a Character class which will have four properties:
You will determine on your own what data types are appropriate for these properties.
There will be two methods for the Character class: Attack() and Defend().
Attack() requires no input parameters, but will return an integer value. You should implement the Random class to determine a random number to be returned from this method.
The Defend() method will take an integer representing damage as an input parameter. It will deduct this damage value from the Character's current health.
You will create two instances of the Character class in the Page_Load event: hero and monster. You are allowed to determine what to set their properties to; whatever Health, DamageMaximum, etc.
Then, perform two sides of the battle in the Page_Load. Each character should attack once, and be attacked once. In each case, the other character should defend or attack, as fits the situation. Only perform one round, no need to loop this multiple times.
Finally, create a helper method in the Default class that is responsible for displaying the stats (all of the properties) of each of the characters after the battle has been performed. These stats will be displayed via Label server control. You should pass in a character as an input parameter for the method so it can determine which character's stats to display.
This is a large challenge, but if you break it down into steps and think through each one individually, it should become much more manageable. Do what's required and don't over-complicate it. If you find that you want to do more, that's fine. Have fun with it, but just make sure to meet the requirements of this challenge.
If you find you're having difficulty completing this challenge, refer to the solution document for it. As always, only use it as you need and do your best to complete it on your own. Good luck!
Challenge - Hero Monster Classes Part 1