<commit_before>local FOUNTAIN_PERCENTAGE_MANA_REGEN = 15
local FOUNTAIN_PERCENTAGE_HEALTH_REGEN = 15

modifier_fountain_aura_arena = class({
	IsPurgable =                          function() return false end,
	GetModifierHealthRegenPercentage =    function() return FOUNTAIN_PERCENTAGE_MANA_REGEN end,
	GetModifierTotalPercentageManaRegen = function() return FOUNTAIN_PERCENTAGE_HEALTH_REGEN end,
	GetTexture =                          function() return "fountain_heal" end,
})

function modifier_fountain_aura_arena:DeclareFunctions()
	return {
		MODIFIER_PROPERTY_HEALTH_REGEN_PERCENTAGE,
		MODIFIER_PROPERTY_MANA_REGEN_TOTAL_PERCENTAGE
	}
end

if IsServer() then
	function modifier_fountain_aura_arena:OnCreated()
		self:StartIntervalThink(0.25)
		self:OnIntervalThink()
	end

	function modifier_fountain_aura_arena:OnDestroy()
		self:GetParent():RemoveModifierByName("modifier_fountain_aura_invulnerability")
	end

	local centralBossKilled = false
	Events:Register("bosses/kill/central", "fountain", function ()
		centralBossKilled = true
	end)
	Events:Register("bosses/respawn/central", "fountain", function ()
		centralBossKilled = false
	end)

	function modifier_fountain_aura_arena:OnIntervalThink()
		local parent = self:GetParent()
		while parent:HasModifier("modifier_saber_mana_burst_active") do
			parent:RemoveModifierByName("modifier_saber_mana_burst_active")
		end
		if parent:IsCourier() then return end
		for i = 0, 11 do
			local item = parent:GetItemInSlot(i)
			if item and item:GetAbilityName() == "item_bottle_arena" then
				item:SetCurrentCharges(3)
			end
		end

		local hasMod = parent:HasModifier("modifier_fountain_aura_invulnerability")
		if not centralBossKilled and not hasMod then
			parent:AddNewModifier(parent, nil, "modifier_fountain_aura_invulnerability", nil)
		elseif centralBossKilled and hasMod then
			parent:RemoveModifierByName("modifier_fountain_aura_invulnerability")
		end
	end
end

modifier_fountain_aura_invulnerability = class({
	IsPurgable =                  function() return false end,
	GetMinHealth =                function() return 1 end,
	GetAbsoluteNoDamagePhysical = function() return 1 end,
	GetAbsoluteNoDamageMagical =  function() return 1 end,
	GetAbsoluteNoDamagePure =     function() return 1 end,
	GetTexture =                  function() return "modifier_invulnerable" end,
})

function modifier_fountain_aura_invulnerability:DeclareFunctions()
	return {
		MODIFIER_PROPERTY_MIN_HEALTH,
		MODIFIER_PROPERTY_ABSOLUTE_NO_DAMAGE_PHYSICAL,
		MODIFIER_PROPERTY_ABSOLUTE_NO_DAMAGE_MAGICAL,
		MODIFIER_PROPERTY_ABSOLUTE_NO_DAMAGE_PURE,
		MODIFIER_PROPERTY_TOOLTIP
	}
end
<commit_msg>fix)ability): parent check worked incorrectly<commit_after>local FOUNTAIN_PERCENTAGE_MANA_REGEN = 15
local FOUNTAIN_PERCENTAGE_HEALTH_REGEN = 15

modifier_fountain_aura_arena = class({
	IsPurgable =                          function() return false end,
	GetModifierHealthRegenPercentage =    function() return FOUNTAIN_PERCENTAGE_MANA_REGEN end,
	GetModifierTotalPercentageManaRegen = function() return FOUNTAIN_PERCENTAGE_HEALTH_REGEN end,
	GetTexture =                          function() return "fountain_heal" end,
})

function modifier_fountain_aura_arena:DeclareFunctions()
	return {
		MODIFIER_PROPERTY_HEALTH_REGEN_PERCENTAGE,
		MODIFIER_PROPERTY_MANA_REGEN_TOTAL_PERCENTAGE
	}
end

if IsServer() then
	function modifier_fountain_aura_arena:OnCreated()
		self:StartIntervalThink(0.25)
		self:OnIntervalThink()
	end

	function modifier_fountain_aura_arena:OnDestroy()
		self:GetParent():RemoveModifierByName("modifier_fountain_aura_invulnerability")
	end

	local centralBossKilled = false
	Events:Register("bosses/kill/central", "fountain", function ()
		centralBossKilled = true
	end)
	Events:Register("bosses/respawn/central", "fountain", function ()
		centralBossKilled = false
	end)

	function modifier_fountain_aura_arena:OnIntervalThink()
		local parent = self:GetParent()
		while parent:HasModifier("modifier_saber_mana_burst_active") do
			parent:RemoveModifierByName("modifier_saber_mana_burst_active")
		end

		local hasMod = parent:HasModifier("modifier_fountain_aura_invulnerability")
		if not centralBossKilled and not hasMod then
			parent:AddNewModifier(parent, nil, "modifier_fountain_aura_invulnerability", nil)
		elseif centralBossKilled and hasMod then
			parent:RemoveModifierByName("modifier_fountain_aura_invulnerability")
		end

		if parent:IsCourier() then return end
		for i = 0, 11 do
			local item = parent:GetItemInSlot(i)
			if item and item:GetAbilityName() == "item_bottle_arena" then
				item:SetCurrentCharges(3)
			end
		end
	end
end

modifier_fountain_aura_invulnerability = class({
	IsPurgable =                  function() return false end,
	GetMinHealth =                function() return 1 end,
	GetAbsoluteNoDamagePhysical = function() return 1 end,
	GetAbsoluteNoDamageMagical =  function() return 1 end,
	GetAbsoluteNoDamagePure =     function() return 1 end,
	GetTexture =                  function() return "modifier_invulnerable" end,
})

function modifier_fountain_aura_invulnerability:DeclareFunctions()
	return {
		MODIFIER_PROPERTY_MIN_HEALTH,
		MODIFIER_PROPERTY_ABSOLUTE_NO_DAMAGE_PHYSICAL,
		MODIFIER_PROPERTY_ABSOLUTE_NO_DAMAGE_MAGICAL,
		MODIFIER_PROPERTY_ABSOLUTE_NO_DAMAGE_PURE,
		MODIFIER_PROPERTY_TOOLTIP
	}
end

{'fraction_non_alphanumeric': 0.06859612854726554, 'fraction_numerical': 0.0056380379627889495, 'mean_word_length': 5.619402985074627, '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': '6616582', 'n_tokens_mistral': 1980, 'n_tokens_neox': 1797, 'n_words': 318}