2. You use your code from the first part to release your game, Super Happy Fun Cute Creatures World Traveler, to widespr

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

2. You use your code from the first part to release your game, Super Happy Fun Cute Creatures World Traveler, to widespr

Post by answerhappygod »

2 You Use Your Code From The First Part To Release Your Game Super Happy Fun Cute Creatures World Traveler To Widespr 1
2 You Use Your Code From The First Part To Release Your Game Super Happy Fun Cute Creatures World Traveler To Widespr 1 (346.78 KiB) Viewed 42 times
2. You use your code from the first part to release your game, Super Happy Fun Cute Creatures World Traveler, to widespread acclaim. Unfortunately, within only a few months of release your player base is getting restless! They are easily bored and are demanding that you add more depth to the game. In response, you decide to introduce EvolvableCuteCreatures into your game world. These creatures will automatically "evolve" once they reach a certain level. (Not every creature can evolve - some will stay in their original form no matter how high they level.) Evolved creatures are similar to regular creatures, but they gain the following extras: • When the creature evolves, its species changes. This is determined when the creature is first created. For example, a Tore-Chick might evolve into a Calmbustkin. • Each evolved creature becomes "attuned" to a particular type. This is done based on the first letter of the creature's species after it evolves: - A-F creatures attune to light G-L creatures attune to dark - M-R creatures attune to nature - S-Z creatures attune to tech Creatures become "resistant" or "vulnerable" to certain types based on their own type: Light is resistant to tech and vulnerable to dark - Dark is resistant to nature and vulnerable to light - Nature is resistant to dark and vulnerable to tech - Tech is resistant to light and vulnerable to nature • Evolved creatures have two types of attacks: their regular attack (as defined in CuteCrea- ture) and a "special attack." This special attack is guaranteed never to miss, but it can never score a critical hit either. The damage from a special attack is computed like this,
where A is the attacking creature's attack rating and D is the target creature's defense rating: - If the target creature is of the same type as the attacking creature, the special attack deals no damage, regardless of A and D. If the target creature's type resists the attacking creature's type, the special attack deals A - 5D damage, with a minimum possible damage of 0. If the target creature's type is vulnerable to the attacking creature's type, the special attack deals 5A - D damage, with a minimum possible damage of 10. - In all other situations, the special attack deals A-D damage, with a minimum possible damage of 1. This includes situations in which an evolved creature performs a special attack vs. a creature with no type (which could be an EvolvableCuteCreature who hasn't evolved yet, or just a regular CuteCreature). Here are some examples of how the special attack works: Attacker's Type Nature Nature Nature Nature Nature Attacker's Attack Rating 15 15 15 15 15 Target's Target's Type Defense Rating Tech Dark Nature Light None 25 25 25 25 25 Damage Dealt to Target 50 0 0 1 1 Within a file named evolvable_cute_creature.py, write a subclass EvolvableCuteCreature that extends your existing CuteCreature class with the functionality described above. The subclass should contain the following parts: (a) (3 points) EvolvableCuteCreatures need extra instance attributes to indicate at which level the evolution process should take place, the evolved species, and which type the creature is attuned to once it evolves. Write a constructor for EvolvableCuteCreature. This constructor should take the same parameters as the one from CuteCreature, plus extra parameters for the level at which evolution should occur and the evolved species. Since the creature doesn't evolve until reaching a certain level, the constructor should also initialize the type instance attribute to some kind of "hasn't evolved yet" value. Call the parent constructor to save yourself some coding! (b) (3 points) Override the_str__ method from CuteCreature to include which type the crea- ture is attuned to. If the creature hasn't evolved yet, indicate that it has no type. Be sure to use the correct species if the creature has evolved! (c) (3 points) Override the level up method from CuteCreature to handle the evolution pro- cess at the appropriate level. This method should display some text when called, to indicate that the evolution process is happening.
(d) (9 points) Add the new method special attack(self, target), which performs one special attack against a target CuteCreature using the rules explained earlier. If an Evolv- able CuteCreature tries to call this method without having evolved yet, display an appropri- ate error message. Be sure to check for the target creature being defeated; if this happens, the attacking creature should gain some experience just as with a regular attack. (e) (4 points) Below your EvolvableCuteCreature class definition, test your class by doing this: • Create several EvolvableCuteCreature objects. Call gain xp to give them enough experience to evolve, and verify that the evolution process happens successfully. • Thoroughly test the special attack method. You should include at least the follow- ing scenarios: An evolved creature attacking an evolved creature of the same type An evolved creature attacking an evolved creature of a resistant type An evolved creature attacking an evolved creature of a vulnerable type An evolved creature attacking an EvolvableCuteCreature that hasn't evolved yet An evolved creature attacking a regular CuteCreature - An EvolvableCuteCreature that hasn't evolved yet trying to perform a special attack - Congrats! Your code is now the very best, like no code ever was.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply