Cambiados los aspectos visuales del juego a algo gotico
This commit is contained in:
1 parent
ec7e35ddf6
commit
967b3a286d
205 files changed
+7056
-1630
No files matched your search
@@ -2,22 +2,20 @@
|
||||
from pathlib import Path
|
||||
import re
|
||||
import unittest
|
||||
import xml.etree.ElementTree as ET
|
||||
try:
|
||||
from .art_asset_helpers import animation_frames, atlas_path, atlas_regions, region_hash, rgba_png
|
||||
except ImportError: # unittest discover -s tests imports each module at the top level.
|
||||
from art_asset_helpers import animation_frames, atlas_path, atlas_regions, region_hash, rgba_png
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
ROLES = ('guitarist', 'drummer', 'bassist', 'singer')
|
||||
NAMES = ('Diego', 'Ivan', 'Fer', 'Hector')
|
||||
SVG_NS = '{http://www.w3.org/2000/svg}'
|
||||
|
||||
|
||||
def source(path):
|
||||
return (ROOT / path).read_text(encoding='utf-8')
|
||||
|
||||
|
||||
def cell_groups(path):
|
||||
return {group.attrib['id']: group for group in ET.parse(ROOT / path).getroot().findall(SVG_NS + 'g')}
|
||||
|
||||
|
||||
class BandResourceTests(unittest.TestCase):
|
||||
def test_named_profiles_have_independent_frames(self):
|
||||
for role, name in zip(ROLES, NAMES):
|
||||
@@ -82,63 +80,51 @@ class BandResourceTests(unittest.TestCase):
|
||||
expected_names = {'idle', 'walk', 'jump', 'fall', 'punch', 'ground_pound',
|
||||
'land', 'pound_land', 'special_start', 'special', 'special_end', 'hurt'}
|
||||
for role in ROLES:
|
||||
atlas = ET.parse(ROOT / f'assets/characters/band/{role}.svg').getroot()
|
||||
self.assertEqual((atlas.attrib['width'], atlas.attrib['height']), ('512', '320'))
|
||||
self.assertEqual(atlas.attrib['shape-rendering'], 'geometricPrecision')
|
||||
self.assertFalse(list(atlas.iter(SVG_NS + 'image')))
|
||||
self.assertFalse(list(atlas.iter(SVG_NS + 'text')))
|
||||
text = source(f'player/characters/animations/{role}_frames.tres')
|
||||
self.assertEqual(set(re.findall(r'"name": &"([^"]+)"', text)), expected_names)
|
||||
atlas_file = atlas_path(ROOT, text)
|
||||
self.assertEqual(atlas_file.suffix, '.png')
|
||||
width, height, rgba = rgba_png(atlas_file)
|
||||
self.assertEqual((width, height), (1152, 768))
|
||||
alpha = rgba[3::4]
|
||||
self.assertEqual(min(alpha), 0, 'El fondo del atlas debe ser transparente')
|
||||
self.assertGreaterEqual(max(alpha), 250, 'Los cuerpos deben contener pixeles opacos')
|
||||
self.assertTrue(expected_names <= set(re.findall(r'"name": &"([^"]+)"', text)))
|
||||
declared = re.findall(r'\[sub_resource type="AtlasTexture" id="([^"]+)"\]', text)
|
||||
self.assertEqual(len(declared), 40)
|
||||
self.assertGreaterEqual(len(declared), 40)
|
||||
self.assertEqual(set(declared), set(re.findall(r'SubResource\("([^"]+)"\)', text)))
|
||||
self.assertEqual(set(declared), set(cell_groups(f'assets/characters/band/{role}.svg')))
|
||||
for x, y, w, h in re.findall(r'region = Rect2\((\d+), (\d+), (\d+), (\d+)\)', text):
|
||||
x, y, w, h = map(int, (x, y, w, h))
|
||||
self.assertEqual((w, h), (64, 64))
|
||||
self.assertLessEqual(x+w, 512)
|
||||
self.assertLessEqual(y+h, 320)
|
||||
regions = atlas_regions(text)
|
||||
self.assertEqual(set(declared), set(regions))
|
||||
for x, y, w, h in regions.values():
|
||||
self.assertEqual((w, h), (192, 192))
|
||||
self.assertEqual((x % 192, y % 192), (0, 0))
|
||||
self.assertLessEqual(x+w, width)
|
||||
self.assertLessEqual(y+h, height)
|
||||
self.assertEqual(int(re.search(r'load_steps=(\d+)', text)[1]),
|
||||
1+len(re.findall(r'^\[(?:ext|sub)_resource ', text, re.M)))
|
||||
|
||||
def test_playable_art_has_distinct_identity_and_correct_instruments(self):
|
||||
generator = source('tools/generate_vector_character_art.py')
|
||||
# Rasgos visibles y paletas propias, no solo cambios de nombre en los SVG.
|
||||
for token in ('Barba abundante', 'Chaleco vaquero oscuro',
|
||||
'Camiseta negra', 'Rizo pequeño', 'Chaqueta negra con solapas',
|
||||
'count = 4 if is_bass else 6'):
|
||||
self.assertIn(token, generator)
|
||||
guitarist = source('assets/characters/band/guitarist.svg')
|
||||
bassist = source('assets/characters/band/bassist.svg')
|
||||
drummer = source('assets/characters/band/drummer.svg')
|
||||
singer = source('assets/characters/band/singer.svg')
|
||||
self.assertIn('Diego', guitarist)
|
||||
self.assertIn('Fer', bassist)
|
||||
self.assertIn('Iván', drummer)
|
||||
self.assertIn('Héctor', singer)
|
||||
# El instrumento aparece en las poses especiales, no en el idle.
|
||||
identities = set()
|
||||
for role in ROLES:
|
||||
groups = cell_groups(f'assets/characters/band/{role}.svg')
|
||||
idle_paths = list(groups['idle_0'].iter(SVG_NS + 'path'))
|
||||
special_paths = list(groups['special_0'].iter(SVG_NS + 'path'))
|
||||
self.assertGreater(len(special_paths), len(idle_paths), role)
|
||||
self.assertIn('Dos baquetas cruzadas', generator)
|
||||
self.assertIn('nunca aparecen en Fer', generator)
|
||||
self.assertIn('verde de cuatro cuerdas', source('assets/characters/band/README.md'))
|
||||
frames = source(f'player/characters/animations/{role}_frames.tres')
|
||||
regions = atlas_regions(frames)
|
||||
image = rgba_png(atlas_path(ROOT, frames))
|
||||
idle = region_hash(image, regions[animation_frames(frames, 'idle')[0]])
|
||||
special = {region_hash(image, regions[name]) for name in animation_frames(frames, 'special')}
|
||||
self.assertTrue(any(pose != idle for pose in special), role)
|
||||
identities.add(idle)
|
||||
# Los instrumentos y siluetas se inspeccionan ademas en la captura real.
|
||||
portrait = ROOT / f'assets/ashen/portraits/{role}.png'
|
||||
self.assertTrue(portrait.is_file(), role)
|
||||
self.assertEqual(len(identities), 4, 'Cada integrante conserva un sprite propio')
|
||||
|
||||
def test_vector_walk_uses_six_distinct_leg_contacts(self):
|
||||
# Ninguna celda conserva los rectangulos originales; pasos con tobillo y rodilla.
|
||||
def test_pixel_walk_uses_distinct_animation_cells(self):
|
||||
for role in ROLES:
|
||||
groups = cell_groups(f'assets/characters/band/{role}.svg')
|
||||
paths = []
|
||||
for i in range(6):
|
||||
group = groups[f'walk_{i}']
|
||||
paths.append(group.find(SVG_NS+'path').attrib['d'])
|
||||
self.assertTrue(any('url(#jacket)' in str(node.attrib)
|
||||
for node in group.iter(SVG_NS+'path')), role)
|
||||
self.assertGreaterEqual(len(set(paths)), 5, role)
|
||||
self.assertIn('def draw_shoe(', source('tools/generate_vector_character_art.py'))
|
||||
self.assertIn('def pose_parameters(', source('tools/generate_vector_character_art.py'))
|
||||
frames = source(f'player/characters/animations/{role}_frames.tres')
|
||||
walk = animation_frames(frames, 'walk')
|
||||
regions = atlas_regions(frames)
|
||||
image = rgba_png(atlas_path(ROOT, frames))
|
||||
self.assertEqual(len(walk), 6)
|
||||
self.assertGreaterEqual(len({region_hash(image, regions[name]) for name in walk}), 5, role)
|
||||
|
||||
def test_punch_uses_identical_timing_in_every_profile(self):
|
||||
expected = [('1.0', 'punch_0'), ('0.75', 'punch_1'), ('1.15', 'punch_2'),
|
||||
@@ -162,7 +148,8 @@ class BandResourceTests(unittest.TestCase):
|
||||
self.assertNotIn(identifier, fx)
|
||||
for kind in ('electric_pound', 'vocal_dome', 'bass_cracks', 'vocal_wave', 'drum_cymbals', 'bass_pulse'):
|
||||
self.assertIn(f'func _draw_{kind}(', fx)
|
||||
self.assertIn('draw_colored_polygon(dome', fx)
|
||||
self.assertIn('draw_texture_rect_region(FX_ATLAS', fx)
|
||||
self.assertIn('CanvasItem.TEXTURE_FILTER_NEAREST', fx)
|
||||
self.assertIn('draw_set_transform(Vector2.ZERO, 0.0, Vector2.ONE)', fx)
|
||||
|
||||
def test_bass_notes_and_camera_share_the_combat_pulse(self):
|
||||
|
||||
Reference in new issue
Block a user