Actio libera in causa is a law principle in Continental laws. A person who voluntarily and deliberately gets drunk or cause mental illness in order to commit a crime is guilty of that crime even though at the time he commits the prohibited conduct he may be blind-drunk and acting involuntarily.
References
Actio libera in causa Wikipedia(Text) CC BY-SA