IFormatProvider, why does it have - 48 on the end?

firstDigit = (enemy_Percentages*.ToString()[1]) - 48;*
Why - 48 on the end?

48 is a “ASCII value” of “0” sign
So basically, you have enemy_Percentages with some values, you get i element, You turn it into String, get SECOND character from it, (it probably is a number) and you get character ‘2’ for example, which in int value is 50. subtracting 48 from it will give you exact number 2. (not character anymore).

So probably enemy_percentage is a number with 2 digits. You will get second digit by changing ToString()[1] to ToString()[0].

End of and answaer.

This is a really ugly way of doing it. look at int.TryParse() or int.Parse(). This will give you a number rught away without this weird looking thing. If you would like the first digit then, use modulo operation % and for number of tens use div.