Mg0 + 2 HICl H20 + MgIICl2

This is an oxidation-reduction (redox) reaction:

2 HI + 2 e- 2 H0 (reduction)

Mg0 - 2 e- MgII (oxidation)

Change the oxidation states