Generally, you are not allowed to hit someone with a baseball bat, but if you are robbed at gunpoint, in most jurisdictions that ban no longer applies because the other party has already committed a crime against you (pointing a gun at you) and has therefore lost her/his protection against being physically assaulted.
Does that, or a similar principle, apply in war?
E.g., AFAIK purposely bombing hospitals is a war crime, but in case the hospital is used for military purposes, which again, AFAIK, is a war crime in itself, then the hospital becomes a legitimate target. Is the war crime of intentionally bombing a hospital "excused" if the hospital (partially) is part of the other side's military infrastructure?
Alternative scenario: Imagine a hospital where half of the floors are used as an extermination camp (which I think is a war crime) and half of the floors are for regular hospital purposes.
If you can suggest other relevant scenarios, please comment on them too.