Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Now we have to use the program to create an ultra-simple Pokenmon pairing mechanism. 1. First create a class called Pokenmon, which must be entered

Now we have to use the program to create an ultra-simple Pokenmon pairing mechanism.

1. First create a class called Pokenmon, which must be entered when it is created. Name, Power (attack), Defense (defense), Hp (blood) four parameters.

2. Write a function name under the class compared to Info, use this function to display the only Pokenmon's information (example on the next page).

3. Write a function called attack under this class, use this function to make the order The target Pokenmon buckles (cut Hp), the following requirements are in the function.

(1) If the attacker has died, he cannot attack and hit your Pokenmon cant The word fight.

(2) When attacking, display (attacker) attack (target) cause (n) damage.

(3) The damage calculation method is the attacker power-target Defence.

(4) After each attack, it shows the blood volume of two treasures.

(5) If Pokenmon dies due to combat, it will print out "(dead name) is dead"

(6) The blood volume cannot be negative.image text in transcribed

Python!

p1 >>p2 Pokenmon (Name-"Firedragon", Power-15,Defence-2,Hp-20) Pokenmon (Name- "Waterturtle", Power-13,Defence- 3,Hp-24) pl.Info() Name:Firedragon Power:15 Defence:2 Hp: 20/2e >>>p2.Info() Name: Waterturtle Power:13 Defence:3 Hp: 24/24 > p1.attack (p2) Firedragon attack Waterturtle cause 12 damage Firedragon Hp:20/20 Waterturtle Hp:12/24 >>>p2.attack (pl) Waterturtle attack Firedragon cause 11 damage Waterturtle Hp:12/24 Firedragon Hp:9/2e >>> pl.attack (p2) Firedragon attack Waterturtle cause 12 damage Firedragon Hp:9/20 Waterturtle Hp:0/24 Waterturtle is dead >>> p2.attack(pl) your Pokenmon can't fight p1 >>p2 Pokenmon (Name-"Firedragon", Power-15,Defence-2,Hp-20) Pokenmon (Name- "Waterturtle", Power-13,Defence- 3,Hp-24) pl.Info() Name:Firedragon Power:15 Defence:2 Hp: 20/2e >>>p2.Info() Name: Waterturtle Power:13 Defence:3 Hp: 24/24 > p1.attack (p2) Firedragon attack Waterturtle cause 12 damage Firedragon Hp:20/20 Waterturtle Hp:12/24 >>>p2.attack (pl) Waterturtle attack Firedragon cause 11 damage Waterturtle Hp:12/24 Firedragon Hp:9/2e >>> pl.attack (p2) Firedragon attack Waterturtle cause 12 damage Firedragon Hp:9/20 Waterturtle Hp:0/24 Waterturtle is dead >>> p2.attack(pl) your Pokenmon can't fight

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions