fix(curriculum): resolving typos and small bugs in JS RPG game (#52129)

Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
Co-authored-by: Sem Bauke <semboot699@gmail.com>
pull/52156/head
Jessica Wilkins 2023-10-28 00:43:49 -07:00 committed by GitHub
parent 9b255cb859
commit 0a74f48f8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 6 deletions

View File

@ -17,7 +17,7 @@ You should assign the string `You dodge the attack from the ` to the `text.inner
assert.match(dodge.toString(), /text\.innerText\s*=\s*('|")You dodge the attack from the \1/);
```
You should use the concatenation operator to add the name of the monster to the end of the string. You can get this with `monster[fighting].name`.
You should use the concatenation operator to add the name of the monster to the end of the string. You can get this with `monsters[fighting].name`.
```js
assert.match(dodge.toString(), /text\.innerText\s*=\s*('|")You dodge the attack from the \1\s*\+\s*monsters\[fighting\]\.name/);

View File

@ -9,7 +9,9 @@ dashedName: step-138
Back to your `attack` function - inside the `else if` block, create another `if` and `else` statement. If the player is fighting the dragon (`fighting` would be `2`), call the `winGame` function. Move the `defeatMonster()` call to the `else` block.
Here is an example that checks if `num` is equal to `5`:
For this step, you will need to use the strict equality (`===`) operator to check if `fighting` is equal to `2`. The strict equality operator will check if the values are equal and if they are the same data type.
Here is an example that checks if `num` is strictly equal to `5`:
```js
if (num === 5) {

View File

@ -7,7 +7,7 @@ dashedName: step-150
# --description--
Add an `else` statement to the first `if` statement inside you `attack()` function. In the `else` statement, use the `+=` operator to add the text ` You miss.` to the end of `text.innerText`.
Add an `else` statement to the first `if` statement inside your `attack()` function. In the `else` statement, use the `+=` operator to add the text ` You miss.` to the end of `text.innerText`.
# --hints--
@ -17,7 +17,7 @@ You should add an `else` block after your `if (isMonsterHit())` block.
assert.match(attack.toString(), /if\s*\(isMonsterHit\(\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\[currentWeapon\]\.power\s*\+\s*Math\.floor\(Math\.random\(\)\s*\*\s*xp\)\s*\+\s*1;\s*\}\s*else/)
```
You should add the text ` You miss.` to the end of `text.innerText`. Remember to use compound assignment.
You should add the text ` You miss.` to the end of `text.innerText`. Remember to use compound assignment and make sure there is a space before the word `You`.
```js
assert.match(attack.toString(), /if\s*\(isMonsterHit\(\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\[currentWeapon\]\.power\s*\+\s*Math\.floor\(Math\.random\(\)\s*\*\s*xp\)\s*\+\s*1;\s*\}\s*else\s*\{\s*text\.innerText\s*\+=\s*('|")\sYou miss\.\1/)

View File

@ -207,8 +207,8 @@ const locations = [
"button text": ["REPLAY?", "REPLAY?", "REPLAY?"],
"button functions": [restart, restart, restart],
text: "You defeat the dragon! YOU WIN THE GAME! 🎉"
},
--fcc-editable-region--
}
--fcc-editable-region--
];

View File

@ -7,7 +7,7 @@ dashedName: step-165
# --description--
Before the final quote in that string you added, insert the new line escape character `\n`. This will cause the next part you add to `text.innerText` to appear on a new line.
At the end of the string, before the final quote, insert the new line escape character `\n`. This will cause the next part you add to `text.innerText` to appear on a new line.
# --hints--