L14.P2 Reducing damage at higher levels: check rejects correct solutions that don't reassign amount
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- godot
- Domain
- game-dev, testing-qa
Research direction
Start by locating the L14.P2 lesson and inspect the checks for the damage-reduction behavior, including "Damage Amount Is Correct Value". Reproduce the issue with the shown solution and update the validation so semantically equivalent damage handling passes; done when the valid solution is accepted without breaking the existing checks.
Written by the indexing model from the issue text.
Description
What happened?
I solved the problem with a solution that worked and accomplished everything intended but did not pass the tests. Doing the multiplication by 0.5 at the subtraction rather than assigning the result back to amount fails despite a 10-damage attack still being reduced to 5 above level 2, with full damage below level 3. The second check, "Damage Amount Is Correct Value", passed.
Where were you in the app?
L14.P2 Reducing damage at higher levels
What did you expect to happen?
The test should accept the other solutions that work as intended instead of restricting to certain syntax.
Your code
var level = 3
var health = 100
var max_health = 100
func take_damage(amount):
if level > 2:
health -= amount * 0.5
else:
health -= amount
if health < 0:
health = 0
Optional: screenshot or other details
- Dominant language
- GDScript
- Stars
- 2.8k
- Forks
- 235
- Avg merge
- 20d 10h
- Merged PRs (30d)
- 1
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GDQuest/learn-gdscript
-
content
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
GDQuest/learn-gdscript#1395 ·
-
content
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
GDQuest/learn-gdscript#1393 · 1 comment ·
-
content
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
GDQuest/learn-gdscript#1392 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
GDQuest/learn-gdscript#1398 · 1 reaction ·
-
content user experience
Difficulty 3/5 1-2 days Newbie friendliness 65/100
GDQuest/learn-gdscript#1394 ·
All issues in GDQuest/learn-gdscript
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Far-Beyond-Pulsar/Pulsar-Native#988 · 1 comment ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
goonstation/goonstation#27983 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
Facepunch/garrysmod-issues#7073 ·