Many types of retaliation are illegal, but not all. Under the law you have a right to complain to the landlord about the landlord's violation of the Residential Landlord Tenant Act. This can include things like failing to make repairs that the landlord is responsible to make. Or you can make a health and safety complaint to a government agency charged with enforcing building or housing codes. Any time you make a complaint, do it in writing, be sure to include a date in the writing, and keep a copy of it.
If you make a complaint to the landlord or government agency, then the landlord is not allowed to retaliate in four ways. The landlord cannot (1) raise your rent beyond the fair market value of the property; (2) decrease your "essential services" (meaning water, hot water, gas (if used for heat, hot water, or cooking), electricity, plumbing or sewer systems); (3) bring an eviction action against you; (4) or refuse to renew your lease because you complained. If the landlord does one of these four things, then you can raise retaliation as a defense if the landlord sues you for eviction. If you raise this as a defense, you have to notify the landlord in writing within ten days after service of the Rule that you will raise a retaliation defense. In other words, you should write down this defense in your answer to the Rule and mail it to the landlord as well as filing it with the magistrate's court. If you prevail, the magistrate can award you either three times your monthly rent or two times your actual damages, whichever is greater, plus attorney fees if an attorney represented you. If you lose, however, and the magistrate court finds that your defense was "without merit," then the magistrate can order you to pay the landlord's attorney's fees. "Without merit" means that the facts of your case plainly do not support a retaliation defense. Also, if you bring a retaliation defense in what the law calls "bad faith," then the magistrate can order you to pay the landlord three times your monthly rent. "Bad faith" means that you are raising a defense that you know or should know to be meritless but you do it anyway.
Your landlord might retaliate against you in other ways, such as by becoming more difficult to work with or by becoming stricter about things that the landlord used to let slide. The only types of landlord retaliation that the law recognizes are the four types listed above. A retaliation defense can be complicated. You should consult an attorney if you think you have one.