It's really easy.
int GetPercentImmuneFromCostTableValue(int nValue) {
if (nValue > 50 && nValue < 151)
return nValue-50;
switch (nValue) {
case 1: return 5;
case 2: return 10;
case 3: return 25;
case 4: return 50;
case 5: return 75;
case 6: return 90;
case 7: return 100;
}
return -1;
}
int GetCostValueFromPercentImmune (int nImmune) {
return nImmune + 50;
}
Basically, you can stop using the old costtable consts (1-7). Just take the percent immunity you want, and add 50 to it, and use that in place of the IP_CONST_DAMAGEIMMUNITY_ const.
For example, to do 63% immunity to fire:
itemproperty ip = ItemPropertyDamageImmunity(IP_CONST_DAMAGETYPE_FIRE, 113);
Funky