The Supreme Court’s ruling in Wolford v. Lopez and its decision to take up two cases involving modern semiautomatic firearms Tuesday outline a pattern in which states and localities hostile to the Second Amendment may be unintentionally assisting gun owners in securing their rights across the country.