Create a game where the user must defeat three pokmon to win the game. Use inheritance...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create a game where the user must defeat three pokémon to win the game. Use inheritance to implement the following class diagram in your program. Fire _init (self, name) ember(self, opponent): str fire blastiself, opponent): str <abstract> Pokemon battle_table 1..5, 21, 12, 1, 5]. [.5, 2, 11 name: str <<get>> hp: int _type: Int _init__(self, name, type) get_normal_menu(self): str _normal_move(self, opponent, move): str _slam(self, opponent): str tackle(self, opponent): stri <abstract> get special_menuiself): str <abstract>_special_move(self, opponent, move): str attack(self, opponent, type, move): str str_(self): str _take_damage(self, dmg) Water _init__(self, name) _water_gun(self, opponent): str bubble_beam(self, opponent): str Grass init (self, name) razor_leaf(self, opponent): str _solar_beam(self, opponent): str Abstract Pokemon Class (pokemon.py) - 1. _init__(self, name, type)- set the name, and type using the parameters, assign the _battle_table the 2D list given above, and set_hp to 25. 2. hp property-use a decorator to get (not set) the value of_hp. 3. get normal_menu(self) returns a string with the menu options for the normal moves: slam and tackle. 4. _normal_move(self, opponent, move) - use the move parameter to choose to call either slam or tackle method, returns the string returned from those methods. 5. _slam(self, opponent) and tackle(self, opponent) - randomize some damage (slam 1-8. tackle 3-6), call take_damage on the opponent and return a string description of the move using both pokemons names, the type of move, and the amount of damage taken. 6. get_special_menu(self)- abstract (overridden in the subclasses) - returns the menu for the special moves of each type. 7. _special_move(self, opponent, move)-abstract (overridden in the subclasses) - uses the move parameter to choose to call either of the special moves for that type. 8. attack(self, opponent, type, move) - use the type parameter to choose to call either _normal_move or special move. 9. _str_(self)-display the pokemon's name and hp in the format "Name: hp/25". 10. take damage(self, dmg) - the damage the pokemon takes. Subtract the dmg value from the pokemon's_hp. Check that the hp doesn't go past 0 (if it's negative, reset it to 0). Fire/Water/Grass Classes (fire.py/water.py/grass.py) - each inherit from Pokemon - - 1. __init__(self, name) - call super to set the name and type (fire = 0, water = 1, grass = 2). 2. Override the get_special_menu and _special_move methods for this class. 3. Create the two move methods - each pokemon type has two moves (listed above in the class diagram). Randomize damage (movel 1-5, move2 3-4), look up the multiplier in the battle table based on the two pokemon's type and calculate the total damage the opposing pokemon will take (make sure it's a whole number, not a decimal). Then return a string description of the move using both pokemons names, the type of move, the amount of damage taken, and whether it was effective (2) or not (.5). Main (main.py) - Choose a random type of pokemon that the gym leader will have (ie. fire, water, or grass). Create a list of three pokemon objects all of the same type and give them names. Prompt the user to choose a single pokemon of one of the three types. Allow the user to choose what type of attack to do (ie. normal or special), and then which move to do of that type (ie. if the user chose normal, then they can either choose slam or tackle), call the pokemon's attack method and display the resulting string. If the gym leader's pokemon still has hit points, then it will choose a random type and move to attack back with. When one of the gym leader's pokemon is defeated, remove it from the list. Repeat until the user has defeated all three of the gym leader's pokemon, or until the user's pokemon is defeated. Display a message when the user wins/loses. Check all input for validity. Document all classes, methods, and functions. Example Output (user input is in italics): PROF OAK: Hello Trainer! Today you're off to fight your first gym battle of 1 vs. 3 GRASS pokemon. Select the pokemon that you will fight with. 1. I choose you, Charmander. 2. Squirtle! GO! 3. We can do it, Bulbasaur! Please choose a pokemon: 1 -- GYM BATTLE GYM LEADER: I choose you: Oddish HP: 25/25 Charmander HP: 25/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 2 Choose a Move: 1. Ember 2. Fire Blast Enter move: 1 Charmander engulfs Oddish in EMBERS for 8 damage. It was SUPER EFFECTIVE! Oddish slices Charmander with RAZOR sharp LEAVES for 2 damage. It was not very effective. GYM LEADER: I choose you: Oddish HP: 17/25 Charmander HP: 23/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 2 Choose a Move: 1. Ember 2. Fire Blast Enter move: 2 Charmander BLASTS Oddish with FIRE for 8 damage. It was SUPER EFFECTIVE! Oddish TACKLES Charmander for 3 damage. GYM LEADER: I choose you: Oddish HP: 9/25 Charmander HP: 20/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 2 Choose a Move: 1. Ember ©2023 Cleary 2. Fire Blast Enter move: 1 Charmander engulfs Oddish in EMBERS for 2 damage. It was SUPER EFFECTIVE! Oddish blasts Charmander with a SOLAR BEAM for 2 damage. It was not very effective. GYM LEADER: I choose you: Oddish HP: 7/25 Charmander HP: 18/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 1 Choose a Move: 1. Slam 2. Tackle Enter move: 1 Charmander SLAMS Oddish for 7 damage. GYM LEADER: NOOOOO! You defeated my pokemon! GYM LEADER: I choose you: Bellsprout HP: 25/25 Charmander HP: 18/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 2 Choose a Move: 1. Ember 2. Fire Blast Enter move: 2 Charmander BLASTS Bellsprout with FIRE for 8 damage. It was SUPER EFFECTIVE! Bellsprout blasts Charmander with a SOLAR BEAM for 1 damage. It was not very effective. GYM LEADER: I choose you: Bellsprout HP: 2/25 Charmander HP: 13/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 2 Choose a Move: 1. Ember 2. Fire Blast. Enter move: 1 Charmander engulfs Bellsprout in EMBERS for 10 damage. It was SUPER EFFECTIVE! GYM LEADER: NOOOOO! You defeated my pokemon! GYM LEADER: I choose you: Exeggcute HP: 25/25 Charmander HP: 13/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 2 Choose a Move: 1. Ember 2. Fire Blast Enter move: 2 Charmander BLASTS Exeggcute with FIRE for 6 damage. It was SUPER EFFECTIVE! Exeggcute TACKLES Charmander for 6 damage. GYM LEADER: I choose you: Exeggcute HP: 7/25 Charmander HP: 4/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 2 Choose a Move: 1. Ember 2. Fire Blast. Enter move: 2 Charmander BLASTS Exeggcute with FIRE for 8 damage. It was SUPER EFFECTIVE! GYM LEADER: NOOO00! You defeated my pokemon! YOU WON! leader. You defeated the gym ©2023 Cleary Notes: 1. You should have 5 different files: pokemon.py, fire.py, water.py, grass.py, and main.py. 2. Use docstrings to document each of the classes, their attributes, and each of their methods. See the lecture notes for examples. 3. Place your names, date, and a brief description of your program in a comment block at the top of your main file. Place brief comments throughout your code. 4. Do not create any extra attributes, methods, or parameters. 5. Please do not create any global variables or use the attributes globally. Use the methods instead. You can use the attributes in the subclasses when needed. You can access the hp in main using the property. Only use the public methods (non-underscored) in main. Check all user input using the get_int_range function in the check input module. 6. 7. Feel free to add text to make the game more interesting and to add flair. You may also modify the random amounts of damage to better balance the game. 8. List of pokemon names and types: https://pokemondb.net/pokedex/game/red-blue-yellow. 9. Thoroughly test your program before submitting: a. Make sure that your classes are inherited properly. Fire, Water, and Grass should inherit from Pokemon, and Pokemon should be abstract with two abstract methods. b. Make sure user input is validated. c. Make sure that each type of pokemon does the proper special attacks. d. Make sure that the normal attacks do not use the multiplier from the battle table. e. Make sure that the special attacks do use the multiplier from the battle table. f. Make sure that the correct multiplier is used for the two types of pokemon (ie. Fire is super effective against Grass, Water is super effective against Fire, and Grass is super effective against Water). g. Make sure that the damage dealt is correctly subtracted from the opponent. h. Make sure that the defeated pokemon are removed from the list. i. Make sure the game ends when the user defeats all 3 pokemon, or when the user's pokemon runs out of bp. Create a game where the user must defeat three pokémon to win the game. Use inheritance to implement the following class diagram in your program. Fire _init (self, name) ember(self, opponent): str fire blastiself, opponent): str <abstract> Pokemon battle_table 1..5, 21, 12, 1, 5]. [.5, 2, 11 name: str <<get>> hp: int _type: Int _init__(self, name, type) get_normal_menu(self): str _normal_move(self, opponent, move): str _slam(self, opponent): str tackle(self, opponent): stri <abstract> get special_menuiself): str <abstract>_special_move(self, opponent, move): str attack(self, opponent, type, move): str str_(self): str _take_damage(self, dmg) Water _init__(self, name) _water_gun(self, opponent): str bubble_beam(self, opponent): str Grass init (self, name) razor_leaf(self, opponent): str _solar_beam(self, opponent): str Abstract Pokemon Class (pokemon.py) - 1. _init__(self, name, type)- set the name, and type using the parameters, assign the _battle_table the 2D list given above, and set_hp to 25. 2. hp property-use a decorator to get (not set) the value of_hp. 3. get normal_menu(self) returns a string with the menu options for the normal moves: slam and tackle. 4. _normal_move(self, opponent, move) - use the move parameter to choose to call either slam or tackle method, returns the string returned from those methods. 5. _slam(self, opponent) and tackle(self, opponent) - randomize some damage (slam 1-8. tackle 3-6), call take_damage on the opponent and return a string description of the move using both pokemons names, the type of move, and the amount of damage taken. 6. get_special_menu(self)- abstract (overridden in the subclasses) - returns the menu for the special moves of each type. 7. _special_move(self, opponent, move)-abstract (overridden in the subclasses) - uses the move parameter to choose to call either of the special moves for that type. 8. attack(self, opponent, type, move) - use the type parameter to choose to call either _normal_move or special move. 9. _str_(self)-display the pokemon's name and hp in the format "Name: hp/25". 10. take damage(self, dmg) - the damage the pokemon takes. Subtract the dmg value from the pokemon's_hp. Check that the hp doesn't go past 0 (if it's negative, reset it to 0). Fire/Water/Grass Classes (fire.py/water.py/grass.py) - each inherit from Pokemon - - 1. __init__(self, name) - call super to set the name and type (fire = 0, water = 1, grass = 2). 2. Override the get_special_menu and _special_move methods for this class. 3. Create the two move methods - each pokemon type has two moves (listed above in the class diagram). Randomize damage (movel 1-5, move2 3-4), look up the multiplier in the battle table based on the two pokemon's type and calculate the total damage the opposing pokemon will take (make sure it's a whole number, not a decimal). Then return a string description of the move using both pokemons names, the type of move, the amount of damage taken, and whether it was effective (2) or not (.5). Main (main.py) - Choose a random type of pokemon that the gym leader will have (ie. fire, water, or grass). Create a list of three pokemon objects all of the same type and give them names. Prompt the user to choose a single pokemon of one of the three types. Allow the user to choose what type of attack to do (ie. normal or special), and then which move to do of that type (ie. if the user chose normal, then they can either choose slam or tackle), call the pokemon's attack method and display the resulting string. If the gym leader's pokemon still has hit points, then it will choose a random type and move to attack back with. When one of the gym leader's pokemon is defeated, remove it from the list. Repeat until the user has defeated all three of the gym leader's pokemon, or until the user's pokemon is defeated. Display a message when the user wins/loses. Check all input for validity. Document all classes, methods, and functions. Example Output (user input is in italics): PROF OAK: Hello Trainer! Today you're off to fight your first gym battle of 1 vs. 3 GRASS pokemon. Select the pokemon that you will fight with. 1. I choose you, Charmander. 2. Squirtle! GO! 3. We can do it, Bulbasaur! Please choose a pokemon: 1 -- GYM BATTLE GYM LEADER: I choose you: Oddish HP: 25/25 Charmander HP: 25/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 2 Choose a Move: 1. Ember 2. Fire Blast Enter move: 1 Charmander engulfs Oddish in EMBERS for 8 damage. It was SUPER EFFECTIVE! Oddish slices Charmander with RAZOR sharp LEAVES for 2 damage. It was not very effective. GYM LEADER: I choose you: Oddish HP: 17/25 Charmander HP: 23/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 2 Choose a Move: 1. Ember 2. Fire Blast Enter move: 2 Charmander BLASTS Oddish with FIRE for 8 damage. It was SUPER EFFECTIVE! Oddish TACKLES Charmander for 3 damage. GYM LEADER: I choose you: Oddish HP: 9/25 Charmander HP: 20/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 2 Choose a Move: 1. Ember ©2023 Cleary 2. Fire Blast Enter move: 1 Charmander engulfs Oddish in EMBERS for 2 damage. It was SUPER EFFECTIVE! Oddish blasts Charmander with a SOLAR BEAM for 2 damage. It was not very effective. GYM LEADER: I choose you: Oddish HP: 7/25 Charmander HP: 18/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 1 Choose a Move: 1. Slam 2. Tackle Enter move: 1 Charmander SLAMS Oddish for 7 damage. GYM LEADER: NOOOOO! You defeated my pokemon! GYM LEADER: I choose you: Bellsprout HP: 25/25 Charmander HP: 18/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 2 Choose a Move: 1. Ember 2. Fire Blast Enter move: 2 Charmander BLASTS Bellsprout with FIRE for 8 damage. It was SUPER EFFECTIVE! Bellsprout blasts Charmander with a SOLAR BEAM for 1 damage. It was not very effective. GYM LEADER: I choose you: Bellsprout HP: 2/25 Charmander HP: 13/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 2 Choose a Move: 1. Ember 2. Fire Blast. Enter move: 1 Charmander engulfs Bellsprout in EMBERS for 10 damage. It was SUPER EFFECTIVE! GYM LEADER: NOOOOO! You defeated my pokemon! GYM LEADER: I choose you: Exeggcute HP: 25/25 Charmander HP: 13/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 2 Choose a Move: 1. Ember 2. Fire Blast Enter move: 2 Charmander BLASTS Exeggcute with FIRE for 6 damage. It was SUPER EFFECTIVE! Exeggcute TACKLES Charmander for 6 damage. GYM LEADER: I choose you: Exeggcute HP: 7/25 Charmander HP: 4/25 Choose an Attack Type: 1. Normal 2. Special Enter attack type: 2 Choose a Move: 1. Ember 2. Fire Blast. Enter move: 2 Charmander BLASTS Exeggcute with FIRE for 8 damage. It was SUPER EFFECTIVE! GYM LEADER: NOOO00! You defeated my pokemon! YOU WON! leader. You defeated the gym ©2023 Cleary Notes: 1. You should have 5 different files: pokemon.py, fire.py, water.py, grass.py, and main.py. 2. Use docstrings to document each of the classes, their attributes, and each of their methods. See the lecture notes for examples. 3. Place your names, date, and a brief description of your program in a comment block at the top of your main file. Place brief comments throughout your code. 4. Do not create any extra attributes, methods, or parameters. 5. Please do not create any global variables or use the attributes globally. Use the methods instead. You can use the attributes in the subclasses when needed. You can access the hp in main using the property. Only use the public methods (non-underscored) in main. Check all user input using the get_int_range function in the check input module. 6. 7. Feel free to add text to make the game more interesting and to add flair. You may also modify the random amounts of damage to better balance the game. 8. List of pokemon names and types: https://pokemondb.net/pokedex/game/red-blue-yellow. 9. Thoroughly test your program before submitting: a. Make sure that your classes are inherited properly. Fire, Water, and Grass should inherit from Pokemon, and Pokemon should be abstract with two abstract methods. b. Make sure user input is validated. c. Make sure that each type of pokemon does the proper special attacks. d. Make sure that the normal attacks do not use the multiplier from the battle table. e. Make sure that the special attacks do use the multiplier from the battle table. f. Make sure that the correct multiplier is used for the two types of pokemon (ie. Fire is super effective against Grass, Water is super effective against Fire, and Grass is super effective against Water). g. Make sure that the damage dealt is correctly subtracted from the opponent. h. Make sure that the defeated pokemon are removed from the list. i. Make sure the game ends when the user defeats all 3 pokemon, or when the user's pokemon runs out of bp.
Expert Answer:
Answer rating: 100% (QA)
Solution for the mainpy file is as follows pokemonpy import random 2D battle table used to calculate damage multiplier based on attacking and defending types BATTLETABLE 1 2 0 0 1 2 2 0 1 class Pokemo... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
What is meant by internal consistency when applied to forecasting assumptions? Give an example of internal inconsistency.
-
Your task is to create a game where the users can play with words and numbers. The game has three consecutive levels (Level 1, Level 2, and Level 3). Users can proceed to the next level after...
-
Identify the reasons that a health care organization needs cash on hand.
-
Northwest Building Products (NBP) manufactures two lumber products from a joint milling process: residential building lumber (RBL) and commercial building lumber (CBL). A standard production run...
-
Suggest a reasonable explanation for each of the following observations: (a) The second-order rate constant k for saponification of ethyl trifluoroacetate is over 1 million times greater than that...
-
Kilgore's Deli is a small delicatessen located near a major university. Kilgore's does a large walk-in carry-out lunch business. The deli offers two luncheon chili specials, Wimpy and Dial 911. At...
-
The anchor bolt was pulled out of the concrete wall and the failure surface formed part of a frustum and cylinder. This indicates a shear failure occurred along the cylinder BC and tension failure...
-
Halles Berry Farm establishes a $400 petty cash fund on September 4 to pay for minor cash expenditures. The fund is replenished at the end of each month. At the end of September, the fund contains...
-
You can purchase a new duplex for $2,000,000. The bank has quoted her an 75% LTV. The loan would be amortized for 30 years, the annual interest rate is 5.5%. The annual NOI is $175,000. Determine the...
-
A. Create a budget (using the Budget tab in the Final Project Workbook) based on your second year of operations. [ACC-325-01] B. Summarize your budget and make suggestions for the future of your...
-
Show that Hint: Recall that and tPx = e lo Uxtu du fx (t) = == -Sx (t), dt fx(t) = tPx Hx+t.
-
What is it called when leaders' behaviors encourage and support their employees so that they are able to grow, develop, and excel on the job?
-
Green Lawns, Inc. Income Statement Year Ending December 31, 2015 Revenue: Lawn care revenue earned $192,000 Expenses: Salary Expense $104,000 Supply Expense $2,400 Advertising Expense $600...
-
4. A small dozer is purchased for $110,000. A forecast of expected operating hours, salvage values, and maintenance expense is presented in the table:| Year Operating hours Salvage Maintenance...
-
Are the business gross receipts included in gross income for Michael and Diana's 1040?
-
Does bankruptcy require liquidation of a company's assets?
-
How can government and policy makers do more to ensure that Blockchain is not going to be a Job Killer but an Opportunity Generator?
-
Problem 2. (0.6 points, 0.2 points for each question) (a) A company turns its inventory 2 times a month. Its months-of-supply = Its days-of-supply = Please show your analysis below: _months. days. (1...
-
A full binary tree is a binary tree with the leaves on the same level. Add a method in the BST class to return true if the tree is a full binary tree. /** Returns true if the tree is a full binary...
-
Write a program that simulates car racing, as shown inFigure 15.34a. The car moves from left to right. When it hits the right end, it restarts from the left and continues the same process. You can...
-
Revise the program in Listing 21.7. If a keyword is in a comment or in a string, don?t count it. Pass the Java file name from the command line. Assume that the Java source code is correct and line...
-
Figure P32.94 shows, for an AC circuit, the instantaneous current through a circuit element and the potential difference across the element. What can you determine about the element? Data from Figure...
-
The circuit in Figure P32.96 represents your planned design for a wall power supply that will run a radio that usually runs on a 9-V battery. The power supply uses a transformer (not shown) to...
-
Your boss has purchased a new AC power source to run a high-voltage, low-current display, but it is not working. While he is fuming, you look at the owner's manual and discover that this power source...
Study smarter with the SolutionInn App