« All Events
4:30 PM – Python OOP
May 10, 2022 @ 4:30 pm - 5:30 pm
Homework
- When monster has been defeated, display monster in the menu like this “<species> has been defeated. For example
-
You have 112 health remaining.
Please choose a monster that you want to fight:
Dragon has been defeated
Troll - 27.0 health - max damage: 30
Water Golem - 40 health - max damage: 25
Enter your selection (enter 'exit' to quit):
- Inside Dragon class, override do_magic_damage method so it will be immune to fire magic attack. It will print “Dragon is immune to fire magic attack. No damage is done.” .
- Inside Dragon.do_magic_damage, if it is water magic attack, then you want to double the damage and print “Water magic is super effective against dragon. The damage is doubled.”
- Create water_golem.py, inside put WaterGolem class. This class should inherits from Monster class.
- Inside WaterGolem class, override do_magic_damage.
- a. water magic do half damage
- b. fire magic do no damage
- c. wind magic do double damage.
- Inside monster_inheritance_main.magic_attack, add code to enable water, wind and earth magic attack.