Question: 13.11 PA4 Q1: Build a Monster Construct a class Monster with the following attributes: 1. self.name (a string) 2. self.type (a string, default is 'Normal')

 13.11 PA4 Q1: Build a Monster Construct a class "Monster" withthe following attributes: 1. self.name (a string) 2. self.type (a string, default

13.11 PA4 Q1: Build a Monster Construct a class "Monster" with the following attributes: 1. self.name (a string) 2. self.type (a string, default is 'Normal') 3. self.current_hp (int, start out equal to max_hp) 4. self.max_hp (int is given as input when the class instance is created, default is 20) 5. self.attacks (a dictionary of all known attacks) 6. self. possible_attacks (a dictionary of all possible attacks) The dictionary of possible_attacks will map the name of an attack (the key) to how many points of damage the attack does. They must be of the following list: 1. sneak attack: 1 2. slash: 2 3. ice_storm: 3 4. fire_storm: 3 5. whirlwind: 3 6. earthquake: 2 7. double_hit: 4 8. tornado: 4. 9. wait: 0 Every monster will start out with only the "wait" attack within self.attacks. You will need to construct the method add_attack and remove_attack. Both methods will take in an attack name as a parameter. A monster can only have a maximum of four attacks at a time. If you add an attack when the monster already has four, the weakest one should be dropped automatically. If there is a tie for the weakest attack, drop the attack that comes first alphabetically. If adding the attack ended successfully, return True. If you try to add an invalid attack return False. If all of a monster's attacks are removed, "wait" should automatically be added again, so that every monster always has at least 1 attack. If removing an attack ended successfully return True. If you try to remove an invalid attack or an attack that has not been learned return False. LAB ACTIVITY 13.11.1: PA4 01: Build a Monster 15/30 main.py Load default template.. 1 class Monster(): 2 def __init_(self, name, hp=20): 3 self.exp = 0 4 #your code here 5 def add_attack(self, attack_name): 6 pass #your code here 7 def remove_attack(self, attack_name): 8 pass #your code here 9 Develop mode Submit mode Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box Enter program input (optional) main.py Run program Input (from above) - Output (shown below) (Your program) Program output displayed here What is this? Signature of your work 2/28.. 10---10-115-10115 S-115-115101010--115 U|15|15|15|0|15 ..3/7

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!