Hi,
since attacking_pwitch contains its index into the array, you can use it with no loops at all.

Code:
if(w_typempcurr[attacking_pwitch] >= 2) //have enough magic
{
  w_typempcurr[attacking_pwitch] -= 2; //subtract magic
}
else
{
  beep();
  return;
}