A defendant is not confined to denials of the allegations of the complaint or petition, but is entitled to set out new matter in defense or as a basis for affirmative relief. In a suit in which plaintiff alleges that defendant has been negligent, contributory negligence by the plaintiff is sometimes a defense which a defendant can raise.
This form is a generic example of an answer and affirmative defense that may be referred to when preparing such a pleading for your particular state.