"""DT_CharacterAbility 데이터 구조 확인 (수정)"""
import json

with open('../../원본데이터/DataTable.json', 'r', encoding='utf-8') as f:
    data = json.load(f)

# Assets에서 CharacterAbility 찾기
assets = data.get('Assets', [])
print(f"총 Assets: {len(assets)}")

# DT_CharacterAbility 찾기
dt_char = None
for asset in assets:
    asset_type = asset.get('Type', '')
    asset_name = asset.get('Name', '')

    if asset_type == 'DataTable' and 'CharacterAbility' in asset_name:
        dt_char = asset
        print(f"\n발견: {asset_name}")
        break

if not dt_char:
    print("DT_CharacterAbility를 찾을 수 없습니다.")
    exit(1)

# Rows 확인
rows = dt_char.get('Rows', {})
print(f"   Rows 개수: {len(rows)}")
print(f"   Row 키: {list(rows.keys())}")

# 우르드 확인
for row_name, row_data in rows.items():
    if 'Urud' in row_name:
        print(f"\n우르드: {row_name}")
        print(f"   데이터 키: {list(row_data.keys())}")

        # attackMontageMap 확인
        if 'attackMontageMap' in row_data:
            print(f"\n   attackMontageMap:")
            attack_map = row_data['attackMontageMap']
            print(f"      타입: {type(attack_map)}")

            if isinstance(attack_map, dict):
                for k, v in attack_map.items():
                    print(f"      [{k}]: {v}")
            elif isinstance(attack_map, list):
                for idx, item in enumerate(attack_map):
                    print(f"      [{idx}]: {item}")

# 리옌 확인
for row_name, row_data in rows.items():
    if 'Lian' in row_name:
        print(f"\n리옌: {row_name}")

        if 'attackMontageMap' in row_data:
            print(f"\n   attackMontageMap:")
            attack_map = row_data['attackMontageMap']
            print(f"      타입: {type(attack_map)}")

            if isinstance(attack_map, dict):
                for k, v in attack_map.items():
                    print(f"      [{k}]: {v}")
