I don't masturbate at all and my chastity doesn't affect my abilities to lucid dream one bit. Maybe it works for you because you put so much effort into masturbating that you forget to do other things like RC?