import json

with open('gamedata/npcs.json', 'r') as f:
    data = json.load(f)

if 'test_boss' not in data['npcs']:
    data['npcs']['test_boss'] = {
        'name': {'en': 'Level 50 Test Boss', 'es': 'Jefe de Prueba Nivel 50'},
        'description': {'en': 'A huge terrifying monster.', 'es': 'Un monstruo enorme y aterrador.'},
        'emoji': '👹',
        'hp_min': 1000,
        'hp_max': 1500,
        'damage_min': 25,
        'damage_max': 45,
        'defense': 15,
        'xp_reward': 500,
        'loot_table': [],
        'flee_chance": 0.0,
        'status_inflict_chance': 0.5,
        'death_message': {'en': 'The boss is defeated.', 'es': 'El jefe ha sido derrotado.'}
    }
    with open('gamedata/npcs.json', 'w') as f:
        json.dump(data, f, indent=2)
    print("Boss added.")
else:
    print("Boss exists.")
