--- id: 5dbbb5076ef5fe3a704f849d title: Part 124 challengeType: 0 dashedName: part-124 --- # --description-- If you play the game in its current state you might notice a bug. If your `xp` is high enough, the `getMonsterAttackValue` function will sometimes return a negative number, which will actually add to your total health when fighting a monster! In `getMonsterAttackValue`, change `return hit` to a ternary operator that returns `hit` if `hit` is greater than 0, or returns 0 if it is not. For example, here's a function that returns 5 if `tickets` is greater than 3, or returns 0 if it is not: ```js function applyDiscount(tickets) { return tickets > 2 : 5 : 0; } ``` # --hints-- See description above for instructions. ```js assert( getMonsterAttackValue .toString() .replace(/\s/g, '') .includes('returnhit>0?hit:0') ); ``` # --seed-- ## --before-user-code-- ```html RPG - Dragon Repeller
XP: 0 Health: 100 Gold: 50
Monster Name: Health:
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
``` ## --after-user-code-- ```html ``` ## --seed-contents-- ```html ``` # --solutions-- ```html ```