function normalRespawnTimer()
	for _, player in pairs(ents.GetAllPlayers()) do	
		if player:IsRealPlayer() then	
			player:SetAttributeValue("min respawn time", 20)
		end
	end	
end

function noRespawnTimer()
	for _, player in pairs(ents.GetAllPlayers()) do	
		if player:IsRealPlayer() then	
			player:SetAttributeValue("min respawn time", 666666)
		end
	end	
end

function has_value (tab, val) --copied from stack overflow
    for index, value in ipairs(tab) do
        if value == val then
            return true
        end
    end
    return false
end

function plagueKnife(damage, activator, caller)	
	if damage > 100 then --hack because butter knife deals 62 damage
		activator:TakeDamage({Damage = activator.m_iHealth *0.5, Attacker = activator, DamageType = DMG_PARALYZE})
		
		if caller:IsBot() then
			for _, others in pairs(ents.FindInSphere(caller:GetAbsOrigin(),192)) do
				if others:IsBot() then
					others:AddCond(112,-1,activator)
					ents.FindByName("PK_fx_spawner_mini"):Teleport(others:GetAbsOrigin())
					ents.FindByName("PK_fx_spawner_mini"):AcceptInput("ForceSpawn")
				end
			end	
			ents.FindByName("PK_fx_spawner"):Teleport(activator:GetAbsOrigin())
			ents.FindByName("PK_fx_spawner"):AcceptInput("ForceSpawn")
		end	
	end	
end

function superboss_atk1_trigger()
	for _, player in pairs(ents.GetAllPlayers()) do	
		if player:IsRealPlayer() then	
			ents.FindByName("Superboss_atk1_spawner"):Teleport(player:GetAbsOrigin())
			ents.FindByName("Superboss_atk1_spawner"):AcceptInput("ForceSpawn")
		end
	end
end

function freeze_boss()
	for _, player in pairs(ents.GetAllPlayers()) do	
		if player:IsBot() then	
			player:SetAttributeValue("move speed penalty", 0.001)
			timer.Simple(5.5, function()
				player:SetAttributeValue("move speed penalty", 1)
			end)
		end
	end	
end

function heal_boss()
	for _, player in pairs(ents.GetAllPlayers()) do	
		if player:IsBot() then	
			player:AddCond(73,5.5)
		end
	end	
end

function OnWaveSpawnBot(bot, wave, tags) --only used in superbuffed version
	if has_value(tags, "bot_enragable") then --enrage bot function
		local maxHealth = bot.m_iHealth
		local enraged = false	
		bot:AddCallback(ON_DAMAGE_RECEIVED_POST, function(ent, damage, previousHealth)
			local curHealth = bot.m_iHealth
			if curHealth <= maxHealth*0.65 and enraged == false then
				enraged = true
				bot:AddCond(34,-1)
				bot:AddCond(26,-1)
				bot:AddCond(71,1)
				bot:ChangeAttributes("Enraged")
			end
		end)
	end	
end