Density-dependent adjustment of inducible defenses