-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
Bug
In script.js, when a monster is defeated, the experience (exp) variable is incremented with the monster's name (a string) instead of their level (a number). This causes experience to become a string, which breaks experience tracking and related calculations.
Problematic code:
exp += monsters[fighting].name;
Expected behavior:
Experience should be increased by the monster's level (a number), e.g.:
exp += monsters[fighting].level;
Steps to Reproduce
- Defeat a monster in the game.
- Check the experience value displayed or in the console.
- Notice that the value is a string and not incrementing as expected.
Suggested Fix
Update the relevant line to add the monster's level to the experience:
exp += monsters[fighting].level;
Additional Context
This is an easy and impactful fix for new contributors!
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers