"""리옌 연화, 정조준 몽타주 확인"""
import json

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

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

# DT_Skill에서 SK190201, SK190101의 몽타주 이름 찾기
dt_skill = None
for asset in dt_data.get('Assets', []):
    if asset.get('AssetName') == 'DT_Skill':
        dt_skill = asset
        break

if not dt_skill:
    print("DT_Skill을 찾을 수 없습니다.")
    exit(1)

print("=== 리옌 스킬 몽타주 확인 ===\n")

target_skills = ['SK190201', 'SK190101']
skill_montages = {}

for row in dt_skill.get('Rows', []):
    row_name = row.get('RowName', '')
    if row_name in target_skills:
        row_data = row.get('Data', {})
        montage_path = row_data.get('montage', '')
        skill_name = row_data.get('name', '')

        print(f"[{row_name}] {skill_name}")
        print(f"  Montage Path: {montage_path}")

        # 몽타주 이름 추출
        if montage_path:
            montage_name = montage_path.split('/')[-1].replace("'", "").split('.')[0]
            skill_montages[row_name] = montage_name
            print(f"  Montage Name: {montage_name}\n")

# 각 몽타주에서 노티파이 확인
print("\n=== 몽타주 노티파이 확인 ===\n")

for skill_id, montage_name in skill_montages.items():
    for asset in montage_data.get('Assets', []):
        if asset.get('AssetName') == montage_name:
            print(f"[{skill_id}] {montage_name}")

            notifies = asset.get('AnimNotifies', [])
            print(f"  총 노티파이: {len(notifies)}개\n")

            for idx, notify in enumerate(notifies):
                notify_class = notify.get('NotifyClass', '')

                # SimpleSendEvent 노티파이
                if 'SimpleSendEvent' in notify_class:
                    print(f"  [{idx}] SimpleSendEvent")
                    print(f"      NotifyClass: {notify_class}")

                    if 'CustomProperties' in notify:
                        custom_props = notify['CustomProperties']
                        event_tag = custom_props.get('Event Tag', '')
                        print(f"      Event Tag: {event_tag}")

                        # Event.SpawnProjectile 확인
                        if 'SpawnProjectile' in event_tag:
                            print(f"      >>> Event.SpawnProjectile 발견! (공격 스킬)")
                    print()

                # Projectile 노티파이
                if 'Projectile' in notify_class:
                    print(f"  [{idx}] Projectile 노티파이")
                    print(f"      NotifyClass: {notify_class}")
                    if 'ProjectileShot' in notify_class:
                        print(f"      >>> ProjectileShot 발견! (공격 스킬)")
                    print()

            print("-" * 60)
            print()
