It cant be "fixed" because you get wood when you break structures
If an allie or enemy unit dies, the hack automatically gives you an instawin.
That means you must break an structure without losing a single unit or killing one, because that would trigger the hack
Edit: the only way i think it would be possible is to make your units inmune to damage rather than triggering autowin, which would lead your army to destroy everything no matter how many units the enemy has