Impurity seeding has been confirmed to be a potential way for edge localized modes (ELMs) to be mitigated in tokamaks. This paper mainly combines the integrated equilibria reconstruction framework and edge simulation codes such as BOUT++ to dive deeper into the mechanism of the ELM mitigation by impurity injection. On the one hand, impurity injection changes the pedestal pressure and current profiles that are closely related to ELM activities. The nonlinear simulation result shows that ELM size decreases by a factor of 2 to 4 when the current exceeds a threshold after impurity injection. On the other hand, the decrease of Er shear is supposed to cause a larger ELM size for a less stabilized effect. However, ELMs are mitigated with smaller Er shear as observed in the HL-2A experiment. This indicates that changes in the profiles of pressure gradient and hence the current density may play a more important role than Er shear in this ELM mitigation process. In contrast to the high n modes destabilized by the pellet pacing, metallic impurity seeding leads to more unstable low n modes. The simulation results indicate that the combination of changes in pressure/current and Er shear is a plausible explanation for the ELM mitigation by metallic impurity seeding.