Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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).
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

Students also viewed these Databases questions