Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USING NODE.JS // Define your Pokemon here. class Pokemon { constructor() { // put your properties here } // put your functions here } function

USING NODE.JS

// Define your Pokemon here. class Pokemon { constructor() { // put your properties here } // put your functions here }

function displayGameOverMessage(pokemonA, pokemonB) { // 1. Display "BATTLE OVER!" // 2. Display the name of the winning pokemon // 3. Display the hp for p1 and p2 }

function startBattle() { // 1. Create two pokemon // 2. Output the BATTLE START meesage // 3. Alternate between the pokemon attacking // 3a. Pokemon 1 should attempt to attack Pokemon 2. (use the attack() class function) // - If successful, then Pokemon 2 takes damage. (use the takeDamage() class function) // - If not, then no damage applied // 3b. Check if Pokemon 2 is still alive. If yes, continue. If no, game over! (use the isDead property) // 3c. Pokemon 2 should attempt to attack Pokemon 1 (use the attack() class function) // - If successful, then Pokemon 1 takes damage (use the takeDamage() class function) // - If not, then no damage applied // 3d. Check if Pokemon 1 is still alive. If yes, continue. If no, game oer (use the isDead property) // 4. At some point, one of the pokemon will be dead! Display the game over message! }

// This is the entry point into your app startBattle()

output:

BATTLE START! Pikachu (20HP) vs. Butterfree (30HP)

Pikachu attacks! Butterfree takes 5 damage!

Pikachu: 20/20 HP Butterfree: 25/30 HP

Butterfree attacks! Pikachu takes 3 damage!

Pikachu: 17/30 HP Butterfree: 25/30 HP

Pikachu attacks! Butterfree takes 5 damage!

Pikachu: 17/20 HP Butterfree: 20/30 HP

. (etc, etc, etc)

Butterfree attacks! Butterfree misses!

Pikachu: 7/20 HP Butterfree: 5/30 HP

. Pikachu attacks! Butterfree takes 5 damage! Butterfree fainted!

BATTLE OVER! Pikachu wins!

Pikachu: 7/20 HP Butterfree: 0/30 HP

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

=+ f. instituting laws against driving while intoxicated

Answered: 1 week ago

Question

=+ Why have these changes occurred?

Answered: 1 week ago