test_final_verification.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. 最终验证脚本 - 检查特效字段保留功能
  5. """
  6. import json
  7. import os
  8. def test_effect_preservation():
  9. """测试特效字段是否被正确保留"""
  10. weapons_file = os.path.join(os.path.dirname(__file__), '..', 'weapons.json')
  11. if not os.path.exists(weapons_file):
  12. print(f"错误: weapons.json 文件不存在: {weapons_file}")
  13. return False
  14. with open(weapons_file, 'r', encoding='utf-8') as f:
  15. data = json.load(f)
  16. weapons = data.get('weapons', [])
  17. # 检查hot_pepper的burnEffect
  18. hot_pepper = None
  19. for weapon in weapons:
  20. if weapon.get('id') == 'hot_pepper':
  21. hot_pepper = weapon
  22. break
  23. if not hot_pepper:
  24. print("错误: 找不到hot_pepper武器")
  25. return False
  26. # 检查bulletConfig.visual.burnEffect
  27. bullet_burn_effect = hot_pepper.get('bulletConfig', {}).get('visual', {}).get('burnEffect')
  28. if bullet_burn_effect:
  29. print(f"✓ hot_pepper的bulletConfig.visual.burnEffect已保留: {bullet_burn_effect}")
  30. else:
  31. print("✗ hot_pepper的bulletConfig.visual.burnEffect丢失")
  32. return False
  33. # 检查其他武器的explosionEffect
  34. weapons_with_explosion = []
  35. for weapon in weapons:
  36. explosion_effect = weapon.get('bulletConfig', {}).get('visual', {}).get('explosionEffect')
  37. if explosion_effect:
  38. weapons_with_explosion.append({
  39. 'id': weapon.get('id'),
  40. 'explosionEffect': explosion_effect
  41. })
  42. if weapons_with_explosion:
  43. print(f"✓ 找到 {len(weapons_with_explosion)} 个武器保留了explosionEffect:")
  44. for weapon in weapons_with_explosion:
  45. print(f" - {weapon['id']}: {weapon['explosionEffect']}")
  46. else:
  47. print("✗ 没有找到保留explosionEffect的武器")
  48. return False
  49. print("\n🎉 特效字段保留功能验证成功!")
  50. return True
  51. if __name__ == '__main__':
  52. test_effect_preservation()