We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Enchant and Attack

In Fantasy Quest, a weapon can be enchanted to do bonus damage.

Assignment

Complete the enchant_and_attack function. It creates a new "enchanted" name for a weapon and calculates how much damage the enchanted weapon will deal to a targeted enemy.

It accepts 3 parameters:

  • target_health: integer
  • damage: integer
  • weapon: string

It should do the following things in the function body:

    1. sword -> enchanted sword
    2. axe -> enchanted axe