Question: Tesk 1 Create a Player class, that represents a player. Put this in playercpy. Every Player has a name ( String ) , and a

Tesk 1
Create a Player class, that represents a player. Put this in playercpy.
Every Player has a name (String), and a health level (integer), and a manna level (integer). The health affects if you stay alive in the game, and the manna level affects how much you can wield a weapon to attack other players.
Create a constructor for Player that takes a String for the name, and initializes the health to 100 and manna to 100.
Create gelters for the name ( get_name()) and health (get_health()) and manna (get_manna())
Task2
Createa Potion class that represents a potion. Drinking a potion restores a Player's health. Put this in potion.pyEvery Potion has a name, and a benefit level (int), representing how many points it restores to a Player if the potion is drunk.
Create a constructor for Potion that takes a. String name, and and a benefit level, and initializes the name and benefit level for that potion. If the benefit level is not specified, the default value is 10(read about default arguments here).
Create a getter ( get_name ) that returns the name of the potion.
Create a getter ( get_benef it ) that returns the benefit level of the potion.
Create a drink method that
Returns the value of the benefit level of the potion, and
Reduces the benefit value of the potion to 0(after you drink a potion, it loses all potency).
 Tesk 1 Create a Player class, that represents a player. Put

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!