59 lines
2.9 KiB
Python
59 lines
2.9 KiB
Python
"""Contratos del parche incremental: arte, animacion y puerta del Nivel 02.
|
|
|
|
Verifica recursos sin sustituir la inspeccion visual ni las pruebas del motor.
|
|
"""
|
|
from pathlib import Path
|
|
import re
|
|
import unittest
|
|
from xml.etree import ElementTree
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
LEVEL = (ROOT / "levels/level_02.tscn").read_text(encoding="utf-8")
|
|
BOSS = (ROOT / "bosses/spectral_death/spectral_death.tscn").read_text(encoding="utf-8")
|
|
BOSS_CODE = (ROOT / "bosses/spectral_death/spectral_death.gd").read_text(encoding="utf-8")
|
|
GATE_CODE = (ROOT / "world/triggers/ossuary_gate_visual.gd").read_text(encoding="utf-8")
|
|
|
|
|
|
class Level02VisualResourceTests(unittest.TestCase):
|
|
def test_scene_references_are_real_files(self):
|
|
for scene in [LEVEL, BOSS]:
|
|
for resource in re.findall(r'path="res://([^\"]+)"', scene):
|
|
self.assertTrue((ROOT / resource).is_file(), resource)
|
|
|
|
def test_reaper_has_real_animation_frames_and_separate_weapon(self):
|
|
atlas = ROOT / "assets/bosses/muerte/muerte_body_atlas.svg"
|
|
scythe = ROOT / "assets/bosses/muerte/spectral_scythe.svg"
|
|
for path in (atlas, scythe):
|
|
root = ElementTree.parse(path).getroot()
|
|
self.assertIn("viewBox", root.attrib)
|
|
self.assertGreater(int(root.attrib["width"]), 90)
|
|
frames = (ROOT / "assets/bosses/muerte/muerte_frames.tres").read_text()
|
|
for animation in ("idle", "approach", "telegraph", "slash", "cast", "dash", "phase", "hurt", "death"):
|
|
self.assertIn(f'"name": &"{animation}"', frames)
|
|
self.assertIn('name="WeaponPivot"', BOSS)
|
|
self.assertIn('name="ThrownScythe"', BOSS)
|
|
self.assertIn('name="Body" type="AnimatedSprite2D"', BOSS)
|
|
|
|
def test_hit_reaction_and_movement_do_not_replace_combat_patterns(self):
|
|
self.assertIn('func _spawn_damage_number(amount: int)', BOSS_CODE)
|
|
self.assertIn('body.play(&"hurt")', BOSS_CODE)
|
|
self.assertIn('func _start_camera_framing()', BOSS_CODE)
|
|
self.assertIn('"move":', BOSS_CODE)
|
|
self.assertIn('"double_sweep", "scythe", "runes", "dash", "rest"', BOSS_CODE)
|
|
self.assertIn('current_health = PHASE_HEALTH', BOSS_CODE)
|
|
|
|
def test_gate_keeps_the_original_kill_requirement_and_opens_visibly(self):
|
|
level_code = (ROOT / "levels/level_02.gd").read_text()
|
|
self.assertIn('remaining == 0', level_code)
|
|
self.assertIn('has de derrotar a todos los mal nacidos para poder atravesar esta puerta!', level_code)
|
|
self.assertIn('gate_visual.fully_open.connect(', level_code)
|
|
self.assertIn('gate_visual.set_unlocked(_gate_open)', level_code)
|
|
self.assertIn('func _draw_skull(', GATE_CODE)
|
|
self.assertIn('func _draw_leaf(', GATE_CODE)
|
|
self.assertIn('fully_open.emit()', GATE_CODE)
|
|
self.assertIn('name="Visual" type="Node2D"', LEVEL)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|