Question: Tesk 1 Create a Player class, that represents a player. Put this in playercpy. Every Player has a name ( String ) , and a
Tesk
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 and manna to
Create gelters for the name getname and health gethealth and manna getmanna
Task
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 read about default arguments here
Create a getter getname that returns the name of the potion.
Create a getter getbenef 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 after you drink a potion, it loses all potency
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
