V4 lab drops
This commit is contained in:
1 parent
aeb5b324f1
commit
f1363dd6c8
11 files changed
+157
-37
No files matched your search
@@ -1,5 +1,7 @@
|
||||
extends SceneTree
|
||||
|
||||
const PICKUP_SCENE: PackedScene = preload("res://pickups/pickup.tscn")
|
||||
|
||||
## Full Godot integration test. Requires the real engine and imported SVGs.
|
||||
## Run: godot --headless --path . --script res://tests/test_pickup_runtime.gd
|
||||
|
||||
@@ -20,7 +22,7 @@ func _run() -> void:
|
||||
await process_frame
|
||||
|
||||
var status: Label = level.get_node("TestHUD/Overlay/Status") as Label
|
||||
if not status.text.contains("LAB DROPS v3"):
|
||||
if not status.text.contains("LAB DROPS v4"):
|
||||
_fail("No se esta ejecutando level_01.gd")
|
||||
return
|
||||
|
||||
@@ -56,6 +58,57 @@ func _run() -> void:
|
||||
_fail("El objeto de control no debe contar entre los 17 drops")
|
||||
return
|
||||
|
||||
# Touch a dropped speed item while the 0.75-second collection delay is
|
||||
# running, then move away as if running through it. It must not be lost.
|
||||
var base_speed: float = float(player.call("get_move_speed"))
|
||||
var speed_drop: Pickup = PICKUP_SCENE.instantiate() as Pickup
|
||||
speed_drop.pickup_data = load("res://pickups/data/coffee.tres") as PickupData
|
||||
speed_drop.collection_delay_seconds = Pickup.DROP_COLLECTION_DELAY_SECONDS
|
||||
speed_drop.position = player.position
|
||||
level.add_child(speed_drop)
|
||||
await create_timer(0.1).timeout
|
||||
if not is_instance_valid(speed_drop) or speed_drop.get("_pending_collector") != player:
|
||||
_fail("El jugador no se registro al atravesar el drop durante la espera")
|
||||
return
|
||||
player.global_position = Vector2(170, 557)
|
||||
await create_timer(0.8).timeout
|
||||
if is_instance_valid(speed_drop):
|
||||
_fail("El drop tocado durante la espera se quedo olvidado en el suelo")
|
||||
return
|
||||
if not is_equal_approx(float(player.call("get_move_speed")), base_speed * 1.25):
|
||||
_fail("El Tostado del Averno no ha aumentado la velocidad un 25%%")
|
||||
return
|
||||
|
||||
# The multiplier must affect actual horizontal movement, not just a label.
|
||||
Input.action_press("move_right")
|
||||
await create_timer(0.3).timeout
|
||||
Input.action_release("move_right")
|
||||
if player.velocity.x < base_speed * 1.15:
|
||||
_fail("La velocidad horizontal real no refleja el buff de velocidad")
|
||||
return
|
||||
player.velocity = Vector2.ZERO
|
||||
player.global_position = Vector2(170, 557)
|
||||
await create_timer(0.15).timeout
|
||||
|
||||
# A full-health heal should stay on the floor, then get collected without
|
||||
# requiring a second body_entered signal when HP decreases in place.
|
||||
var heal_pickup: Pickup = PICKUP_SCENE.instantiate() as Pickup
|
||||
heal_pickup.pickup_data = load("res://pickups/data/beer.tres") as PickupData
|
||||
heal_pickup.position = player.position
|
||||
level.add_child(heal_pickup)
|
||||
await create_timer(0.1).timeout
|
||||
if not is_instance_valid(heal_pickup):
|
||||
_fail("Un objeto de curacion no debe consumirse con HP al maximo")
|
||||
return
|
||||
if not (heal_pickup.get_node("Label") as Label).text.contains("HP LLENO"):
|
||||
_fail("El pickup no explica que la salud esta llena")
|
||||
return
|
||||
player.set("current_health", 50)
|
||||
await create_timer(0.1).timeout
|
||||
if is_instance_valid(heal_pickup) or int(player.get("current_health")) <= 50:
|
||||
_fail("Un objeto solapado debe reintentarse cuando el jugador necesita HP")
|
||||
return
|
||||
|
||||
var enemies: Array[Node] = level.get_node("TestEnemies").get_children()
|
||||
if enemies.size() != 17:
|
||||
_fail("Se esperaban 17 enemigos, hay %d" % enemies.size())
|
||||
@@ -113,7 +166,7 @@ func _run() -> void:
|
||||
_fail("Se duplicaron o perdieron drops al procesar frames adicionales")
|
||||
return
|
||||
|
||||
print("OK LAB DROPS: control recogido por colision, 17 KOs, 17 recompensas, 1 senal desconectada")
|
||||
print("OK LAB DROPS: colision, paso rapido, reintento de curacion, velocidad real, 17 KOs y 17 drops")
|
||||
quit(0)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user