Question: 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.Now we have to use the program to create an ultra-simple Pokenmon

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

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!