One of the means of reducing herbivory is for the plant to allocate some its excess carbon to secondary metabolites with toxic properties, and to protective mechanical structures like thorns.