Question: IN PYTHON PLEASE Now we want a way to make our monsters fight! Before two monsters can fight, we need to give 2 new class

 IN PYTHON PLEASE Now we want a way to make our

monsters fight! Before two monsters can fight, we need to give 2

IN PYTHON PLEASE

Now we want a way to make our monsters fight! Before two monsters can fight, we need to give 2 new class methods that update their stats. Implement a method for "winfight" and "losefight". Winfight should add 5 to the monster's self.exp and reset their hp to maxhp. "lose_fight" should also reset their hp but only adds 1 exp to self.exp. Now write a function that takes 2 instances of the monster class and makes them fight. A fight goes as follows: 1. The monster that entered as the first function goes first. 2. Each monster takes a turn using one attack move. The monster selects this attack move from the most strongest to the weakest in a circular function. For example: A monster has a dictionary of possible attack as follows: ["firestorm": 3, "doublehit": 4, "earthquake": 2, "ice_storm": 3] Monster will select the following attacks: Round No Move Explanation 1 double_hit Highest hit points 2 fire_storm Same hit points as ice_storm but comes first alphabetically 3 ice_storm 4 earthquake 5 double_hit 6 fire_storm 7 ice_storm Monster will select the following attacks: Round No Move Explanation 1 double_hit Highest hit points 2 fire_storm Same hit points as ice_storm but comes first alphabetically 3 ice_storm 4 earthquake 5 double_hit 6 fire_storm 7 ice_storm .... And so on. 3. An attack is always successful and will decrease the opponent's hp by the given number of points in self.attacks dictionary. The monsters continue taking turns until their current hp becomes less than or equal to zero. 4. At this point, the winfight and losefight method should be invoked. Once this complete, return 3 things from the function. Round_number Monster name that won List of attacks the monster used Special Edge Case: If both monster only have "wait" as an attack, return . -1 (round_number) None (for monster name that won) None (for list of attack that monster use) Now we want a way to make our monsters fight! Before two monsters can fight, we need to give 2 new class methods that update their stats. Implement a method for "winfight" and "losefight". Winfight should add 5 to the monster's self.exp and reset their hp to maxhp. "lose_fight" should also reset their hp but only adds 1 exp to self.exp. Now write a function that takes 2 instances of the monster class and makes them fight. A fight goes as follows: 1. The monster that entered as the first function goes first. 2. Each monster takes a turn using one attack move. The monster selects this attack move from the most strongest to the weakest in a circular function. For example: A monster has a dictionary of possible attack as follows: ["firestorm": 3, "doublehit": 4, "earthquake": 2, "ice_storm": 3] Monster will select the following attacks: Round No Move Explanation 1 double_hit Highest hit points 2 fire_storm Same hit points as ice_storm but comes first alphabetically 3 ice_storm 4 earthquake 5 double_hit 6 fire_storm 7 ice_storm Monster will select the following attacks: Round No Move Explanation 1 double_hit Highest hit points 2 fire_storm Same hit points as ice_storm but comes first alphabetically 3 ice_storm 4 earthquake 5 double_hit 6 fire_storm 7 ice_storm .... And so on. 3. An attack is always successful and will decrease the opponent's hp by the given number of points in self.attacks dictionary. The monsters continue taking turns until their current hp becomes less than or equal to zero. 4. At this point, the winfight and losefight method should be invoked. Once this complete, return 3 things from the function. Round_number Monster name that won List of attacks the monster used Special Edge Case: If both monster only have "wait" as an attack, return . -1 (round_number) None (for monster name that won) None (for list of attack that monster use)

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!