From 2382ff7c697c06cc40232b32b055fc17f5403732 Mon Sep 17 00:00:00 2001 From: Madison Nicole Date: Mon, 7 Sep 2026 19:29:57 -0700 Subject: [PATCH] fix: accept more correct solutions in L14.P2 damage check The static check for the "Reducing damage at higher levels" practice only matched 'amount *= 0.5' and 'amount = amount * 0.5'. Also accept 'amount -= amount * 0.5' and 'amount /= 2', which produce the specified behavior (half damage above level 2) and still assign the reduced value back to the parameter. --- .../reducing_damage/TestReducingDamage.gd | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/course/lesson-14-multiplying/reducing_damage/TestReducingDamage.gd b/course/lesson-14-multiplying/reducing_damage/TestReducingDamage.gd index 1289e716..1027b98b 100644 --- a/course/lesson-14-multiplying/reducing_damage/TestReducingDamage.gd +++ b/course/lesson-14-multiplying/reducing_damage/TestReducingDamage.gd @@ -70,6 +70,21 @@ func test_multiplication_is_used_to_reduce_damage_amount() -> String: GDExpr.identifier(parameter_name), GDExpr.literal(0.5) ) + ), + # amount -= amount * 0.5 + GDExpr.assignment( + GDExpr.identifier(parameter_name), + GDExpr.multiply( + GDExpr.identifier(parameter_name), + GDExpr.literal(0.5) + ), + GDAssignmentNode.Operation.OP_SUBTRACTION + ), + # amount /= 2 + GDExpr.assignment( + GDExpr.identifier(parameter_name), + GDExpr.literal(2), + GDAssignmentNode.Operation.OP_DIVISION ) ) )