--- deliantra/server/common/living.C 2010/03/28 16:41:45 1.112 +++ deliantra/server/common/living.C 2010/03/28 18:44:21 1.114 @@ -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) @@ -1152,7 +1143,7 @@ if (type != PLAYER) this->chosen_skill = chosen_skill; - glow_radius = min (glow_radius, MAX_LIGHT_RADIUS); + min_it (glow_radius, MAX_LIGHT_RADIUS); /* We've gone through all the objects the player has equipped. For many things, we * have generated intermediate values which we now need to assign. @@ -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] < 0 || potion_resist[i] > resist[i])) resist[i] = potion_resist[i]; }