Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In Java plz Task 1 Create a Player class, that represents a player. Put this in Player.java. - Every Player has a name (String), and
In Java plz
Task 1 Create a Player class, that represents a player. Put this in Player.java. - 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 and manna to 100. - Create getters for the name (getName()) and health (getHealth()) and manna (getManna()) Task 2 Create a Potion class that represents a potion. Drinking a potion restores a Player's health. Put this in Potion.java. - Every 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 initializes the name of the potion, and initializes the benefit level to 10 . - Create a getter (getName()) that returns the name of the Potion. - Create a getter (getBenefit()) 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). Task 3 Create a Weapon class that represents a weapon. Getting hit by a weapon causes a reduction in the Player's health. Using a weapon reduces the Player's manna. Put this in Weapon.java. - Every Weapon has a name, and a damage level (int), representing how many points it reduces a Player's health if the Player is hit by it, and a cost to using it (int). - Create a constructor for Weapon that takes a String name of the weapon, and initializes the damage level to 0. - Create a getter (getDamage()) that returns the damage level of the weapon. - Create a getter (getName()) that returns the name of the weapon. - Create a getter (getCost()) that returns the cost of using the weapon. Every weapon has a special ultimate level move that inflicts lots of damage, but costs all the player's manna to use. - Create a method ultimateDamage() that returns the amount of damage the weapon would cause if the ultimate move was used. This should just return 0 for the Weapon superclassStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started