| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- """
- 最终验证脚本 - 检查特效字段保留功能
- """
- import json
- import os
- def test_effect_preservation():
- """测试特效字段是否被正确保留"""
- weapons_file = os.path.join(os.path.dirname(__file__), '..', 'weapons.json')
-
- if not os.path.exists(weapons_file):
- print(f"错误: weapons.json 文件不存在: {weapons_file}")
- return False
-
- with open(weapons_file, 'r', encoding='utf-8') as f:
- data = json.load(f)
-
- weapons = data.get('weapons', [])
-
- # 检查hot_pepper的burnEffect
- hot_pepper = None
- for weapon in weapons:
- if weapon.get('id') == 'hot_pepper':
- hot_pepper = weapon
- break
-
- if not hot_pepper:
- print("错误: 找不到hot_pepper武器")
- return False
-
- # 检查bulletConfig.visual.burnEffect
- bullet_burn_effect = hot_pepper.get('bulletConfig', {}).get('visual', {}).get('burnEffect')
- if bullet_burn_effect:
- print(f"✓ hot_pepper的bulletConfig.visual.burnEffect已保留: {bullet_burn_effect}")
- else:
- print("✗ hot_pepper的bulletConfig.visual.burnEffect丢失")
- return False
-
- # 检查其他武器的explosionEffect
- weapons_with_explosion = []
- for weapon in weapons:
- explosion_effect = weapon.get('bulletConfig', {}).get('visual', {}).get('explosionEffect')
- if explosion_effect:
- weapons_with_explosion.append({
- 'id': weapon.get('id'),
- 'explosionEffect': explosion_effect
- })
-
- if weapons_with_explosion:
- print(f"✓ 找到 {len(weapons_with_explosion)} 个武器保留了explosionEffect:")
- for weapon in weapons_with_explosion:
- print(f" - {weapon['id']}: {weapon['explosionEffect']}")
- else:
- print("✗ 没有找到保留explosionEffect的武器")
- return False
-
- print("\n🎉 特效字段保留功能验证成功!")
- return True
- if __name__ == '__main__':
- test_effect_preservation()
|