mejoras en interfaz y movimento de personaje

This commit is contained in:
Diego De la Viuda Llorente committed 2026-11-27 11:43:50 +01:00
1 parent 7a8b03e760
commit f0fa01607c
29 files changed
+504320 -280

No files matched your search

+4 -1
View File
@@ -29,9 +29,12 @@ class BandResourceTests(unittest.TestCase):
def test_base_stats_remain_shared(self):
for role in ROLES:
data = source(f'player/characters/{role}.tres')
for stat in ('max_health = 30', 'move_speed = 390.0', 'jump_velocity = -600.0', 'basic_attack_damage = 5'):
for stat in ('max_health = 30', 'move_speed = 250.0', 'jump_velocity = -600.0', 'basic_attack_damage = 5'):
self.assertIn(stat, data)
self.assertIn('move_speed: float = 250.0', source('player/character_data.gd'))
player = source('player/player.gd')
self.assertIn('ground_acceleration: float = 1800.0', player)
self.assertIn('lerpf(0.65, 1.0, clampf(pace, 0.0, 1.0))', player)
for stat in ('special_charge_per_kill: int = 10', 'special_min_use_charge: int = 25',
'special_max_damage: int = 30', 'special_pulse_count: int = 4',
'ground_pound_max_damage: int = 12'):
+61
View File
@@ -0,0 +1,61 @@
"""Geometry/resource contracts; runtime tests cover real physics and input."""
from pathlib import Path
import re
import unittest
ROOT = Path(__file__).resolve().parents[1]
def read(path):
return (ROOT / path).read_text(encoding='utf-8')
class CrouchResources(unittest.TestCase):
def test_high_punch_clears_crouch_but_not_standing(self):
player = read('player/player.gd')
walker = read('enemies/walker/walker.gd')
body_h = float(re.search(r'size = Vector2\(26, (\d+)\)', read('player/player.tscn'))[1])
ratio = float(re.search(r'var crouch_height_ratio: float = ([\d.]+)', player)[1])
attack_y = float(re.search(r'var attack_start_offset: Vector2 = Vector2\(34.0, (-?[\d.]+)\)', walker)[1])
attack_h = float(re.search(r'size = Vector2\(32, (\d+)\)', read('enemies/walker/walker.tscn'))[1])
feet = body_h / 2
crouch_top = feet - body_h * ratio
attack_bottom = attack_y + attack_h / 2
self.assertGreater(crouch_top, attack_bottom)
self.assertGreater(attack_bottom, -feet)
self.assertIn('attack_collision.shape.collide(', walker)
# Taking damage itself must not branch on the crouch state.
damage = player.split('func take_damage(', 1)[1].split('\nfunc ', 1)[0]
self.assertNotIn('is_crouching', damage)
def test_all_four_reuse_real_crouched_pose(self):
for role in ('guitarist', 'drummer', 'bassist', 'singer'):
frames = read(f'player/characters/animations/{role}_frames.tres')
self.assertRegex(frames, r'"frames": \[\{"duration": 1\.0, "texture": SubResource\("land_0"\)\}\],\n"loop": true,\n"name": &"crouch"')
def test_drop_excludes_only_actual_one_way_support(self):
player = read('player/player.gd')
drop = player.split('func _try_drop_through()', 1)[1].split('\nfunc ', 1)[0]
restore = player.split('func _restore_platform_collisions()', 1)[1].split('\nfunc ', 1)[0]
self.assertIn('test_move(global_transform', drop)
self.assertIn('not platform.one_way', drop)
self.assertIn('add_collision_exception_with(platform)', drop)
self.assertNotIn('collision_mask =', drop)
self.assertNotIn('set_collision_mask_value', drop)
self.assertIn('coyote_timer = 0.0', drop)
self.assertIn('remove_collision_exception_with(platform)', restore)
self.assertIn('intersects(standing_bounds', restore)
self.assertIn('one_way = true', read('world/terrain/platform.tscn'))
self.assertNotIn('one_way = true', read('world/terrain/ground.tscn'))
def test_down_input_already_exists_and_is_released(self):
mobile = read('ui/mobile_controls/mobile_controls.gd')
self.assertIn('move_down={', read('project.godot'))
self.assertIn('_set_direction(&"move_down", 1.0)', mobile)
self.assertIn('Input.action_release(_direction_action)', mobile)
self.assertIn('_set_direction(&"")', mobile)
self.assertIn('joystick_crouch_release_at', mobile)
if __name__ == '__main__':
unittest.main()
+146
View File
@@ -0,0 +1,146 @@
extends SceneTree
## godot --headless --path . --script res://tests/test_crouch_runtime.gd
const PLAYER_SCENE: PackedScene = preload("res://player/player.tscn")
const PLATFORM_SCENE: PackedScene = preload("res://world/terrain/platform.tscn")
const GROUND_SCENE: PackedScene = preload("res://world/terrain/ground.tscn")
const ENEMY_SCENE: PackedScene = preload("res://enemies/variants/roadie.tscn")
var _failures: int = 0
var _world: Node2D
var _player: CharacterBody2D
func _initialize() -> void:
call_deferred("_run")
func _run() -> void:
preload("res://tests/runtime_test_profile.gd").prepare(self)
_world = Node2D.new()
root.add_child(_world)
current_scene = _world
var ground: TerrainPiece = _terrain(GROUND_SCENE, 360.0, 120.0)
var lower: TerrainPiece = _terrain(PLATFORM_SCENE, 235.0, 20.0)
var upper: TerrainPiece = _terrain(PLATFORM_SCENE, 125.0, 20.0)
_player = PLAYER_SCENE.instantiate() as CharacterBody2D
_player.position = Vector2(320.0, 65.0)
_world.add_child(_player)
var body: CollisionShape2D = _player.get_node("CollisionShape2D") as CollisionShape2D
var hurtbox: CollisionShape2D = _player.get_node("Hurtbox/CollisionShape2D") as CollisionShape2D
var sprite: AnimatedSprite2D = _player.get_node("AnimatedSprite2D") as AnimatedSprite2D
await _frames(45)
_check(_player.is_on_floor() and absf(_player.position.y - 99.0) < 2.0, "Land on upper platform normally")
var standing_bottom: float = body.position.y + (body.shape as RectangleShape2D).size.y * 0.5
var standing_y: float = _player.position.y
Input.action_press(&"move_down")
await _frames(5)
_check(bool(_player.get("is_crouching")) and sprite.animation == &"crouch", "Down plays a held crouch pose")
_check(absf(_player.position.y - standing_y) < 2.0, "Crouch leaves feet on the ground")
_check((body.shape as RectangleShape2D).size.y < 52.0 and body.shape == hurtbox.shape, "Body and hurtbox shrink together")
_check(is_equal_approx(body.position.y + (body.shape as RectangleShape2D).size.y * 0.5, standing_bottom), "Crouch keeps bottom anchored")
_check(is_equal_approx(hurtbox.position.y + (hurtbox.shape as RectangleShape2D).size.y * 0.5, standing_bottom), "Hurtbox bottom anchored")
await _frames(20)
_check(_player.is_on_floor() and absf(_player.position.y - standing_y) < 2.0, "Down alone never drops")
Input.action_press(&"jump")
await _frames(5)
_check(not _player.is_on_floor() and _player.position.y > standing_y, "Down + jump drops instead of jumping up")
_check(is_zero_approx(float(_player.get("coyote_timer"))) and int(_player.get("jumps_remaining")) == 1, "Drop consumes only the ground jump")
_check(_player.get_collision_exceptions().has(upper) and not _player.get_collision_exceptions().has(lower), "Only the actual upper support is ignored")
await _frames(70)
_check(_player.is_on_floor() and absf(_player.position.y - 209.0) < 2.0, "Lower platform catches the player even while jump is held")
_check(not _player.get_collision_exceptions().has(upper), "Upper collision restored after full clearance")
_check(_player.get_collision_exceptions().is_empty(), "No persistent collision exceptions")
Input.action_release(&"jump")
await _frames(3)
Input.action_press(&"jump")
await _frames(70)
_check(_player.is_on_floor() and absf(_player.position.y - 334.0) < 2.0, "A second press drops to solid ground")
_check(_player.get_collision_exceptions().is_empty() and not _player.get_collision_exceptions().has(ground), "Solid ground stays enabled")
Input.action_release(&"jump")
await _frames(3)
Input.action_press(&"jump")
await _frames(30)
_check(_player.is_on_floor() and absf(_player.position.y - 334.0) < 2.0 and bool(_player.get("is_crouching")), "Down + jump on solid ground neither jumps nor falls")
Input.action_release(&"jump")
Input.action_release(&"move_down")
await _frames(5)
_check(not bool(_player.get("is_crouching")) and is_equal_approx((body.shape as RectangleShape2D).size.y, 52.0), "Release restores standing shape")
Input.action_press(&"jump")
await _frames(10)
_check(not _player.is_on_floor() and _player.velocity.y < 0.0, "Normal jump still works")
await _frames(85)
Input.action_release(&"jump")
_check(_player.is_on_floor() and absf(_player.position.y - 209.0) < 2.0, "Can jump back onto previously ignored platform")
# Verify a blocked stand-up with an actual low solid ceiling.
var ceiling: TerrainPiece = _terrain(GROUND_SCENE, 150.0, 35.0)
# Avoid starting inside the ceiling: crouch before moving it above the head.
ceiling.position.x = 1100.0
Input.action_press(&"move_down")
await _frames(5)
ceiling.position.x = _player.position.x
await _frames(3)
Input.action_release(&"move_down")
await _frames(5)
_check(bool(_player.get("is_crouching")), "A solid ceiling prevents expansion into geometry")
ceiling.queue_free()
await _frames(5)
_check(not bool(_player.get("is_crouching")), "Stands after headroom is clear")
# Freeze actors on the same floor: verify current shape, not cached Area2D overlaps.
_player.set_physics_process(false)
_player.position = Vector2(320.0, 334.0)
_player.velocity = Vector2.ZERO
var enemy: CharacterBody2D = ENEMY_SCENE.instantiate() as CharacterBody2D
enemy.position = Vector2(270.0, 334.0)
_world.add_child(enemy)
enemy.set_physics_process(false)
enemy.set("attack_direction", 1.0)
enemy.call("_set_attack_hitbox_progress", 0.5)
await _frames(3)
var health: int = int(_player.get("current_health"))
var damage: int = int(enemy.get("attack_damage"))
_player.call("_set_crouching", true)
enemy.call("_update_attack_damage")
_check(int(_player.get("current_health")) == health and (enemy.get("attack_hit_targets") as Dictionary).is_empty(), "Crouch avoids a high punch immediately")
_player.call("_set_crouching", false)
enemy.call("_update_attack_damage")
_check(int(_player.get("current_health")) == health - damage, "Standing in the same high punch takes damage")
_player.set("invulnerability_timer", 0.0)
_player.set("_hurt_animation_timer", 0.0)
_player.call("_set_crouching", true)
enemy.set("attack_hit_targets", {})
enemy.set("attack_start_offset", Vector2(34.0, 12.0))
enemy.call("_set_attack_hitbox_progress", 0.5)
enemy.call("_update_attack_damage")
_check(int(_player.get("current_health")) == health - damage * 2, "A low hit still damages a crouched player")
_player.set("invulnerability_timer", 0.0)
_player.call("take_damage", 1, enemy.position)
_check(int(_player.get("current_health")) == health - damage * 2 - 1, "Crouch is not global invulnerability")
current_scene = null
_world.queue_free()
await process_frame
if _failures == 0:
print("OK CROUCH: shapes, down+jump, stacked platforms, headroom, high and low attacks")
quit(0 if _failures == 0 else 1)
func _terrain(scene: PackedScene, top: float, height: float) -> TerrainPiece:
var terrain: TerrainPiece = scene.instantiate() as TerrainPiece
terrain.dimensions = Vector2(260.0, height)
terrain.position = Vector2(320.0, top + height * 0.5)
_world.add_child(terrain)
return terrain
func _frames(count: int) -> void:
for _frame: int in range(count):
await physics_frame
await process_frame
func _check(condition: bool, message: String) -> void:
if not condition:
_failures += 1
push_error(message)
+1 -1
View File
@@ -129,7 +129,7 @@ func _test_damage_and_push() -> void:
_enemy.call("_set_attack_hitbox_progress", 0.5)
await _frames(3)
# El centro del barrido queda MAS ALLA del jugador. El empuje debe alejarlo
# del enemigo, no acercarlo. Se prueba el solapamiento real de Area2D.
# del enemigo, no acercarlo. Se prueba el solapamiento real de las formas de ataque y Hurtbox.
_enemy.call("_update_attack_damage")
_check(int(_player.get("current_health")) == 24, "Guard hit must deal six HP")
_check(is_equal_approx(_player.velocity.x, 558.0), "Guard must push away with 1.8x horizontal impulse")
+1 -1
View File
@@ -97,7 +97,7 @@ class EnemyProfileTests(unittest.TestCase):
player = (ROOT / 'player/player.gd').read_text(encoding='utf-8')
self.assertIn('knockback_multiplier: float = 1.0', player)
enemy = (ROOT / 'enemies/walker/walker.gd').read_text(encoding='utf-8')
self.assertIn('take_damage(attack_damage, global_position, attack_knockback_multiplier)', enemy)
self.assertIn('target.call("take_damage", attack_damage, global_position, attack_knockback_multiplier)', enemy)
if __name__ == '__main__':
+55
View File
@@ -0,0 +1,55 @@
"""Contratos geometricos del overlay; la suite GDScript prueba los eventos reales."""
from itertools import combinations
from math import hypot
from pathlib import Path
import re
import unittest
ROOT = Path(__file__).resolve().parents[1]
SURFACE = (ROOT / 'ui/mobile_controls/touch_surface.gd').read_text(encoding='utf-8')
class MobileControlResources(unittest.TestCase):
def test_circular_action_layout_is_spaced_inside_safe_area(self):
buttons = {
name: (float(x), float(y), float(radius))
for name, x, y, radius in re.findall(
r'&"(\w+)": \{"offset": Vector2\((\d+), (\d+)\), "radius": ([\d.]+)',
SURFACE,
)
}
self.assertEqual(set(buttons), {'jump', 'attack', 'ground_pound', 'special_attack'})
padding = float(re.search(r'HIT_PADDING: float = ([\d.]+)', SURFACE)[1])
self.assertGreaterEqual(buttons['jump'][2], 75)
self.assertGreaterEqual(buttons['attack'][2], 75)
self.assertTrue(all(r > 56 for _, _, r in buttons.values()))
# Se prueba el layout a escala 1, en panoramica y con recortes laterales/inferiores.
for width, height in [(1280, 720), (1600, 720), (1504, 690), (1100, 600)]:
scale = min(1, width / 1280, height / 720)
for name, (x, y, radius) in buttons.items():
hit = (radius + padding) * scale
cx, cy = width - x * scale, height - y * scale
self.assertGreater(cx - hit, width / 2, name)
self.assertLessEqual(cx + hit, width, name)
self.assertGreaterEqual(cy - hit, 0, name)
self.assertLessEqual(cy + hit, height, name)
for (a, (ax, ay, ar)), (b, (bx, by, br)) in combinations(buttons.items(), 2):
self.assertGreater(hypot(ax - bx, ay - by) * scale,
(ar + br + 2 * padding) * scale, (a, b))
self.assertEqual(len({x for x, _, _ in buttons.values()}), 4)
self.assertEqual(len({y for _, y, _ in buttons.values()}), 4)
def test_all_levels_keep_one_shared_overlay(self):
for name in ('level_00', 'level_01', 'level_02'):
text = (ROOT / f'levels/{name}.tscn').read_text(encoding='utf-8')
self.assertIn('res://ui/mobile_controls/mobile_controls.tscn', text)
self.assertEqual(text.count('[node name="MobileControls"'), 1)
scene = (ROOT / 'ui/mobile_controls/mobile_controls.tscn').read_text(encoding='utf-8')
self.assertIn('path="res://ui/mobile_controls/touch_surface.gd"', scene)
self.assertIn('mouse_filter = 2', scene)
self.assertNotIn('type="Button"', scene)
self.assertNotIn('button_plate.png', scene)
if __name__ == '__main__':
unittest.main()
+158
View File
@@ -0,0 +1,158 @@
extends SceneTree
## godot --headless --path . --script res://tests/test_mobile_controls_runtime.gd
const MOBILE_SCENE: PackedScene = preload("res://ui/mobile_controls/mobile_controls.tscn")
const MobileControls = preload("res://ui/mobile_controls/mobile_controls.gd")
const TouchSurface = preload("res://ui/mobile_controls/touch_surface.gd")
const ACTIONS: Array[StringName] = [&"jump", &"attack", &"ground_pound", &"special_attack"]
var _failures: int = 0
var _mobile: MobileControls
var _surface: TouchSurface
func _initialize() -> void:
call_deferred("_run")
func _run() -> void:
preload("res://tests/runtime_test_profile.gd").prepare(self)
_mobile = MOBILE_SCENE.instantiate() as MobileControls
_mobile.show_on_desktop = true
root.add_child(_mobile)
await process_frame
_mobile.notification(Node.NOTIFICATION_APPLICATION_FOCUS_IN)
_surface = _mobile.get_node("Controls") as TouchSurface
for area: Rect2 in [Rect2(0, 0, 1280, 720), Rect2(0, 0, 1600, 720), Rect2(48, 0, 1504, 690)]:
_check_layout(area)
# Volvemos a las coordenadas reales del viewport para probar _input.
_mobile.call("_refresh_layout")
var move_area: Rect2 = _surface.movement_area()
var first: Vector2 = move_area.position + move_area.size * Vector2(0.40, 0.62)
var second: Vector2 = move_area.position + move_area.size * Vector2(0.67, 0.42)
var travel: float = _surface.joystick_travel()
var jump: Vector2 = _surface.button_center(&"jump")
var attack: Vector2 = _surface.button_center(&"attack")
var pound: Vector2 = _surface.button_center(&"ground_pound")
var solo: Vector2 = _surface.button_center(&"special_attack")
# Primer toque donde cae el dedo, no sobre el joystick dibujado en reposo.
_touch(2, first, true)
_check(_mobile.direction_touch_index == 2, "El dedo izquierdo reserva el joystick")
_check(_surface._joystick_center.is_equal_approx(first), "El joystick nace en el toque")
_check(is_zero_approx(Input.get_axis(&"move_left", &"move_right")), "Tocar sin arrastrar no mueve")
_drag(2, first + Vector2(travel * 0.10, 0))
_check(is_zero_approx(Input.get_axis(&"move_left", &"move_right")), "La zona muerta evita deriva")
_drag(2, first + Vector2(travel * 0.50, 0))
var partial: float = Input.get_axis(&"move_left", &"move_right")
_check(partial > 0.0 and partial < 1.0, "El control es analogico")
_drag(2, first + Vector2(travel * 2.0, 0))
_check(is_equal_approx(Input.get_axis(&"move_left", &"move_right"), 1.0), "El arrastre fuera del circulo sigue funcionando")
_touch(5, jump, true)
_touch(8, attack, true)
_check(Input.is_action_pressed(&"jump") and Input.is_action_pressed(&"attack"), "Salto y ataque tienen dedos propios")
_check(Input.is_action_pressed(&"move_right"), "Los botones no interrumpen el movimiento")
_touch(9, jump, true)
_touch(9, jump, false)
_check(Input.is_action_pressed(&"jump"), "Un segundo dedo no roba el salto")
_drag(5, attack)
_check(Input.is_action_pressed(&"jump"), "Deslizar fuera mantiene el salto")
_touch(5, attack, false)
_check(not Input.is_action_pressed(&"jump") and Input.is_action_pressed(&"attack"), "Soltar salto no suelta ataque")
_touch(8, attack, false, true)
_check(not Input.is_action_pressed(&"attack"), "Un evento cancelado suelta su boton")
# Abajo es una direccion propia y no se activa con una diagonal ligera.
_drag(2, first + Vector2(travel * 0.8, travel * 0.3))
_check(Input.is_action_pressed(&"move_right") and not Input.is_action_pressed(&"move_down"), "Diagonal horizontal no agacha")
_drag(2, first + Vector2(0, travel * 0.50))
_check(not Input.is_action_pressed(&"move_down"), "Umbral de agachado")
_drag(2, first + Vector2(0, travel * 0.75))
_check(Input.is_action_pressed(&"move_down") and is_zero_approx(Input.get_axis(&"move_left", &"move_right")), "Abajo frena y agacha")
_drag(2, first + Vector2(0, travel * 0.45))
_check(Input.is_action_pressed(&"move_down"), "Histeresis mantiene agachado")
_touch(5, jump, true)
_check(Input.is_action_pressed(&"jump") and Input.is_action_pressed(&"move_down"), "Abajo y salto tienen dedos independientes")
_touch(5, jump, false)
_drag(2, first + Vector2(0, travel * 0.20))
_check(not Input.is_action_pressed(&"move_down"), "Volver al centro libera abajo")
_drag(2, first + Vector2(0, travel))
_drag(2, first - Vector2(travel, 0))
_check(not Input.is_action_pressed(&"move_down"), "Cambiar a izquierda libera abajo")
_check(Input.is_action_pressed(&"move_left") and not Input.is_action_pressed(&"move_right"), "Giro sin dos direcciones activas")
_drag(2, first)
_check(is_zero_approx(Input.get_axis(&"move_left", &"move_right")), "Volver al centro frena")
_touch(2, first, false)
_touch(3, second, true)
_check(_surface._joystick_center.is_equal_approx(second), "El siguiente toque recoloca el joystick")
_drag(3, second + Vector2(0, travel))
_check(Input.is_action_pressed(&"move_down"), "El segundo origen permite agacharse")
_touch(10, pound, true)
_touch(11, solo, true)
_check(Input.is_action_pressed(&"ground_pound") and Input.is_action_pressed(&"special_attack"), "Caer y solo conservan sus acciones")
paused = true
await process_frame
_mobile.call("_sync_visibility")
_check(not _surface.visible and _mobile.direction_touch_index == -1, "La pausa oculta y libera el joystick")
_check(not Input.is_action_pressed(&"move_left") and not Input.is_action_pressed(&"move_down") and not Input.is_action_pressed(&"ground_pound") and not Input.is_action_pressed(&"special_attack"), "Pausa no deja teclas tactiles atascadas")
paused = false
await process_frame
_mobile.call("_sync_visibility")
_drag(3, second + Vector2(travel, 0))
_check(is_zero_approx(Input.get_axis(&"move_left", &"move_right")), "Reanudar requiere un toque nuevo")
_touch(4, first, true)
_drag(4, first + Vector2(0, travel))
_touch(6, jump, true)
_mobile.notification(Node.NOTIFICATION_APPLICATION_FOCUS_OUT)
_check(not Input.is_action_pressed(&"jump") and not Input.is_action_pressed(&"move_down"), "Perder foco libera acciones y abajo")
_mobile.notification(Node.NOTIFICATION_APPLICATION_FOCUS_IN)
_touch(7, attack, true)
_check(Input.is_action_pressed(&"attack"), "Tras recuperar foco funcionan nuevos toques")
_mobile.queue_free()
await process_frame
await process_frame
_check(not Input.is_action_pressed(&"attack"), "Salir de la escena libera el boton")
if _failures == 0:
print("OK MOBILE: distribucion, joystick flotante analogico, multitouch, cancelacion, pausa y salida")
quit(0 if _failures == 0 else 1)
func _check_layout(area: Rect2) -> void:
_surface.set_safe_rect(area)
for action: StringName in ACTIONS:
var center: Vector2 = _surface.button_center(action)
var radius: float = _surface.button_radius(action)
var padding: float = TouchSurface.HIT_PADDING * _surface.layout_scale()
var extent := Vector2.ONE * (radius + padding)
_check(area.encloses(Rect2(center - extent, extent * 2.0)), "Boton dentro de zona segura: " + str(action))
_check(center.x > area.get_center().x, "Acciones en la mitad derecha")
_check(_surface.action_at(center) == action, "Hit test en el centro")
_check(_surface.action_at(center + Vector2(radius * 0.88, radius * 0.88)) != action, "El hitbox es circular, no cuadrado")
for other: StringName in ACTIONS:
if other == action:
continue
_check(center.distance_to(_surface.button_center(other)) > radius + _surface.button_radius(other) + padding * 2.0, "No se superponen las areas tactiles")
_check(not _surface.movement_area().has_point(area.position + Vector2(20, 20)), "El HUD superior queda libre")
func _touch(index: int, local: Vector2, pressed: bool, canceled: bool = false) -> void:
var event := InputEventScreenTouch.new()
event.index = index
event.position = _surface.get_global_transform_with_canvas() * local
event.pressed = pressed
event.canceled = canceled
root.push_input(event, true)
func _drag(index: int, local: Vector2) -> void:
var event := InputEventScreenDrag.new()
event.index = index
event.position = _surface.get_global_transform_with_canvas() * local
root.push_input(event, true)
func _check(condition: bool, message: String) -> void:
if not condition:
_failures += 1
push_error(message)