<commit_before>local nativeTalents = {}

local npc_heroes = LoadKeyValues("scripts/npc/npc_heroes.txt")
local npc_abilities = LoadKeyValues("scripts/npc/npc_heroes.txt")

local function addTalent(talentName, heroName)
	-- Get original value, before npc_abilities_override affection
	local originalValues = GetAbilitySpecial(talentName, nil, nil, npc_abilities[talentName])
	local newValues = GetAbilitySpecial(talentName)
	nativeTalents[talentName] = {
		cost = 1,
		group = 1,
		icon = heroName,
		requirement = heroName,
		original_values = originalValues,
		special_values = newValues,
		effect = { abilities = talentName }
	}
end

for heroName, heroData in pairs(npc_heroes) do
	local partiallyChanged = PARTIALLY_CHANGED_HEROES[heroName]
	local isChanged = GetKeyValue(heroName, "Changed") == 1 and not partiallyChanged
	if type(heroData) == "table" and not isChanged then
		for _,talentName in pairs(heroData) do
			if type(talentName) == "string" and string.starts(talentName, "special_bonus_unique_") then
				if not partiallyChanged or partiallyChanged[talentName] ~= true then
					addTalent(talentName, heroName)<commit_msg>fix(custom_talents): original talent values for replacement were overriden ones<commit_after>local nativeTalents = {}

local npc_heroes = LoadKeyValues("scripts/npc/npc_heroes.txt")
local npc_abilities = LoadKeyValues("scripts/npc/npc_abilities.txt")

local function addTalent(talentName, heroName)
	-- Get original value, before npc_abilities_override affection
	local originalValues = GetAbilitySpecial(talentName, nil, nil, npc_abilities[talentName])
	local newValues = GetAbilitySpecial(talentName)
	nativeTalents[talentName] = {
		cost = 1,
		group = 1,
		icon = heroName,
		requirement = heroName,
		original_values = originalValues,
		special_values = newValues,
		effect = { abilities = talentName }
	}
end

for heroName, heroData in pairs(npc_heroes) do
	local partiallyChanged = PARTIALLY_CHANGED_HEROES[heroName]
	local isChanged = GetKeyValue(heroName, "Changed") == 1 and not partiallyChanged
	if type(heroData) == "table" and not isChanged then
		for _,talentName in pairs(heroData) do
			if type(talentName) == "string" and string.starts(talentName, "special_bonus_unique_") then
				if not partiallyChanged or partiallyChanged[talentName] ~= true then
					addTalent(talentName, heroName)
{'fraction_non_alphanumeric': 0.08849935870029928, 'fraction_numerical': 0.0025651988029072254, 'mean_word_length': 6.027027027027027, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '823668', 'n_tokens_mistral': 794, 'n_tokens_neox': 744, 'n_words': 185}