Sharpen the gas bomb and the laser

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019AJMdB7iuHuLFZM1aBu3GD
This commit is contained in:
Loïc Wisniewski 2026-09-04 22:34:29 +02:00
commit 1cb8fc54e9
6 changed files with 76 additions and 5 deletions

View file

@ -144,6 +144,12 @@ func _process(delta: float) -> bool:
main._handle_touch(release)
if not skill.projectile_active:
return _fail_now("release did not throw a gas bomb")
# #201 doubled the blast. Read off the bomb actually in flight, so
# a constant that stops reaching the effect fails here rather than
# passing on the strength of its own declaration.
if int(skill.projectiles[0].damage) != 6:
return _fail_now("gas bomb carries %d damage, expected the doubled 6" \
% int(skill.projectiles[0].damage))
elapsed = 0.0
stage = 1
1:

View file

@ -99,6 +99,12 @@ func _process(delta: float) -> bool:
return _fail_now("no laser ship is ready right after spawning")
if absf(first_shooter.get_component("laser").beam_range - 2900.0) > 0.1:
return _fail_now("laser ship beam range was not doubled to 2900")
# #201 tripled the beam's damage. Read off the COMPONENT rather
# than off the definition, so a stat that stops reaching the hull
# fails here instead of passing on the strength of its own file.
if first_shooter.get_component("laser").damage != 6:
return _fail_now("laser damage is %d, expected the tripled 6" \
% first_shooter.get_component("laser").damage)
var press := InputEventScreenTouch.new()
press.index = 7
@ -203,6 +209,37 @@ func _process(delta: float) -> bool:
if absf(main.get_node("Camera2D").zoom.x - original_zoom) > 0.03:
return _fail_now("camera did not restore its pre-aim zoom")
print("camera zoom restored")
# --- E. #201: the beam gets ordinary fire's aim helper ----------
# Checked on the resolution itself rather than by firing again:
# both hulls are still cooling down, and what the ticket asks for
# is exactly that a drag resolves onto a nearby enemy.
for spent in on_line_enemies + [off_line_enemy, beyond_range_enemy]:
if is_instance_valid(spent):
spent.free()
var origin: Vector2 = skill._aim_origin()
var in_cone: Node = load("res://enemies/Enemy.tscn").instantiate()
in_cone.position = origin + Vector2(800.0, 0.0).rotated(deg_to_rad(20.0))
main.add_child(in_cone)
in_cone.speed = 0.0
# Nearer than the one in the cone, and deliberately outside it:
# the assist must not treat "closest" as "aimed at".
var out_of_cone: Node = load("res://enemies/Enemy.tscn").instantiate()
out_of_cone.position = origin + Vector2(600.0, 0.0).rotated(deg_to_rad(60.0))
main.add_child(out_of_cone)
out_of_cone.speed = 0.0
var assisted: Vector2 = skill._calculate_aim_target(Vector2(300.0, 0.0), origin)
if assisted.distance_to(in_cone.global_position) > 1.0:
return _fail_now("a drag past an enemy inside the assist cone did not snap onto it")
print("aiming snapped onto the enemy inside the assist cone")
in_cone.free()
var unassisted: Vector2 = skill._calculate_aim_target(Vector2(300.0, 0.0), origin)
if unassisted.distance_to(origin + Vector2(2900.0, 0.0)) > 1.0:
return _fail_now("the aim bent toward an enemy outside the assist cone")
print("an enemy outside the cone left the aim where it was pointed")
print("TEST_LASER_VESSEL: PASS")
quit(0)
return true