--- deliantra/server/common/living.C 2010/03/28 16:41:45 1.112 +++ deliantra/server/common/living.C 2010/03/28 17:04:37 1.113 @@ -822,11 +822,11 @@ for (int i = 0; i < NROFATTACKS; i++) { if (resist[i] > 0) - prot[i] = resist[i], vuln[i] = 0; + prot[i] = resist[i], vuln[i] = 0; else - vuln[i] = -(resist[i]), prot[i] = 0; + vuln[i] = -resist[i], prot[i] = 0; - potion_resist[i] = 0; + potion_resist[i] = -1000; } wc = arch->stats.wc; @@ -944,16 +944,7 @@ */ 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]; - } + max_it (potion_resist[i], tmp->resist[i]); else if (tmp->type != POTION) for (int i = 0; i < NROFATTACKS; i++) if (tmp->resist[i] > 0) @@ -1168,7 +1159,8 @@ { resist[i] = prot[i] - vuln[i]; - if (potion_resist[i] && ((potion_resist[i] > resist[i]) || (potion_resist[i] < 0))) + if (potion_resist[i] != -1000 + && (potion_resist[i] > resist[i] || potion_resist[i] < 0)) resist[i] = potion_resist[i]; }