--- deliantra/server/common/living.C 2010/03/28 16:18:39 1.111 +++ deliantra/server/common/living.C 2010/03/28 16:41:45 1.112 @@ -942,26 +942,24 @@ * Resistance from potions are treated special as well. If there's * more than one potion-effect, the bigger prot.-value is taken. */ - if (tmp->type != POTION) - { - for (int i = 0; i < NROFATTACKS; i++) - { - /* Potential for cursed potions, in which case we just can use - * a straight MAX, as potion_resist is initialised to zero. - */ - if (tmp->type == POTION_EFFECT) - { - if (potion_resist[i]) - potion_resist[i] = max (potion_resist[i], tmp->resist[i]); - else - potion_resist[i] = tmp->resist[i]; - } - else if (tmp->resist[i] > 0) - prot[i] += ((100 - prot[i]) * tmp->resist[i]) / 100; - else if (tmp->resist[i] < 0) - vuln[i] += ((100 - vuln[i]) * -tmp->resist[i]) / 100; - } - } + if (tmp->type == POTION_EFFECT) + for (int i = 0; i < NROFATTACKS; i++) + { + /* Potential for cursed potions, in which case we just can use + * a straight MAX, as potion_resist is initialised to zero. + // TODO: this is askign for a magic marker optimisation + */ + if (potion_resist[i]) + max_it (potion_resist[i], tmp->resist[i]); + else + potion_resist[i] = tmp->resist[i]; + } + else if (tmp->type != POTION) + for (int i = 0; i < NROFATTACKS; i++) + if (tmp->resist[i] > 0) + prot[i] += ((100 - prot[i]) * tmp->resist[i]) / 100; + else if (tmp->resist[i] < 0) + vuln[i] += ((100 - vuln[i]) * -tmp->resist[i]) / 100; /* There may be other things that should not adjust the attacktype */ if (tmp->type != SYMPTOM)