Stress–Energy Mechanism for Rock Failure Evolution Based on Damage Mechanics in Hard Rock